Mercurial > pidgin
diff libpurple/xmlnode.c @ 23509:c4ec724b3b53
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.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 28 Jun 2008 06:55:30 +0000 |
parents | feb92c44db87 |
children | e23b447aa5ca 4152b5c1c051 2ecd716746e6 |
line wrap: on
line diff
--- a/libpurple/xmlnode.c Sat Jun 28 06:02:50 2008 +0000 +++ b/libpurple/xmlnode.c Sat Jun 28 06:55:30 2008 +0000 @@ -728,6 +728,13 @@ 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 @@ 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 {