changeset 24003:32828b3c0d4f

Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 29 Aug 2008 14:01:14 +0000
parents 5e51360bb22c
children ae6a825a27e4
files libpurple/protocols/jabber/buddy.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Fri Aug 29 13:59:59 2008 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Fri Aug 29 14:01:14 2008 +0000
@@ -1251,7 +1251,6 @@
 
 			text = xmlnode_get_data(child);
 			if(text && !strcmp(child->name, "FN")) {
-				/* If we havne't found a name yet, use this one as the serverside name */
 				if (!serverside_alias)
 					serverside_alias = g_strdup(text);
 
@@ -1275,11 +1274,14 @@
 					g_free(text2);
 				}
 			} else if(text && !strcmp(child->name, "NICKNAME")) {				
-				/* Prefer the Nickcname to the Full Name as the serverside alias */
-				g_free(serverside_alias);
-				serverside_alias = g_strdup(text);
-
-				purple_notify_user_info_add_pair(user_info, _("Nickname"), text);
+				/* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid.
+				 * Ignore it if it's part of the jid. */
+				if (strstr(bare_jid, text) == NULL) {
+					g_free(serverside_alias);
+					serverside_alias = g_strdup(text);
+					
+					purple_notify_user_info_add_pair(user_info, _("Nickname"), text);
+				}
 			} else if(text && !strcmp(child->name, "BDAY")) {
 				purple_notify_user_info_add_pair(user_info, _("Birthday"), text);
 			} else if(!strcmp(child->name, "ADR")) {