Mercurial > pidgin
diff libpurple/protocols/jabber/presence.c @ 25237:401f548e3544
propagate from branch 'im.pidgin.pidgin' (head df6eba32e5b6b34d7483cbfb7e9f2e4c836ac35f)
to branch 'org.darkrain42.pidgin.buddy-add' (head 6831808999a270f8c1a128c7430a73d3dc0bfae2)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 21 Dec 2008 18:32:37 +0000 |
parents | bba38f03085d |
children | 68f4edb42f39 9100b9176a16 0fa91206cf5a 54dcfe059dd4 1d1d1829de11 5f9a24d1c25e |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c Sat Nov 29 18:46:49 2008 +0000 +++ b/libpurple/protocols/jabber/presence.c Sun Dec 21 18:32:37 2008 +0000 @@ -21,7 +21,6 @@ #include "internal.h" #include "account.h" -#include "cipher.h" #include "conversation.h" #include "debug.h" #include "notify.h" @@ -349,19 +348,12 @@ (( (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; + char *hash; 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); } } @@ -510,17 +502,19 @@ priority = atoi(p); g_free(p); } + } else if(xmlns == NULL) { + /* The rest of the cases used to check xmlns individually. */ + continue; } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) { /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ delayed = TRUE; - } else if(xmlns && !strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { + } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { caps = y; /* store for later, when creating buddy resource */ } else if(!strcmp(y->name, "x")) { - const char *xmlns = xmlnode_get_namespace(y); - if(xmlns && !strcmp(xmlns, "jabber:x:delay")) { + if(!strcmp(xmlns, "jabber:x:delay")) { /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ delayed = TRUE; - } else if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { + } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { xmlnode *z; muc = TRUE; @@ -563,7 +557,7 @@ flags |= PURPLE_CBFLAGS_VOICE; } } - } else if(xmlns && !strcmp(xmlns, "vcard-temp:x:update")) { + } else if(!strcmp(xmlns, "vcard-temp:x:update")) { xmlnode *photo = xmlnode_get_child(y, "photo"); if(photo) { g_free(avatar_hash);