changeset 28655:c9d3bda6ef81

Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is often buddies to block, but can also be buddies to allow or maybe your privacy setting. I imagine this eliminates some "unable to add buddy" errors. Apparently I discovered this idiosyncrasy on 2007-04-23 and fixed it for icon items in 5ee6fd5ddac3a8e8920941dee8be3ae5a615c105, but for some reason I didn't fix it for any other types of items. I'm also making this loop a bit less heavy handed... it used to require that new items had an itemID greater than every other item. Now it just makes sure the itemID is not equal the itemID and not equal to the groupID of any other item. Let it be known that the best way for me to fix blocking is to have people I don't want to talk to IM me.
author Mark Doliner <mark@kingant.net>
date Thu, 24 Sep 2009 01:50:02 +0000
parents ad04e3ffb3d5
children a177a1cdfe4e 8aa24fd75490 fa77b70c8ca6
files libpurple/protocols/oscar/family_feedbag.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_feedbag.c	Thu Sep 24 01:29:56 2009 +0000
+++ b/libpurple/protocols/oscar/family_feedbag.c	Thu Sep 24 01:50:02 2009 +0000
@@ -135,13 +135,18 @@
 					}
 			} while (exists);
 		}
-	} else if (type == AIM_SSI_TYPE_ICONINFO) {
+	} else if (new->gid == 0x0000) {
+		/*
+		 * This is weird, but apparently items in the root group can't
+		 * have a buddy ID equal to any group ID.  You'll get error
+		 * 0x0003 when trying to add, which is "item already exists"
+		 */
 		if (new->bid == 0xFFFF) {
 			do {
 				new->bid += 0x0001;
 				exists = FALSE;
 				for (cur = *list; cur != NULL; cur = cur->next)
-					if ((cur->bid >= new->bid) || (cur->gid >= new->bid)) {
+					if (cur->bid == new->bid || cur->gid == new->bid) {
 						exists = TRUE;
 						break;
 					}
@@ -153,7 +158,7 @@
 				new->bid += 0x0001;
 				exists = FALSE;
 				for (cur = *list; cur != NULL; cur = cur->next)
-					if ((cur->bid == new->bid) && (cur->gid == new->gid)) {
+					if (cur->bid == new->bid && cur->gid == new->gid) {
 						exists = TRUE;
 						break;
 					}