changeset 26789:8953034dae88

Use jabber_calculate_data_sha1sum in one more place.
author Paul Aurich <paul@darkrain42.org>
date Sun, 26 Apr 2009 23:57:55 +0000
parents fbb2b8e2d91e
children ca421152b5d4
files libpurple/protocols/jabber/presence.c
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Sun Apr 26 23:24:45 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sun Apr 26 23:57:55 2009 +0000
@@ -359,8 +359,6 @@
 	JabberBuddy *jb = NULL;
 	xmlnode *vcard, *photo, *binval;
 	char *text;
-	guchar *data;
-	gsize size;
 
 	if(!from)
 		return;
@@ -375,19 +373,15 @@
 				(( (binval = xmlnode_get_child(photo, "BINVAL")) &&
 				(text = xmlnode_get_data(binval))) ||
 				(text = xmlnode_get_data(photo)))) {
-			unsigned char hashval[20];
-			char hash[41], *p;
-			int i;
+			guchar *data;
+			gchar *hash;
+			gsize size;
 
 			data = purple_base64_decode(text, &size);
-
-			purple_cipher_digest_region("sha1", data, size,
-					sizeof(hashval), hashval, NULL);
-			p = hash;
-			for(i=0; i<20; i++, p+=2)
-				snprintf(p, 3, "%02x", hashval[i]);
+			hash = jabber_calculate_data_sha1sum(data, size);
 
 			purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash);
+			g_free(hash);
 			g_free(text);
 		}
 	}