changeset 28917:b0a04b783e5c

jabber: Properly request just the most recent item from a PEP node.
author Paul Aurich <paul@darkrain42.org>
date Fri, 13 Nov 2009 19:00:03 +0000
parents ea818ffa22b6
children 703c72411bb0 83c02c568f03
files libpurple/protocols/jabber/pep.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/pep.c	Fri Nov 13 18:48:29 2009 +0000
+++ b/libpurple/protocols/jabber/pep.c	Fri Nov 13 19:00:03 2009 +0000
@@ -87,7 +87,7 @@
 
 void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb) {
 	JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET);
-	xmlnode *pubsub, *items, *item;
+	xmlnode *pubsub, *items;
 
 	xmlnode_set_attrib(iq->node,"to",to);
 	pubsub = xmlnode_new_child(iq->node,"pubsub");
@@ -97,9 +97,12 @@
 	items = xmlnode_new_child(pubsub, "items");
 	xmlnode_set_attrib(items,"node",node);
 
-	item = xmlnode_new_child(items, "item");
-	if(id)
+	if (id) {
+		xmlnode *item = xmlnode_new_child(items, "item");
 		xmlnode_set_attrib(item, "id", id);
+	} else
+		/* Most recent item */
+		xmlnode_set_attrib(items, "max_items", "1");
 
 	jabber_iq_set_callback(iq,do_pep_iq_request_item_callback,(gpointer)cb);