changeset 28536:e14402d6c5e0

jabber: Go back to not overwriting avatars if there is not one locally set. This isn't quite right yet, because we need to pick up the hash and advertise it in our presence. Fixes #10287.
author Paul Aurich <paul@darkrain42.org>
date Fri, 13 Nov 2009 18:39:23 +0000
parents 43d5face5d9b
children edb503872793
files libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/useravatar.c
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Fri Nov 13 18:34:04 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Fri Nov 13 18:39:23 2009 +0000
@@ -924,7 +924,7 @@
 	}
 
 	/* Republish our vcard if the photo is different than the server's */
-	if (!purple_strequal(vcard_hash, js->initial_avatar_hash)) {
+	if (js->initial_avatar_hash && !purple_strequal(vcard_hash, js->initial_avatar_hash)) {
 		/*
 		 * Google Talk has developed the behavior that it will not accept
 		 * a vcard set in the first 10 seconds (or so) of the connection;
--- a/libpurple/protocols/jabber/useravatar.c	Fri Nov 13 18:34:04 2009 +0000
+++ b/libpurple/protocols/jabber/useravatar.c	Fri Nov 13 18:39:23 2009 +0000
@@ -229,7 +229,7 @@
 	 * push our avatar. If the server avatar doesn't match the local one, push
 	 * our avatar.
 	 */
-	if (((!items || !metadata) && js->initial_avatar_hash) ||
+	if ((!items || !metadata) ||
 			!purple_strequal(server_hash, js->initial_avatar_hash)) {
 		PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
 		jabber_avatar_set(js, img);
@@ -240,10 +240,14 @@
 void jabber_avatar_fetch_mine(JabberStream *js)
 {
 	char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
-	jabber_pep_request_item(js, jid, NS_AVATAR_0_12_METADATA, NULL,
-	                        do_got_own_avatar_0_12_cb);
-	jabber_pep_request_item(js, jid, NS_AVATAR_1_1_METADATA, NULL,
-	                        do_got_own_avatar_cb);
+
+	if (js->initial_avatar_hash) {
+		jabber_pep_request_item(js, jid, NS_AVATAR_0_12_METADATA, NULL,
+		                        do_got_own_avatar_0_12_cb);
+		jabber_pep_request_item(js, jid, NS_AVATAR_1_1_METADATA, NULL,
+		                        do_got_own_avatar_cb);
+	}
+
 	g_free(jid);
 }