Mercurial > pidgin.yaz
changeset 18257:6050348614ab
fix a buddy icon bug in jabber
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 23 Jun 2007 21:22:56 +0000 |
parents | bc4518599c10 |
children | 70747b33f1bd |
files | libpurple/protocols/jabber/buddy.c libpurple/xmlnode.c |
diffstat | 2 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Sat Jun 23 06:32:09 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sat Jun 23 21:22:56 2007 +0000 @@ -419,6 +419,10 @@ avatar_data = purple_imgstore_get_data(img); avatar_len = purple_imgstore_get_size(img); + /* have to get rid of the old PHOTO if it exists */ + if((photo = xmlnode_get_child(vc_node, "PHOTO"))) { + xmlnode_free(photo); + } photo = xmlnode_new_child(vc_node, "PHOTO"); binval = xmlnode_new_child(photo, "BINVAL"); enc = purple_base64_encode(avatar_data, avatar_len);
--- a/libpurple/xmlnode.c Sat Jun 23 06:32:09 2007 +0000 +++ b/libpurple/xmlnode.c Sat Jun 23 21:22:56 2007 +0000 @@ -268,6 +268,22 @@ g_return_if_fail(node != NULL); + /* if we're part of a tree, remove ourselves from the tree first */ + if(NULL != node->parent) { + if(node->parent->child == node) { + node->parent->child = node->next; + } else { + xmlnode *prev = node->parent->child; + while(prev && prev->next != node) { + prev = prev->next; + } + if(prev) { + prev->next = node->next; + } + } + } + + /* now free our children */ x = node->child; while(x) { y = x->next; @@ -275,6 +291,7 @@ x = y; } + /* now dispose of ourselves */ g_free(node->name); g_free(node->data); g_free(node->xmlns);