pidgin: 21cd61e5: jabber: Don't try to pull a photo out of...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Fri Oct 2 23:40:42 EDT 2009
-----------------------------------------------------------------
Revision: 21cd61e54ce2a5a0e0ae521fc1cd51e2570586d2
Ancestor: 33891c55046515f55842c81d3a3edc42602e0ce1
Author: darkrain42 at pidgin.im
Date: 2009-10-03T02:50:48
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/21cd61e54ce2a5a0e0ae521fc1cd51e2570586d2
Modified files:
libpurple/protocols/jabber/buddy.c
libpurple/protocols/jabber/presence.c
ChangeLog:
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
When the data from the server looks literally like:
<PHOTO>
<TYPE>image/jpeg</TYPE>
<BINVAL></BINVAL>
</PHOTO>
xmlnode_get_data(photo_node) will contain (whitespace) data, but in
no way is it a base64-encoded image. I can't find any reference to
clients distributing avatars in that way in the XEP or the RFC.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c 47a10d12173e6ec8e6c098c24d0c2095b83bba01
+++ libpurple/protocols/jabber/buddy.c 1172c8eb8ee1a015269056dfbdbabcdceccaa193
@@ -1149,9 +1149,8 @@ static void jabber_vcard_parse(JabberStr
char *bintext = NULL;
xmlnode *binval;
- if( ((binval = xmlnode_get_child(child, "BINVAL")) &&
- (bintext = xmlnode_get_data(binval))) ||
- (bintext = xmlnode_get_data(child))) {
+ if ((binval = xmlnode_get_child(child, "BINVAL")) &&
+ (bintext = xmlnode_get_data(binval))) {
gsize size;
guchar *data;
gboolean photo = (strcmp(child->name, "PHOTO") == 0);
============================================================
--- libpurple/protocols/jabber/presence.c 3d1271b2947410a7c76e1aecb1990f8381293437
+++ libpurple/protocols/jabber/presence.c 8401c059941dc59d749e409f7f79d57dd42b12ab
@@ -403,19 +403,20 @@ jabber_vcard_parse_avatar(JabberStream *
g_free(nickname);
}
- if((photo = xmlnode_get_child(vcard, "PHOTO")) &&
- (( (binval = xmlnode_get_child(photo, "BINVAL")) &&
- (text = xmlnode_get_data(binval))) ||
- (text = xmlnode_get_data(photo)))) {
+ if ((photo = xmlnode_get_child(vcard, "PHOTO")) &&
+ (binval = xmlnode_get_child(photo, "BINVAL")) &&
+ (text = xmlnode_get_data(binval))) {
guchar *data;
- gchar *hash;
gsize size;
data = purple_base64_decode(text, &size);
- hash = jabber_calculate_data_sha1sum(data, size);
+ if (data) {
+ gchar *hash = jabber_calculate_data_sha1sum(data, size);
+ purple_buddy_icons_set_for_user(js->gc->account, from, data,
+ size, hash);
+ g_free(hash);
+ }
- 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