changeset 28738:d213c8ad89da

Fix MSN forgetting display names for buddies. Fixes #10421. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 12 Oct 2009 17:45:17 +0000
parents 4a917f91bc05
children 11d40ac36996 bb873040d7de
files libpurple/protocols/msn/contact.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/user.c
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Mon Oct 12 08:27:03 2009 +0000
+++ b/libpurple/protocols/msn/contact.c	Mon Oct 12 17:45:17 2009 +0000
@@ -356,9 +356,10 @@
 	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,7 +369,13 @@
 
 	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;
@@ -409,6 +416,7 @@
 	g_free(type);
 	g_free(member_id);
 	g_free(invite);
+	g_free(display_text);
 }
 
 static void
--- a/libpurple/protocols/msn/notification.c	Mon Oct 12 08:27:03 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Mon Oct 12 17:45:17 2009 +0000
@@ -1098,7 +1098,6 @@
 	}
 
 	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 @@
 
 	if (msn_user_set_friendly_name(user, friendly))
 	{
-		serv_got_alias(gc, passport, friendly);
 		msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly);
 	}
 
--- a/libpurple/protocols/msn/user.c	Mon Oct 12 08:27:03 2009 +0000
+++ b/libpurple/protocols/msn/user.c	Mon Oct 12 17:45:17 2009 +0000
@@ -183,12 +183,15 @@
 {
 	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;
 }