pidgin: 321bf1cf: Some more fixes for when unsetting buddy...

sadrul at pidgin.im sadrul at pidgin.im
Tue Jun 30 20:20:35 EDT 2009


-----------------------------------------------------------------
Revision: 321bf1cf9bafe529fea060ca8ba08686a57e884a
Ancestor: 432372c21ad4e6653ca5e193fb6da6b72001ccdf
Author: sadrul at pidgin.im
Date: 2009-07-01T00:12:39
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/321bf1cf9bafe529fea060ca8ba08686a57e884a

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

ChangeLog: 

Some more fixes for when unsetting buddy picture, for both when sending and receiving updates.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	19b6a0ebe6600c07ba26b7312b3b92fdf0e5edd5
+++ libpurple/protocols/yahoo/yahoo.c	ec0eb3761c7cff035101fbbec6d5cbcac244f1c3
@@ -2877,15 +2877,13 @@ static void yahoo_packet_process(PurpleC
 	case YAHOO_SERVICE_PICTURE:
 		yahoo_process_picture(gc, pkt);
 		break;
-	case YAHOO_SERVICE_PICTURE_UPDATE:
-		yahoo_process_picture_update(gc, pkt);
-		break;
 	case YAHOO_SERVICE_PICTURE_CHECKSUM:
 		yahoo_process_picture_checksum(gc, pkt);
 		break;
 	case YAHOO_SERVICE_PICTURE_UPLOAD:
 		yahoo_process_picture_upload(gc, pkt);
 		break;
+	case YAHOO_SERVICE_PICTURE_UPDATE:
 	case YAHOO_SERVICE_AVATAR_UPDATE:
 		yahoo_process_avatar_update(gc, pkt);
 		break;
============================================================
--- libpurple/protocols/yahoo/yahoo_picture.c	3ca005c7f387afc90a787a76a3b90a64619e5f44
+++ libpurple/protocols/yahoo/yahoo_picture.c	4283da0c362cb276c110104213cdead57d480b09
@@ -153,45 +153,6 @@ void yahoo_process_picture(PurpleConnect
 	}
 }
 
-void yahoo_process_picture_update(PurpleConnection *gc, struct yahoo_packet *pkt)
-{
-	GSList *l = pkt->hash;
-	char *who = NULL;
-	int icon = 0;
-
-	while (l) {
-		struct yahoo_pair *pair = l->data;
-
-		switch (pair->key) {
-		case 4:
-			who = pair->value;
-			break;
-		case 5:
-			/* us */
-			break;
-		/* NOTE: currently the server seems to only send 213; 206 was used
-		 * in older versions. Check whether it's still needed. */
-		case 206:
-		case 213:
-			icon = strtol(pair->value, NULL, 10);
-			break;
-		}
-		l = l->next;
-	}
-
-	if (who) {
-		if (icon == 2)
-			yahoo_send_picture_request(gc, who);
-		else if ((icon == 0) || (icon == 1)) {
-			YahooFriend *f;
-			purple_buddy_icons_set_for_user(gc->account, who, NULL, 0, NULL);
-			if ((f = yahoo_friend_find(gc, who)))
-				yahoo_friend_set_buddy_icon_need_request(f, TRUE);
-			purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who);
-		}
-	}
-}
-
 void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *pkt)
 {
 	GSList *l = pkt->hash;
@@ -279,7 +240,8 @@ void yahoo_process_avatar_update(PurpleC
 		case 5:
 			/* us */
 			break;
-		case 206:
+		case 206:   /* Older versions. Still needed? */
+		case 213:   /* Newer versions */
 			/*
 			 * 0 - No icon or avatar
 			 * 1 - Using an avatar
@@ -349,8 +311,8 @@ void yahoo_send_picture_update_to_user(P
 	struct yahoo_data *yd = gc->proto_data;
 	struct yahoo_packet *pkt;
 
-	pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
-	yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), 5, who, 206, type);
+	pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
+	yahoo_packet_hash(pkt, "si", 3, who, 213, type);
 	yahoo_packet_send_and_free(pkt, yd);
 }
 
============================================================
--- libpurple/protocols/yahoo/yahoo_picture.h	7e3cfca9ba88fd99035bbb9be2a41b107c26a931
+++ libpurple/protocols/yahoo/yahoo_picture.h	d4412a10113c0035d3ca768a941ac4db0c5ee5d4
@@ -31,7 +31,6 @@ void yahoo_process_picture(PurpleConnect
 void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type);
 
 void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt);
-void yahoo_process_picture_update(PurpleConnection *gc, struct yahoo_packet *pkt);
 void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *pkt);
 void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt);
 


More information about the Commits mailing list