pidgin: 8a5364b7: jabber: Allow jabber_pep_request_item() ...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Feb 28 14:21:29 EST 2010


-----------------------------------------------------------------
Revision: 8a5364b724bf6bd6334ad7033a4bf4bb8ed9a0ad
Ancestor: 43ae15bb3b5dce0516c4f3da6efc5f7b7a88868d
Author: darkrain42 at pidgin.im
Date: 2010-02-27T04:02:50
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8a5364b724bf6bd6334ad7033a4bf4bb8ed9a0ad

Modified files:
        libpurple/protocols/jabber/pep.c
        libpurple/protocols/jabber/useravatar.c
        libpurple/protocols/jabber/usernick.c

ChangeLog: 

jabber: Allow jabber_pep_request_item() to take NULL for JID; server's routing takes care of the rest

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/pep.c	b7754b08b481d90a869da147d1700c537338ff12
+++ libpurple/protocols/jabber/pep.c	14dcf42e0a325556b421cb7d3f330552c097cc8b
@@ -89,10 +89,11 @@ void jabber_pep_request_item(JabberStrea
 	JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
 	xmlnode *pubsub, *items;
 
-	xmlnode_set_attrib(iq->node,"to",to);
-	pubsub = xmlnode_new_child(iq->node,"pubsub");
+	if (to)
+		xmlnode_set_attrib(iq->node, "to", to);
 
-	xmlnode_set_namespace(pubsub,"http://jabber.org/protocol/pubsub");
+	pubsub = xmlnode_new_child(iq->node,"pubsub");
+	xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub");
 
 	items = xmlnode_new_child(pubsub, "items");
 	xmlnode_set_attrib(items,"node",node);
============================================================
--- libpurple/protocols/jabber/useravatar.c	b7e1ef755ba6ce4fa301fcae5b78b62f7e7f7c23
+++ libpurple/protocols/jabber/useravatar.c	adefd6e62435e0015d54779e4df91b981f06f772
@@ -239,16 +239,12 @@ void jabber_avatar_fetch_mine(JabberStre
 
 void jabber_avatar_fetch_mine(JabberStream *js)
 {
-	char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
-
 	if (js->initial_avatar_hash) {
-		jabber_pep_request_item(js, jid, NS_AVATAR_0_12_METADATA, NULL,
+		jabber_pep_request_item(js, NULL, NS_AVATAR_0_12_METADATA, NULL,
 		                        do_got_own_avatar_0_12_cb);
-		jabber_pep_request_item(js, jid, NS_AVATAR_1_1_METADATA, NULL,
+		jabber_pep_request_item(js, NULL, NS_AVATAR_1_1_METADATA, NULL,
 		                        do_got_own_avatar_cb);
 	}
-
-	g_free(jid);
 }
 
 typedef struct _JabberBuddyAvatarUpdateURLInfo {
============================================================
--- libpurple/protocols/jabber/usernick.c	3db25b27b89a0a0c26c566944df5cc69b6eda063
+++ libpurple/protocols/jabber/usernick.c	6dc53629f9aab124e9d9198f804eb926c15309be
@@ -86,14 +86,12 @@ static void do_nick_set_nick(PurplePlugi
 }
 
 static void do_nick_set_nick(PurplePluginAction *action) {
-	PurpleConnection *gc = (PurpleConnection *) action->context;
-	JabberStream *js = gc->proto_data;
-	char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
+	PurpleConnection *gc = action->context;
+	JabberStream *js = purple_connection_get_protocol_data(gc);
 
 	/* since the nickname might have been changed by another resource of this account, we always have to request the old one
 		from the server to present as the default for the new one */
-	jabber_pep_request_item(js, jid, "http://jabber.org/protocol/nick", NULL, do_nick_got_own_nick_cb);
-	g_free(jid);
+	jabber_pep_request_item(js, NULL, "http://jabber.org/protocol/nick", NULL, do_nick_got_own_nick_cb);
 }
 
 void jabber_nick_init(void) {


More information about the Commits mailing list