# HG changeset patch # User Sulabh Mahajan # Date 1232529241 0 # Node ID 74bb0836f16467bff71885e6a6ac2705baa2cfba # Parent 1e02d4592894b90c80716f0adf24554158dfbc2a msn interoperability : presence settings diff -r 1e02d4592894 -r 74bb0836f164 libpurple/protocols/yahoo/yahoo_friend.c --- a/libpurple/protocols/yahoo/yahoo_friend.c Wed Jan 21 08:55:05 2009 +0000 +++ b/libpurple/protocols/yahoo/yahoo_friend.c Wed Jan 21 09:14:01 2009 +0000 @@ -147,24 +147,36 @@ { GSList *l = pkt->hash; YahooFriend *f; + char *temp = NULL; char *who = NULL; int value = 0; + int protocol = 0; + gboolean wlm = FALSE; while (l) { struct yahoo_pair *pair = l->data; switch (pair->key) { case 7: - who = pair->value; + temp = pair->value; break; case 31: value = strtol(pair->value, NULL, 10); break; + case 241: + protocol = strtol(pair->value, NULL, 10); + wlm = TRUE; + break; } l = l->next; } + if(wlm) + who = g_strconcat("wlm/", temp, NULL); + else + who = g_strdup(temp); + if (value != 1 && value != 2) { purple_debug_error("yahoo", "Received unknown value for presence key: %d\n", value); return; @@ -173,8 +185,10 @@ g_return_if_fail(who != NULL); f = yahoo_friend_find(gc, who); - if (!f) + if (!f) { + g_free(who); return; + } if (pkt->service == YAHOO_SERVICE_PRESENCE_PERM) { purple_debug_info("yahoo", "Setting permanent presence for %s to %d.\n", who, (value == 1)); @@ -194,6 +208,7 @@ else f->presence = YAHOO_PRESENCE_DEFAULT; } + g_free(who); } void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, @@ -204,6 +219,7 @@ YahooFriend *f; const char *thirtyone, *thirteen; int service = -1; + const char *temp = NULL; if (!yd->logged_in) return; @@ -212,6 +228,11 @@ if (!f) return; + if(f->protocol == 2) + temp = name+4; + else + temp = name; + /* No need to change the value if it is already correct */ if (f->presence == presence) { purple_debug_info("yahoo", "Not setting presence because there are no changes.\n"); @@ -241,14 +262,14 @@ 1, purple_connection_get_display_name(gc), 31, "2", 13, "2", 302, "319", 300, "319", - 7, name, 241, f->protocol, + 7, temp, 241, f->protocol, 301, "319", 303, "319"); else yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc), 31, "2", 13, "2", 302, "319", 300, "319", - 7, name, + 7, temp, 301, "319", 303, "319"); yahoo_packet_send_and_free(pkt, yd); @@ -268,14 +289,14 @@ 1, purple_connection_get_display_name(gc), 31, thirtyone, 13, thirteen, 302, "319", 300, "319", - 7, name, 241, f->protocol, + 7, temp, 241, f->protocol, 301, "319", 303, "319"); else yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc), 31, thirtyone, 13, thirteen, 302, "319", 300, "319", - 7, name, + 7, temp, 301, "319", 303, "319"); yahoo_packet_send_and_free(pkt, yd);