comparison libpurple/protocols/jabber/buddy.c @ 23933: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 3c3032be12de
children 1de1494a13e5 bb99ee66120e
comparison
equal deleted inserted replaced
23932:5e51360bb22c 23933:32828b3c0d4f
1249 if(child->type != XMLNODE_TYPE_TAG) 1249 if(child->type != XMLNODE_TYPE_TAG)
1250 continue; 1250 continue;
1251 1251
1252 text = xmlnode_get_data(child); 1252 text = xmlnode_get_data(child);
1253 if(text && !strcmp(child->name, "FN")) { 1253 if(text && !strcmp(child->name, "FN")) {
1254 /* If we havne't found a name yet, use this one as the serverside name */
1255 if (!serverside_alias) 1254 if (!serverside_alias)
1256 serverside_alias = g_strdup(text); 1255 serverside_alias = g_strdup(text);
1257 1256
1258 purple_notify_user_info_add_pair(user_info, _("Full Name"), text); 1257 purple_notify_user_info_add_pair(user_info, _("Full Name"), text);
1259 } else if(!strcmp(child->name, "N")) { 1258 } else if(!strcmp(child->name, "N")) {
1273 purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2); 1272 purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2);
1274 } 1273 }
1275 g_free(text2); 1274 g_free(text2);
1276 } 1275 }
1277 } else if(text && !strcmp(child->name, "NICKNAME")) { 1276 } else if(text && !strcmp(child->name, "NICKNAME")) {
1278 /* Prefer the Nickcname to the Full Name as the serverside alias */ 1277 /* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid.
1279 g_free(serverside_alias); 1278 * Ignore it if it's part of the jid. */
1280 serverside_alias = g_strdup(text); 1279 if (strstr(bare_jid, text) == NULL) {
1281 1280 g_free(serverside_alias);
1282 purple_notify_user_info_add_pair(user_info, _("Nickname"), text); 1281 serverside_alias = g_strdup(text);
1282
1283 purple_notify_user_info_add_pair(user_info, _("Nickname"), text);
1284 }
1283 } else if(text && !strcmp(child->name, "BDAY")) { 1285 } else if(text && !strcmp(child->name, "BDAY")) {
1284 purple_notify_user_info_add_pair(user_info, _("Birthday"), text); 1286 purple_notify_user_info_add_pair(user_info, _("Birthday"), text);
1285 } else if(!strcmp(child->name, "ADR")) { 1287 } else if(!strcmp(child->name, "ADR")) {
1286 gboolean address_line_added = FALSE; 1288 gboolean address_line_added = FALSE;
1287 1289