# HG changeset patch # User Sadrul Habib Chowdhury # Date 1255369517 0 # Node ID d213c8ad89da711207fcfddb41f399ce16b2200f # Parent 4a917f91bc0590c101888203f5fd246e0989bff2 Fix MSN forgetting display names for buddies. Fixes #10421. committer: John Bailey diff -r 4a917f91bc05 -r d213c8ad89da libpurple/protocols/msn/contact.c --- 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 diff -r 4a917f91bc05 -r d213c8ad89da libpurple/protocols/msn/notification.c --- 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); } diff -r 4a917f91bc05 -r d213c8ad89da libpurple/protocols/msn/user.c --- 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; }