# HG changeset patch # User Paul Aurich # Date 1241239178 0 # Node ID 867e231bffbc45d7d9f3cdf0870a4db8d3683949 # Parent e816444c1a01f52a6a949e6eb749ce6a3f0a392d A little bit better (free memory and support receiving the nick in subscriptions) and Changelog. diff -r e816444c1a01 -r 867e231bffbc ChangeLog --- a/ChangeLog Sat May 02 04:14:09 2009 +0000 +++ b/ChangeLog Sat May 02 04:39:38 2009 +0000 @@ -33,6 +33,8 @@ * Support showing and reporting idle times in the buddy list. (XEP-0256) * Support most recent version of User Avatar. (XEP-0084 v1.1) * Updated Entity Capabilities support. (Tobias Markmann) + * Support receiving user nicknames in presence packets and subscriptions. + (XEP-0172) IRC: * Correctly handle WHOIS for users who are joined to a large number of diff -r e816444c1a01 -r 867e231bffbc libpurple/protocols/jabber/presence.c --- a/libpurple/protocols/jabber/presence.c Sat May 02 04:14:09 2009 +0000 +++ b/libpurple/protocols/jabber/presence.c Sat May 02 04:39:38 2009 +0000 @@ -441,7 +441,7 @@ char *avatar_hash = NULL; xmlnode *caps = NULL; int idle = 0; - const gchar *nick = NULL; + gchar *nickname = NULL; if(!(jb = jabber_buddy_find(js, from, TRUE))) return; @@ -464,6 +464,11 @@ gboolean onlist = FALSE; PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from); JabberBuddy *jb = NULL; + xmlnode *nick; + + nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick"); + if (nick) + nickname = xmlnode_get_data(nick); if (buddy) { jb = jabber_buddy_find(js, from, TRUE); @@ -475,8 +480,9 @@ jap->who = g_strdup(from); jap->js = js; - purple_account_request_authorization(purple_connection_get_account(js->gc), from, NULL, NULL, NULL, onlist, + purple_account_request_authorization(purple_connection_get_account(js->gc), from, NULL, nickname, NULL, onlist, authorize_add_cb, deny_add_cb, jap); + g_free(nickname); jabber_id_free(jid); return; } else if(type && !strcmp(type, "subscribed")) { @@ -528,7 +534,7 @@ } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { caps = y; /* store for later, when creating buddy resource */ } else if (g_str_equal(y->name, "nick") && g_str_equal(xmlns, "http://jabber.org/protocol/nick")) { - nick = xmlnode_get_data(y); + nickname = xmlnode_get_data(y); } else if(!strcmp(y->name, "x")) { if(!strcmp(xmlns, "jabber:x:delay")) { /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ @@ -629,6 +635,7 @@ jabber_id_free(jid); g_free(status); g_free(avatar_hash); + g_free(nickname); return; } @@ -645,6 +652,7 @@ jabber_id_free(jid); g_free(status); g_free(avatar_hash); + g_free(nickname); return; } @@ -731,6 +739,7 @@ jabber_id_free(jid); g_free(avatar_hash); g_free(buddy_name); + g_free(nickname); g_free(status); return; } else { @@ -787,8 +796,8 @@ jabber_google_presence_incoming(js, buddy_name, found_jbr); purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL); purple_prpl_got_user_idle(js->gc->account, buddy_name, found_jbr->idle, found_jbr->idle); - if (nick) - serv_got_alias(js->gc, buddy_name, nick); + if (nickname) + serv_got_alias(js->gc, buddy_name, nickname); } else { purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL); } @@ -815,6 +824,7 @@ } } + g_free(nickname); g_free(status); jabber_id_free(jid); g_free(avatar_hash);