diff libpurple/protocols/jabber/useravatar.c @ 28114:93d9cf1151a4

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.
author Paul Aurich <paul@darkrain42.org>
date Sat, 01 Aug 2009 02:44:13 +0000
parents 77cfaae36918
children 8c991e09efcb
line wrap: on
line diff
--- a/libpurple/protocols/jabber/useravatar.c	Sat Aug 01 02:33:41 2009 +0000
+++ b/libpurple/protocols/jabber/useravatar.c	Sat Aug 01 02:44:13 2009 +0000
@@ -219,16 +219,18 @@
 	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);