diff libpurple/protocols/jabber/jabber.c @ 25832:2d92bbe6807b

Use a JabberStream variable instead of a setting for the initial hash The hash is only used at login to compare with the PEP avatar(s) and vCard and is recalculated at each login, so there's no need to store it as a setting. The variable is eitehr NULL or the hash now, instead of "" or the hash.
author Paul Aurich <paul@darkrain42.org>
date Sat, 14 Feb 2009 18:23:13 +0000
parents ab07969d298f
children 7e020fbe2cdb
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sat Feb 14 03:57:22 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat Feb 14 18:23:13 2009 +0000
@@ -739,16 +739,15 @@
 		return;
 	}
 
-	/* This account setting is used to determine if we should re-sync our avatar to the
-	 * server at login. */
+	/*
+	 * Calculate the avatar hash for our current image so we know (when we
+	 * fetch our vCard and PEP avatar) if we should send our avatar to the
+	 * server.
+	 */
 	if ((image = purple_buddy_icons_find_account_icon(account))) {
-		char *checksum = jabber_calculate_data_sha1sum(purple_imgstore_get_data(image),
+		js->initial_avatar_hash = 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)))
@@ -1382,6 +1381,7 @@
 	g_free(js->stream_id);
 	if(js->user)
 		jabber_id_free(js->user);
+	g_free(js->initial_avatar_hash);
 	g_free(js->avatar_hash);
 
 	purple_circ_buffer_destroy(js->write_buffer);