pidgin: 2df22d7e: If we receive a Full Name and no nicknam...
evands at pidgin.im
evands at pidgin.im
Sun Mar 9 14:50:42 EDT 2008
-----------------------------------------------------------------
Revision: 2df22d7ed44f0ccc912fc22ea2e0389c0e445b6f
Ancestor: f1716162f34382d8889f8e4288a808f067b91eb1
Author: evands at pidgin.im
Date: 2008-03-09T18:47:09
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2df22d7ed44f0ccc912fc22ea2e0389c0e445b6f
Modified files:
libpurple/protocols/jabber/buddy.c
ChangeLog:
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c 6cc6a150f09b0d4256687f67848c3a2b6dea09c6
+++ libpurple/protocols/jabber/buddy.c fec46aa7242f2197e631a9670cbb0124b1ac01a1
@@ -1209,6 +1209,7 @@ static void jabber_vcard_parse(JabberStr
GString *info_text;
char *bare_jid;
char *text;
+ char *serverside_alias = NULL;
xmlnode *vcard;
PurpleBuddy *b;
JabberBuddyInfo *jbi = data;
@@ -1247,6 +1248,10 @@ static void jabber_vcard_parse(JabberStr
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);
+
jabber_string_escape_and_append(info_text,
_("Full Name"), text, FALSE);
} else if(!strcmp(child->name, "N")) {
@@ -1270,11 +1275,11 @@ static void jabber_vcard_parse(JabberStr
}
g_free(text2);
}
- } else if(text && !strcmp(child->name, "NICKNAME")) {
- serv_got_alias(js->gc, from, text);
- if(b) {
- purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", text);
- }
+ } 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);
+
jabber_string_escape_and_append(info_text,
_("Nickname"), text, FALSE);
} else if(text && !strcmp(child->name, "BDAY")) {
@@ -1434,6 +1439,16 @@ static void jabber_vcard_parse(JabberStr
}
}
+ if (serverside_alias) {
+ /* If we found a serverside alias, set it and tell the core */
+ serv_got_alias(js->gc, from, serverside_alias);
+ if (b) {
+ purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", serverside_alias);
+ }
+
+ g_free(serverside_alias);
+ }
+
jbi->vcard_text = purple_strdup_withhtml(info_text->str);
g_string_free(info_text, TRUE);
g_free(bare_jid);
More information about the Commits
mailing list