diff options
author | Elliott Sales de Andrade <qulogic@pidgin.im> | 2008-06-28 06:55:30 +0000 |
---|---|---|
committer | Elliott Sales de Andrade <qulogic@pidgin.im> | 2008-06-28 06:55:30 +0000 |
commit | 21be492e8061b39894eb23a1daef687340fd4e69 (patch) | |
tree | 1c3b219312a51611d7696b4790a3f2262e665c70 /libpurple/xmlnode.c | |
parent | a5b93df433503dc2cbed8e345b0a8c550dc09072 (diff) | |
download | pidgin-21be492e8061b39894eb23a1daef687340fd4e69.tar.gz |
Make sure xmlnode_copy also copies the prefix and namespace_map from
the source xmlnode.
This should fix operations on MSN member role lists. That means
blocking and unblocking should work now. And removing new buddies from
the pending list too, so you shouldn't get asked to add them every time
you log in.
Diffstat (limited to 'libpurple/xmlnode.c')
-rw-r--r-- | libpurple/xmlnode.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libpurple/xmlnode.c b/libpurple/xmlnode.c index 071967a48c..f5f2f9e48c 100644 --- a/libpurple/xmlnode.c +++ b/libpurple/xmlnode.c @@ -728,6 +728,13 @@ xmlnode_from_str(const char *str, gssize size) return ret; } +static void +xmlnode_copy_foreach_ns(gpointer key, gpointer value, gpointer user_data) +{ + GHashTable *ret = (GHashTable *)user_data; + g_hash_table_insert(ret, g_strdup(key), g_strdup(value)); +} + xmlnode * xmlnode_copy(const xmlnode *src) { @@ -739,17 +746,23 @@ xmlnode_copy(const xmlnode *src) ret = new_node(src->name, src->type); ret->xmlns = g_strdup(src->xmlns); - if(src->data) { - if(src->data_sz) { + if (src->data) { + if (src->data_sz) { ret->data = g_memdup(src->data, src->data_sz); ret->data_sz = src->data_sz; } else { ret->data = g_strdup(src->data); } } + ret->prefix = g_strdup(src->prefix); + if (src->namespace_map) { + ret->namespace_map = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, g_free); + g_hash_table_foreach(src->namespace_map, xmlnode_copy_foreach_ns, ret->namespace_map); + } - for(child = src->child; child; child = child->next) { - if(sibling) { + for (child = src->child; child; child = child->next) { + if (sibling) { sibling->next = xmlnode_copy(child); sibling = sibling->next; } else { |