# HG changeset patch # User Mark Doliner # Date 1253757002 0 # Node ID 0eed231d924cda1506826f3d322e0973d21d40ad # Parent 061c2827b3f52152a63f53b873b6e86cfe068973 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. diff -r 061c2827b3f5 -r 0eed231d924c libpurple/protocols/oscar/family_feedbag.c --- 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; }