soc.2008.yahoo: 0d85cc9f: msn interoperability : presence settings

sulabh at soc.pidgin.im sulabh at soc.pidgin.im
Wed Jan 21 04:21:36 EST 2009


-----------------------------------------------------------------
Revision: 0d85cc9f0cfb9f1246661fa1c03a0a0d9a1c443b
Ancestor: fe656da032cb72795dd0358684230951fd249797
Author: sulabh at soc.pidgin.im
Date: 2009-01-21T09:14:01
Branch: im.pidgin.soc.2008.yahoo
URL: http://d.pidgin.im/viewmtn/revision/info/0d85cc9f0cfb9f1246661fa1c03a0a0d9a1c443b

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

ChangeLog: 

msn interoperability : presence settings

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo_friend.c	5333ac154a27e69f136b25d3cd583468cdb4d861
+++ libpurple/protocols/yahoo/yahoo_friend.c	7567ab98710e713b9c2e288865600ab3a1aab3e6
@@ -147,24 +147,36 @@ void yahoo_process_presence(PurpleConnec
 {
 	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(PurpleConnec
 	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(PurpleConnec
 		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(Purple
 	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(Purple
 	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(Purple
 					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(Purple
 				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);


More information about the Commits mailing list