diff options
author | Sulabh Mahajan <sulabh@pidgin.im> | 2009-01-21 09:14:01 +0000 |
---|---|---|
committer | Sulabh Mahajan <sulabh@pidgin.im> | 2009-01-21 09:14:01 +0000 |
commit | cc30679d3ccebed5594818c3a7ece867db032d70 (patch) | |
tree | d2834c3a3cbfa3361d0975c72a699c19439abb4a | |
parent | a8b425d90980a76cd95d1c8644e91c505b0940dc (diff) | |
download | pidgin-cc30679d3ccebed5594818c3a7ece867db032d70.tar.gz |
msn interoperability : presence settings
-rw-r--r-- | libpurple/protocols/yahoo/yahoo_friend.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/libpurple/protocols/yahoo/yahoo_friend.c b/libpurple/protocols/yahoo/yahoo_friend.c index a18370fbc2..35065279d5 100644 --- a/libpurple/protocols/yahoo/yahoo_friend.c +++ b/libpurple/protocols/yahoo/yahoo_friend.c @@ -147,24 +147,36 @@ void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) { 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 @@ void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) 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 @@ void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) else f->presence = YAHOO_PRESENCE_DEFAULT; } + g_free(who); } void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, @@ -204,6 +219,7 @@ void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, YahooFriend *f; const char *thirtyone, *thirteen; int service = -1; + const char *temp = NULL; if (!yd->logged_in) return; @@ -212,6 +228,11 @@ void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, 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 @@ void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, 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 @@ void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, 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); |