summaryrefslogtreecommitdiff
path: root/libpurple
diff options
context:
space:
mode:
authorNathan Walp <nwalp@pidgin.im>2007-06-23 21:22:56 +0000
committerNathan Walp <nwalp@pidgin.im>2007-06-23 21:22:56 +0000
commit13c7922707bb0ea2c2c442563a24cda53fe7192b (patch)
treee1cd20831eb66870047cb851ca670bcd90ff5903 /libpurple
parente1df02246459dfc858b0cb28192c476beabcaa5c (diff)
downloadpidgin-13c7922707bb0ea2c2c442563a24cda53fe7192b.tar.gz
fix a buddy icon bug in jabber
Diffstat (limited to 'libpurple')
-rw-r--r--libpurple/protocols/jabber/buddy.c4
-rw-r--r--libpurple/xmlnode.c17
2 files changed, 21 insertions, 0 deletions
diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c
index 1c4edf962a..5cdadb3bd8 100644
--- a/libpurple/protocols/jabber/buddy.c
+++ b/libpurple/protocols/jabber/buddy.c
@@ -419,6 +419,10 @@ void jabber_set_info(PurpleConnection *gc, const char *info)
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);
diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c
index 942d480234..8553fcdfdd 100644
--- a/libpurple/xmlnode.c
+++ b/libpurple/xmlnode.c
@@ -268,6 +268,22 @@ xmlnode_free(xmlnode *node)
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 @@ xmlnode_free(xmlnode *node)
x = y;
}
+ /* now dispose of ourselves */
g_free(node->name);
g_free(node->data);
g_free(node->xmlns);