comparison libpurple/protocols/jabber/useravatar.c @ 27777: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
comparison
equal deleted inserted replaced
27776:cbbde19ce02d 27777:93d9cf1151a4
217 xmlnode *item = NULL, *metadata = NULL, *info = NULL; 217 xmlnode *item = NULL, *metadata = NULL, *info = NULL;
218 PurpleAccount *account = purple_connection_get_account(js->gc); 218 PurpleAccount *account = purple_connection_get_account(js->gc);
219 const char *server_hash = NULL; 219 const char *server_hash = NULL;
220 220
221 if (items && (item = xmlnode_get_child(items, "item")) && 221 if (items && (item = xmlnode_get_child(items, "item")) &&
222 (metadata = xmlnode_get_child(item, "metadata")) && 222 (metadata = xmlnode_get_child(item, "metadata")) &&
223 (info = xmlnode_get_child(metadata, "info"))) { 223 (info = xmlnode_get_child(metadata, "info"))) {
224 server_hash = xmlnode_get_attrib(info, "id"); 224 server_hash = xmlnode_get_attrib(info, "id");
225 } 225 }
226 226
227 if (items && !metadata) 227 /*
228 return; 228 * If we have an avatar and the server returned an error/malformed data,
229 229 * push our avatar. If the server avatar doesn't match the local one, push
230 /* Publish ours if it's different than the server's */ 230 * our avatar.
231 if (!purple_strequal(server_hash, js->initial_avatar_hash)) { 231 */
232 if (((!items || !metadata) && js->initial_avatar_hash) ||
233 !purple_strequal(server_hash, js->initial_avatar_hash)) {
232 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); 234 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
233 jabber_avatar_set(js, img); 235 jabber_avatar_set(js, img);
234 purple_imgstore_unref(img); 236 purple_imgstore_unref(img);
235 } 237 }
236 } 238 }