Fix some problems adding "stuff" to oscar buddy lists, where "stuff" is

Thu, 24 Sep 2009 01:50:02 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Thu, 24 Sep 2009 01:50:02 +0000
changeset 28581
0eed231d924c
parent 28580
061c2827b3f5
child 28582
be0022647095
child 28583
03f8fee2908a

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 c78d878f56f6d3038a4f8dc70473c585e9c59824, 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.

libpurple/protocols/oscar/family_feedbag.c file | annotate | diff | comparison | revisions
--- 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;
 					}

mercurial