# HG changeset patch # User Andreas Monitzer # Date 1182053128 0 # Node ID 0f0e98978d66685ecc6663ca7f8dff99e8c11d3e # Parent 5ab3c6bb95b4f3d439a3988c4406191a415d2aa2 Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one. diff -r 5ab3c6bb95b4 -r 0f0e98978d66 libpurple/protocols/jabber/buddy.c --- a/libpurple/protocols/jabber/buddy.c Sun Jun 17 03:51:19 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sun Jun 17 04:05:28 2007 +0000 @@ -1129,12 +1129,16 @@ g_free(info); } -static void do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *item) { - xmlnode *data; +static void do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) { + xmlnode *item, *data; const char *checksum; char *b64data; void *img; size_t size; + if(!items) + return; + + item = xmlnode_get_child(items, "item"); if(!item) return; diff -r 5ab3c6bb95b4 -r 0f0e98978d66 libpurple/protocols/jabber/pep.c --- a/libpurple/protocols/jabber/pep.c Sun Jun 17 03:51:19 2007 +0000 +++ b/libpurple/protocols/jabber/pep.c Sun Jun 17 04:05:28 2007 +0000 @@ -49,20 +49,13 @@ static void do_pep_iq_request_item_callback(JabberStream *js, xmlnode *packet, gpointer data) { const char *from = xmlnode_get_attrib(packet,"from"); xmlnode *pubsub = xmlnode_get_child_with_namespace(packet,"pubsub","http://jabber.org/protocol/pubsub#event"); - xmlnode *item = NULL; + xmlnode *items = NULL; JabberPEPHandler *cb = data; - if(pubsub) { - item = xmlnode_get_child(pubsub, "item"); - if(!item) { - /* does not follow the spec, but the ejabberd PEP implementation behaves that way */ - xmlnode *items = xmlnode_get_child(pubsub, "items"); - if(items) - item = xmlnode_get_child(items, "item"); - } - } + if(pubsub) + items = xmlnode_get_child(pubsub, "items"); - cb(js, from, item); + cb(js, from, items); } void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb) { diff -r 5ab3c6bb95b4 -r 0f0e98978d66 libpurple/protocols/jabber/pep.h --- a/libpurple/protocols/jabber/pep.h Sun Jun 17 03:51:19 2007 +0000 +++ b/libpurple/protocols/jabber/pep.h Sun Jun 17 04:05:28 2007 +0000 @@ -57,8 +57,7 @@ * @parameter id The item id of the requested item (may be NULL) * @parameter cb The callback to be used when this item is received * - * ATTN: The items parameter of the callback will only point to the single element here! - * Additionally, the items element passed will be NULL if any error occured (like a permission error, node doesn't exist etc.) + * The items element passed to the callback will be NULL if any error occured (like a permission error, node doesn't exist etc.) */ void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb);