comparison src/protocols/jabber/buddy.c @ 10684:72a5babfa8b4

[gaim-migrate @ 12231] the cipher api that grim has been working on for ages is finally done!! big congrats and thanks to him!! lots of modified files in this commit. it builds here. moved the md5 files to src/protocols/oscar so that it continues to depend on nothing in gaim. everything else uses the new centralized cipher api. I'm not sure if src/md5.* needs to be removed or not, so I left it there. someone let me know or do it directly. someone check if these need to be added to potfiles.in and let there be much rejoicing! committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 11 Mar 2005 13:05:31 +0000
parents 54ac161a876e
children b256ce6b85b8
comparison
equal deleted inserted replaced
10683:e11f3e1599d4 10684:72a5babfa8b4
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * 19 *
20 */ 20 */
21 #include "internal.h" 21 #include "internal.h"
22 #include "cipher.h"
22 #include "debug.h" 23 #include "debug.h"
23 #include "imgstore.h" 24 #include "imgstore.h"
24 #include "prpl.h" 25 #include "prpl.h"
25 #include "notify.h" 26 #include "notify.h"
26 #include "request.h" 27 #include "request.h"
30 #include "buddy.h" 31 #include "buddy.h"
31 #include "chat.h" 32 #include "chat.h"
32 #include "jabber.h" 33 #include "jabber.h"
33 #include "iq.h" 34 #include "iq.h"
34 #include "presence.h" 35 #include "presence.h"
35 #include "sha.h"
36
37 36
38 void jabber_buddy_free(JabberBuddy *jb) 37 void jabber_buddy_free(JabberBuddy *jb)
39 { 38 {
40 g_return_if_fail(jb != NULL); 39 g_return_if_fail(jb != NULL);
41 40
391 unsigned char hashval[20]; 390 unsigned char hashval[20];
392 char *p, hash[41]; 391 char *p, hash[41];
393 392
394 photo = xmlnode_new_child(vc_node, "PHOTO"); 393 photo = xmlnode_new_child(vc_node, "PHOTO");
395 enc = gaim_base64_encode(avatar_data, avatar_len); 394 enc = gaim_base64_encode(avatar_data, avatar_len);
396 shaBlock((unsigned char *)avatar_data, avatar_len, hashval); 395
396 gaim_cipher_digest_region("sha1", (guint8 *)avatar_data,
397 avatar_len, hashval, NULL);
398
397 p = hash; 399 p = hash;
398 for(i=0; i<20; i++, p+=2) 400 for(i=0; i<20; i++, p+=2)
399 snprintf(p, 3, "%02x", hashval[i]); 401 snprintf(p, 3, "%02x", hashval[i]);
400 js->avatar_hash = g_strdup(hash); 402 js->avatar_hash = g_strdup(hash);
401 403
815 GPOINTER_TO_INT(imgids->data)); 817 GPOINTER_TO_INT(imgids->data));
816 818
817 gaim_buddy_icons_set_for_user(js->gc->account, bare_jid, 819 gaim_buddy_icons_set_for_user(js->gc->account, bare_jid,
818 data, size); 820 data, size);
819 821
820 shaBlock((unsigned char *)data, size, hashval); 822 gaim_cipher_digest_region("sha1", (guint8 *)data, size,
823 hashval, NULL);
821 p = hash; 824 p = hash;
822 for(i=0; i<20; i++, p+=2) 825 for(i=0; i<20; i++, p+=2)
823 snprintf(p, 3, "%02x", hashval[i]); 826 snprintf(p, 3, "%02x", hashval[i]);
824 gaim_blist_node_set_string((GaimBlistNode*)b, "avatar_hash", hash); 827 gaim_blist_node_set_string((GaimBlistNode*)b, "avatar_hash", hash);
825 828