# HG changeset patch # User Sadrul Habib Chowdhury # Date 1245831453 0 # Node ID 463ed40d4031cdefff2814914907467288225bb3 # Parent e3150217e1b4603ca851149454f93a85c6669a3d 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. diff -r e3150217e1b4 -r 463ed40d4031 libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Wed Jun 24 08:15:22 2009 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Wed Jun 24 08:17:33 2009 +0000 @@ -182,8 +182,28 @@ 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 @@ 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);