changeset 29049:23f6f80f45ed

Due to a server change, the friendly name on MSN was being changed to the first name of the user as supplied in their Address Book. Cache friendly names and use that at login, with a fallback to the AB name when none has been set. Fixes #10763.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 28 Nov 2009 23:13:55 +0000
parents 7e1b78738352
children ce29013a5f3a
files ChangeLog libpurple/protocols/msn/contact.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c
diffstat 4 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 28 21:33:06 2009 +0000
+++ b/ChangeLog	Sat Nov 28 23:13:55 2009 +0000
@@ -32,6 +32,9 @@
 	* Fix a random crash that might occur when idle.
 	* Fix a crash when logging in with some long non-ASCII passwords.
 	  (Shaun Lindsay)
+	* Cache our own friendly name as the server no longer does that for
+	  us.  Users of older versions may need to re-set their friendly name
+	  as it has probably been reset.
 
 	XMPP:
 	* Users connecting to Google Talk now have an "Initiate Chat" context menu
--- a/libpurple/protocols/msn/contact.c	Sat Nov 28 21:33:06 2009 +0000
+++ b/libpurple/protocols/msn/contact.c	Sat Nov 28 23:13:55 2009 +0000
@@ -702,12 +702,15 @@
 		type = xmlnode_get_data(contactType);
 
 		/*setup the Display Name*/
-		if (type && !strcmp(type, "Me")){
-			char *friendly = NULL;
-			if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
-				friendly = xmlnode_get_data(displayName);
-			purple_connection_set_display_name(session->account->gc, friendly ? purple_url_decode(friendly) : NULL);
-			g_free(friendly);
+		if (type && !strcmp(type, "Me")) {
+			if (purple_connection_get_display_name(pc) == NULL) {
+				char *friendly = NULL;
+				if ((displayName = xmlnode_get_child(contactInfo, "displayName")))
+					friendly = xmlnode_get_data(displayName);
+				purple_connection_set_display_name(pc,
+					friendly ? purple_url_decode(friendly) : NULL);
+				g_free(friendly);
+			}
 			continue; /* Not adding own account as buddy to buddylist */
 		}
 
--- a/libpurple/protocols/msn/msn.c	Sat Nov 28 21:33:06 2009 +0000
+++ b/libpurple/protocols/msn/msn.c	Sat Nov 28 23:13:55 2009 +0000
@@ -1062,6 +1062,9 @@
 	if (strcmp(username, purple_account_get_username(account)))
 		purple_account_set_username(account, username);
 
+	username = purple_account_get_string(account, "display-name", NULL);
+	purple_connection_set_display_name(gc, username);
+
 	if (!msn_session_connect(session, host, port, http_method))
 		purple_connection_error_reason(gc,
 			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
--- a/libpurple/protocols/msn/notification.c	Sat Nov 28 21:33:06 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Sat Nov 28 23:13:55 2009 +0000
@@ -1408,6 +1408,7 @@
 				purple_connection_set_display_name(
 					purple_account_get_connection(session->account),
 					friendlyname);
+				purple_account_set_string(session->account, "display-name", friendlyname);
 			}
 		}
 	}