pidgin: 1a0227aa: When we download a buddy's vCard to upda...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Sat May 2 17:15:33 EDT 2009
-----------------------------------------------------------------
Revision: 1a0227aa4f285cab8af8faf30127059fa71ce208
Ancestor: 8f2b3a7063a7a0e5cae9de55e55f7066c0d202d6
Author: darkrain42 at pidgin.im
Date: 2009-05-02T20:42:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1a0227aa4f285cab8af8faf30127059fa71ce208
Modified files:
libpurple/protocols/jabber/presence.c
ChangeLog:
When we download a buddy's vCard to update an avatar, also try to update the nickname.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c 13674cf135948854b78222809145f3f75d812b93
+++ libpurple/protocols/jabber/presence.c 4e220eb9ec21379344345205f41487455a850208
@@ -340,7 +340,7 @@ jabber_vcard_parse_avatar(JabberStream *
xmlnode *packet, gpointer blah)
{
JabberBuddy *jb = NULL;
- xmlnode *vcard, *photo, *binval;
+ xmlnode *vcard, *photo, *binval, *fn, *nick;
char *text;
if(!from)
@@ -352,6 +352,29 @@ jabber_vcard_parse_avatar(JabberStream *
if((vcard = xmlnode_get_child(packet, "vCard")) ||
(vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) {
+ /* The logic here regarding the nickname and full name is copied from
+ * buddy.c:jabber_vcard_parse. */
+ gchar *nickname = NULL;
+ if ((fn = xmlnode_get_child(vcard, "FN")))
+ nickname = xmlnode_get_data(fn);
+
+ if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) {
+ char *tmp = xmlnode_get_data(nick);
+ char *bare_jid = jabber_get_bare_jid(from);
+ if (strstr(bare_jid, tmp) == NULL) {
+ g_free(nickname);
+ nickname = tmp;
+ } else
+ g_free(tmp);
+
+ g_free(bare_jid);
+ }
+
+ if (nickname) {
+ serv_got_alias(js->gc, from, nickname);
+ g_free(nickname);
+ }
+
if((photo = xmlnode_get_child(vcard, "PHOTO")) &&
(( (binval = xmlnode_get_child(photo, "BINVAL")) &&
(text = xmlnode_get_data(binval))) ||
More information about the Commits
mailing list