changeset 22416:0c098ebe9f16

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
author Evan Schoenberg <evan.s@dreskin.net>
date Wed, 05 Mar 2008 00:26:44 +0000
parents 9a12b7f5b1f5
children c5a3a92255f5 deb07e7d8679
files libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo.h
diffstat 2 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Tue Mar 04 23:53:44 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Wed Mar 05 00:26:44 2008 +0000
@@ -464,7 +464,6 @@
 	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 @@
 			 */
 			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 @@
 		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 @@
 
 	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 @@
 	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;
 }
--- a/libpurple/protocols/yahoo/yahoo.h	Tue Mar 04 23:53:44 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.h	Wed Mar 05 00:26:44 2008 +0000
@@ -175,6 +175,12 @@
 	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)