pidgin: cce3a22f: Fixed bug in which Yahoo contacts were e...

evands at pidgin.im evands at pidgin.im
Tue Mar 4 20:21:27 EST 2008


-----------------------------------------------------------------
Revision: cce3a22f53972bd3834175b08ad5e7b800bf98e9
Ancestor: 23069829f47d323660bf3b3205d61f0156256a2b
Author: evands at pidgin.im
Date: 2008-03-05T00:26:44
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cce3a22f53972bd3834175b08ad5e7b800bf98e9

Modified files:
        libpurple/protocols/yahoo/yahoo.c
        libpurple/protocols/yahoo/yahoo.h

ChangeLog: 

Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
espcially noticeable for people with very large buddy lists.
The problem was that we can receive the Yahoo p15 buddy list in multiple
packets, and the server expects us to remember the group for which we're
receiving buddies, as it won't remind us.
Our logic is "no group means blocked," which is why these buddies became blocked.

Fixes http://trac.adiumx.com/ticket/7744

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	aeef64612853baa5a062a60991d7179b070b574e
+++ libpurple/protocols/yahoo/yahoo.c	6ca375f9f1715ebc3447d4faf2139d43a107db60
@@ -464,7 +464,6 @@ static void yahoo_process_list_15(Purple
 	PurpleAccount *account = purple_connection_get_account(gc);
 	struct yahoo_data *yd = gc->proto_data;
 	GHashTable *ht;
-	char *grp = NULL;
 	char *norm_bud = NULL;
 	YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
 	                       /* But what if you had no friends? */
@@ -487,8 +486,8 @@ static void yahoo_process_list_15(Purple
 			 */
 			if (pair->value && !strcmp(pair->value, "320")) {
 				/* No longer in any group; this indicates the start of the ignore list. */
-				g_free(grp);
-				grp = NULL;
+				g_free(yd->current_list15_grp);
+				yd->current_list15_grp = NULL;
 			}
 
 			break;
@@ -497,28 +496,30 @@ static void yahoo_process_list_15(Purple
 		case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */
 			break;
 		case 65: /* This is the group */
-			g_free(grp);
-			grp = yahoo_string_decode(gc, pair->value, FALSE);
+			g_free(yd->current_list15_grp);
+			yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE);
 			break;
 		case 7: /* buddy's s/n */
 			g_free(norm_bud);
 			norm_bud = g_strdup(purple_normalize(account, pair->value));
 
-			if (grp) {
+			if (yd->current_list15_grp) {
 				/* This buddy is in a group */
 				f = yahoo_friend_find_or_new(gc, norm_bud);
 				if (!(b = purple_find_buddy(account, norm_bud))) {
-					if (!(g = purple_find_group(grp))) {
-						g = purple_group_new(grp);
+					if (!(g = purple_find_group(yd->current_list15_grp))) {
+						g = purple_group_new(yd->current_list15_grp);
 						purple_blist_add_group(g, NULL);
 					}
 					b = purple_buddy_new(account, norm_bud, NULL);
 					purple_blist_add_buddy(b, NULL, g, NULL);
 				}
-				yahoo_do_group_check(account, ht, norm_bud, grp);
+				yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp);
 
 			} else {
 				/* This buddy is on the ignore list (and therefore in no group) */
+				purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found",
+								  account->username, norm_bud);
 				purple_privacy_deny_add(account, norm_bud, 1);
 			}
 			break;
@@ -543,7 +544,6 @@ static void yahoo_process_list_15(Purple
 
 	g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
 	g_hash_table_destroy(ht);
-	g_free(grp);
 	g_free(norm_bud);
 }
 
@@ -3070,6 +3070,8 @@ static void yahoo_close(PurpleConnection
 	g_free(yd->pending_chat_topic);
 	g_free(yd->pending_chat_goto);
 
+	g_free(yd->current_list15_grp);
+
 	g_free(yd);
 	gc->proto_data = NULL;
 }
============================================================
--- libpurple/protocols/yahoo/yahoo.h	8fb0c92f1a12146719e9cfa04f9f763e9b1760eb
+++ libpurple/protocols/yahoo/yahoo.h	e96fe22cf0f67333a831aa300a1e0312ff4c457e
@@ -175,6 +175,12 @@ struct yahoo_data {
 	GSList *url_datas;
 	GHashTable *xfer_peer_idstring_map;/*Hey, i dont know, but putting this HashTable next to friends gives a run time fault...*/
 	GSList *cookies;/*contains all cookies, including _y and _t*/
+	
+	/**
+	 * We may receive a list15 in multiple packets with no prior warning as to how many we'll be getting;
+	 * the server expects us to keep track of the group for which it is sending us contact names.
+	 */
+	char *current_list15_grp;
 };
 
 #define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255)


More information about the Commits mailing list