Mercurial > pidgin.yaz
changeset 26247:74bb0836f164
msn interoperability : presence settings
author | Sulabh Mahajan <sulabh@soc.pidgin.im> |
---|---|
date | Wed, 21 Jan 2009 09:14:01 +0000 |
parents | 1e02d4592894 |
children | bc31ebd391d3 |
files | libpurple/protocols/yahoo/yahoo_friend.c |
diffstat | 1 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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);