changeset 24915:1e121a3eceeb

Allow us to remove vCard avatars when the PurpleAccount doesn't have one specified. Closes #7974 committer: Etan Reisner <pidgin@unreliablesource.net>
author Paul Aurich <paul@darkrain42.org>
date Wed, 07 Jan 2009 04:39:28 +0000
parents c07b0aa88a35
children 45375ae20cd6
files ChangeLog libpurple/protocols/jabber/buddy.c
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 07 04:12:11 2009 +0000
+++ b/ChangeLog	Wed Jan 07 04:39:28 2009 +0000
@@ -15,6 +15,8 @@
 	XMPP:
 	* Support for XEP-0191 blocking.  (Vijay Raghunathan)
 	* Don't put SASL PLAIN or IQ Auth passwords in debug logs. (Paul Aurich)
+	* Fix removal of avatars (both PEP and vCard), we weren't removing
+	  them correctly before. (Paul Aurich)
 
 	Pidgin:
 	* Fix a crash in the Add Account dialog when changing protocols under
--- a/libpurple/protocols/jabber/buddy.c	Wed Jan 07 04:12:11 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Wed Jan 07 04:39:28 2009 +0000
@@ -459,7 +459,10 @@
 
 		avatar_data = purple_imgstore_get_data(img);
 		avatar_len = purple_imgstore_get_size(img);
-		/* have to get rid of the old PHOTO if it exists */
+		/* Get rid of an old PHOTO if one exists.
+		 * TODO: This may want to be modified to remove all old PHOTO
+		 * children, at the moment some people have managed to get
+		 * multiple PHOTO entries in their vCard. */
 		if((photo = xmlnode_get_child(vc_node, "PHOTO"))) {
 			xmlnode_free(photo);
 		}
@@ -473,6 +476,12 @@
 
 		xmlnode_insert_data(binval, enc, -1);
 		g_free(enc);
+	} else if (vc_node) {
+		xmlnode *photo;
+		/* TODO: Remove all PHOTO children? (see above note) */
+		if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) {
+			xmlnode_free(photo);
+		}
 	}
 
 	if (vc_node != NULL) {