pidgin: c9c14c0c: Fix MSN forgetting display names for bud...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Mon Oct 12 18:58:15 EDT 2009


-----------------------------------------------------------------
Revision: c9c14c0c44e2863ad15a283f36c5c278a4ea5539
Ancestor: e342d10b415f6261ea20d408d825bc2603dc2e66
Author: sadrul at pidgin.im
Date: 2009-10-12T17:45:17
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c9c14c0c44e2863ad15a283f36c5c278a4ea5539

Modified files:
        libpurple/protocols/msn/contact.c
        libpurple/protocols/msn/notification.c
        libpurple/protocols/msn/user.c

ChangeLog: 

Fix MSN forgetting display names for buddies.  Fixes #10421.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c	6dc1144d5694f2c5095fc1804cdc9de2c70bfe3f
+++ libpurple/protocols/msn/contact.c	519d981b5f562844dba20b0aa4743f1507d9600d
@@ -356,9 +356,10 @@ msn_parse_each_member(MsnSession *sessio
 	char *type;
 	char *member_id;
 	MsnUser *user;
-	xmlnode *annotation;
+	xmlnode *annotation, *display;
 	guint nid = MSN_NETWORK_UNKNOWN;
 	char *invite = NULL;
+	char *display_text;
 
 	passport = xmlnode_get_data(xmlnode_get_child(member, node));
 	if (!purple_email_is_valid(passport)) {
@@ -368,8 +369,14 @@ msn_parse_each_member(MsnSession *sessio
 
 	type = xmlnode_get_data(xmlnode_get_child(member, "Type"));
 	member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId"));
-	user = msn_userlist_find_add_user(session->userlist, passport, NULL);
+	if ((display = xmlnode_get_child(member, "DisplayName"))) {
+		display_text = xmlnode_get_data(display);
+	} else {
+		display_text = NULL;
+	}
 
+	user = msn_userlist_find_add_user(session->userlist, passport, display_text);
+
 	for (annotation = xmlnode_get_child(member, "Annotations/Annotation");
 	     annotation;
 	     annotation = xmlnode_get_next_twin(annotation)) {
@@ -409,6 +416,7 @@ msn_parse_each_member(MsnSession *sessio
 	g_free(type);
 	g_free(member_id);
 	g_free(invite);
+	g_free(display_text);
 }
 
 static void
============================================================
--- libpurple/protocols/msn/notification.c	4a4a6a4a6ec6b733796a53b033e2ab40d3c6c689
+++ libpurple/protocols/msn/notification.c	75b838fd6aeaa44d5776d8e5e07cb6ca74f01fb2
@@ -1098,7 +1098,6 @@ iln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 	}
 
 	if (msn_user_set_friendly_name(user, friendly)) {
-		serv_got_alias(gc, passport, friendly);
 		msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly);
 	}
 	g_free(friendly);
@@ -1263,7 +1262,6 @@ nln_cmd(MsnCmdProc *cmdproc, MsnCommand 
 
 	if (msn_user_set_friendly_name(user, friendly))
 	{
-		serv_got_alias(gc, passport, friendly);
 		msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly);
 	}
 
============================================================
--- libpurple/protocols/msn/user.c	53a3cb07cd6b852d9ffe81f8c46202d94e289c33
+++ libpurple/protocols/msn/user.c	2ddbc85af8b002a2f1e56eb917f2fbb162e56c1b
@@ -183,12 +183,15 @@ msn_user_set_friendly_name(MsnUser *user
 {
 	g_return_val_if_fail(user != NULL, FALSE);
 
-	if (user->friendly_name && name && !strcmp(user->friendly_name, name))
+	if (user->friendly_name && name && (!strcmp(user->friendly_name, name) ||
+				!strcmp(user->passport, name)))
 		return FALSE;
 
 	g_free(user->friendly_name);
 	user->friendly_name = g_strdup(name);
 
+	serv_got_alias(purple_account_get_connection(user->userlist->session->account),
+			user->passport, name);
 	return TRUE;
 }
 


More information about the Commits mailing list