changeset 29498:93e8e6331d44

jabber: Allow jabber_pep_request_item() to take NULL for JID; server's routing takes care of the rest
author Paul Aurich <paul@darkrain42.org>
date Sat, 27 Feb 2010 04:02:50 +0000
parents 0d3151a41134
children 8b469e799ed9
files libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/useravatar.c libpurple/protocols/jabber/usernick.c
diffstat 3 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/pep.c	Sat Feb 27 03:49:32 2010 +0000
+++ b/libpurple/protocols/jabber/pep.c	Sat Feb 27 04:02:50 2010 +0000
@@ -89,10 +89,11 @@
 	JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
 	xmlnode *pubsub, *items;
 
-	xmlnode_set_attrib(iq->node,"to",to);
+	if (to)
+		xmlnode_set_attrib(iq->node, "to", to);
+
 	pubsub = xmlnode_new_child(iq->node,"pubsub");
-
-	xmlnode_set_namespace(pubsub,"http://jabber.org/protocol/pubsub");
+	xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub");
 
 	items = xmlnode_new_child(pubsub, "items");
 	xmlnode_set_attrib(items,"node",node);
--- a/libpurple/protocols/jabber/useravatar.c	Sat Feb 27 03:49:32 2010 +0000
+++ b/libpurple/protocols/jabber/useravatar.c	Sat Feb 27 04:02:50 2010 +0000
@@ -239,16 +239,12 @@
 
 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 {
--- a/libpurple/protocols/jabber/usernick.c	Sat Feb 27 03:49:32 2010 +0000
+++ b/libpurple/protocols/jabber/usernick.c	Sat Feb 27 04:02:50 2010 +0000
@@ -86,14 +86,12 @@
 }
 
 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) {