pidgin: 129bc3f6: jabber: Fix setting the PEP node the fir...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Jul 31 23:00:48 EDT 2009


-----------------------------------------------------------------
Revision: 129bc3f67aaf82493eb3a9e692f26d5a7a132b67
Ancestor: 328c6d270bd5a30de90ef6c97c9ed5f274c66d03
Author: darkrain42 at pidgin.im
Date: 2009-08-01T02:44:13
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/129bc3f67aaf82493eb3a9e692f26d5a7a132b67

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

ChangeLog: 

jabber: Fix setting the PEP node the first time.

The first time a PEP node is set, it's going to be auto-created, which
means the IQ fetch is going to return an error, so don't ignore the
error condition.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/useravatar.c	c2acd8381f61a5e4c0c4ba7ef030b5e31b5ee298
+++ libpurple/protocols/jabber/useravatar.c	df3771e16b6def5bca6a88a393e64f8e5355fca3
@@ -219,16 +219,18 @@ do_got_own_avatar_cb(JabberStream *js, c
 	const char *server_hash = NULL;
 
 	if (items && (item = xmlnode_get_child(items, "item")) &&
-	     (metadata = xmlnode_get_child(item, "metadata")) &&
-	     (info = xmlnode_get_child(metadata, "info"))) {
+			(metadata = xmlnode_get_child(item, "metadata")) &&
+			(info = xmlnode_get_child(metadata, "info"))) {
 		server_hash = xmlnode_get_attrib(info, "id");
 	}
 
-	if (items && !metadata)
-		return;
-
-	/* Publish ours if it's different than the server's */
-	if (!purple_strequal(server_hash, js->initial_avatar_hash)) {
+	/*
+	 * If we have an avatar and the server returned an error/malformed data,
+	 * push our avatar. If the server avatar doesn't match the local one, push
+	 * our avatar.
+	 */
+	if (((!items || !metadata) && js->initial_avatar_hash) ||
+			!purple_strequal(server_hash, js->initial_avatar_hash)) {
 		PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
 		jabber_avatar_set(js, img);
 		purple_imgstore_unref(img);


More information about the Commits mailing list