adium-1.4 3083:a960a9aa710d: Implemented a workaround for an ann...
commits at adium.im
commits at adium.im
Fri Oct 15 04:13:55 UTC 2010
details: http://hg.adium.im/adium-1.4/rev/a960a9aa710d
revision: 3083:a960a9aa710d
author: Evan Schoenberg
date: Thu Oct 14 23:13:50 2010 -0500
Implemented a workaround for an annoying Yahoo service bug when moving a contact between two groups, both of which already contain it. A better solution would be at the protocol level; a libpurple ticket should be filed regarding this at some point. Fixes #13871
diffs (39 lines):
diff -r 2a1d1d47ab95 -r a960a9aa710d Plugins/Purple Service/SLPurpleCocoaAdapter.m
--- a/Plugins/Purple Service/SLPurpleCocoaAdapter.m Thu Oct 14 22:30:24 2010 -0500
+++ b/Plugins/Purple Service/SLPurpleCocoaAdapter.m Thu Oct 14 23:13:50 2010 -0500
@@ -1039,7 +1039,34 @@
if ((buddy = purple_find_buddy_in_group(account, [objectUID UTF8String], oldGroup))) {
// Perform the add to the new group. This will turn into a move, and will update serverside.
- AILog(@"Buddy %p (%@) moving serverside to %@", buddy, objectUID, groupName);
+
+ if (strcmp(purple_account_get_protocol_id(account), "prpl-yahoo") == 0) {
+ /* XXX File a bug report with the need for this special-case w/ libpurple -evands 10/14/10 */
+
+ /* Work around a Yahoo! bug in which buddies in multiple groups can't be moved properly.
+ *
+ * Traverse all buddies on this account.
+ * If the buddy is in the old group (it must be, for us to reach this point given the if
+ * statement above) and is also in another group, we need to remove it from the old group before
+ * this move. Otherwise, it won't work. However, if we remove it from the old group and it *isn't* in
+ * another group already, Yahoo will force reauthorization, which is ugly. */
+ GSList *buddies = purple_find_buddies(account, [objectUID UTF8String]);
+
+ BOOL isInGroupBesidesOldGroup = NO;
+ for (GSList *bb = buddies; bb != NULL; bb = bb->next) {
+ PurpleBuddy *aBuddy = (PurpleBuddy *)bb->data;
+ if (purple_buddy_get_group(aBuddy) != oldGroup) {
+ isInGroupBesidesOldGroup = YES;
+ }
+ }
+
+ if (isInGroupBesidesOldGroup) {
+ purple_account_remove_buddy(account, buddy, oldGroup);
+ AILog(@"Removed because it met the Yahoo! workaround criteria");
+ }
+
+ }
+
purple_blist_add_buddy(buddy, NULL, group, NULL);
// Continue so we avoid the "add to group" code below.
continue;
More information about the commits
mailing list