diff libpurple/protocols/jabber/jabber.c @ 25353:9195955395b6

Only (re)publish XMPP avatars at login if the server's avatar differs As part of this, no longer rely on the vcard for determining a need to publish the XEP-0084 avatar; explicitly fetch and compare it. Closes #7734. References #7732. That patch needs updating to apply on top of this.
author Paul Aurich <paul@darkrain42.org>
date Wed, 21 Jan 2009 20:16:22 +0000
parents 3a4070656d61
children ab07969d298f
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Wed Jan 21 17:56:07 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Wed Jan 21 20:16:22 2009 +0000
@@ -28,6 +28,7 @@
 #include "conversation.h"
 #include "debug.h"
 #include "dnssrv.h"
+#include "imgstore.h"
 #include "message.h"
 #include "notify.h"
 #include "pluginpref.h"
@@ -701,6 +702,7 @@
 	const char *connect_server = purple_account_get_string(account,
 			"connect_server", "");
 	JabberStream *js;
+	PurpleStoredImage *image;
 	JabberBuddy *my_jb = NULL;
 
 	gc->flags |= PURPLE_CONNECTION_HTML |
@@ -736,7 +738,19 @@
 			_("Invalid XMPP ID. Domain must be set."));
 		return;
 	}
-	
+
+	/* This account setting is used to determine if we should re-sync our avatar to the
+	 * server at login. */
+	if ((image = purple_buddy_icons_find_account_icon(account))) {
+		char *checksum = jabber_calculate_data_sha1sum(purple_imgstore_get_data(image),
+					purple_imgstore_get_size(image));
+		purple_account_set_string(account, "prpl-jabber_icon_checksum", checksum);
+		g_free(checksum);
+		purple_imgstore_unref(image);
+	} else {
+		purple_account_set_string(account, "prpl-jabber_icon_checksum", "");
+	}
+
 	if((my_jb = jabber_buddy_find(js, purple_account_get_username(account), TRUE)))
 		my_jb->subscription |= JABBER_SUB_BOTH;