libpurple/protocols/jabber/useravatar.c

changeset 28048
cdc92f9d634a
parent 27358
a1e3486558a0
child 28321
c8d617c408ab
equal deleted inserted replaced
28047:0f280c9653d2 28048:cdc92f9d634a
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 }

mercurial