pidgin: 550161a2: Deal with buddies on MSN more gracefully...

sadrul at pidgin.im sadrul at pidgin.im
Wed Jun 24 04:45:57 EDT 2009


-----------------------------------------------------------------
Revision: 550161a2fd8cd2aa8530ef2b12fe864a90e9509f
Ancestor: d43ee4f5f6097f7a107a1aa122e09d777de7c77d
Author: sadrul at pidgin.im
Date: 2009-06-24T08:17:33
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/550161a2fd8cd2aa8530ef2b12fe864a90e9509f

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

ChangeLog: 

Deal with buddies on MSN more gracefully.

Look ahead to see if we have information about the protocol of the
buddy, because by the time we process the protocol, we may have done
too many other things, e.g. update status, set idleness etc., which
means the real buddy doesn't get updated properly.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c	e2b0aab601a15a7ca4c3c57b114d3d60fdfa9f66
+++ libpurple/protocols/yahoo/yahoo.c	ed45aff1e2d8a45f578f5064049366380a923bf8
@@ -182,8 +182,28 @@ static void yahoo_process_status(PurpleC
 			name = message = NULL;
 			f = NULL;
 			if (pair->value && g_utf8_validate(pair->value, -1, NULL)) {
+				GSList *tmplist;
+				int protocol = 0;
+
 				name = pair->value;
+
+				/* Look ahead to see if we have the protocol info about the buddy */
+				for (tmplist = l->next; tmplist; tmplist = tmplist->next) {
+					struct yahoo_pair *p = tmplist->data;
+					if (p->key == 7)
+						break;
+					if (p->key == 241) {
+						if(strtol(p->value, NULL, 10) == 2) {
+							g_free(msn_name);
+							msn_name = g_strconcat("msn/", name, NULL);
+							name = msn_name;
+							protocol = 2;
+						}
+						break;
+					}
+				}
 				f = yahoo_friend_find_or_new(gc, name);
+				f->protocol = protocol;
 			}
 			break;
 		case 10: /* state */
@@ -331,12 +351,7 @@ static void yahoo_process_status(PurpleC
 				f->version_id = strtol(pair->value, NULL, 10);
 			break;
 		case 241: /* protocol buddy belongs to */
-			if(strtol(pair->value, NULL, 10) == 2) {
-				g_free(msn_name);
-				msn_name = g_strconcat("msn/", name, NULL);
-				name = msn_name;
-			}
-			break;
+			break;  /* We process this when get '7' */
 		default:
 			purple_debug_warning("yahoo",
 					   "Unknown status key %d\n", pair->key);


More information about the Commits mailing list