diff libpurple/protocols/jabber/buddy.c @ 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 ca4ccf646993 e33aee62e537
line wrap: on
line diff
--- 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) {