cpw.darkrain42.xmpp.avatars: 82e042db: Use jabber_calculate_data_sha1sum in one...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Tue Apr 28 17:21:55 EDT 2009
-----------------------------------------------------------------
Revision: 82e042db158c5d86baf3ec809590237708aef921
Ancestor: 60b976290f59732ab9b688112a710213651eef1a
Author: darkrain42 at pidgin.im
Date: 2009-04-26T23:57:55
Branch: im.pidgin.cpw.darkrain42.xmpp.avatars
URL: http://d.pidgin.im/viewmtn/revision/info/82e042db158c5d86baf3ec809590237708aef921
Modified files:
libpurple/protocols/jabber/presence.c
ChangeLog:
Use jabber_calculate_data_sha1sum in one more place.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c 8e9062456e13590b79f16d808548706784214aaf
+++ libpurple/protocols/jabber/presence.c 7aca0d33742362cb8229145933f12688f4eb6971
@@ -359,8 +359,6 @@ jabber_vcard_parse_avatar(JabberStream *
JabberBuddy *jb = NULL;
xmlnode *vcard, *photo, *binval;
char *text;
- guchar *data;
- gsize size;
if(!from)
return;
@@ -375,19 +373,15 @@ jabber_vcard_parse_avatar(JabberStream *
(( (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);
+ hash = jabber_calculate_data_sha1sum(data, 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]);
-
purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash);
+ g_free(hash);
g_free(text);
}
}
More information about the Commits
mailing list