cpw.qulogic.msn: 309576e5: Make sure xmlnode_copy also copies the p...

qulogic at pidgin.im qulogic at pidgin.im
Sat Jun 28 04:20:47 EDT 2008


-----------------------------------------------------------------
Revision: 309576e58431d3f0d8300b0a85dc6ce16b488ab5
Ancestor: e47ea7abb91ec327f259e9fb62853f67e368d527
Author: qulogic at pidgin.im
Date: 2008-06-28T06:55:30
Branch: im.pidgin.cpw.qulogic.msn
URL: http://d.pidgin.im/viewmtn/revision/info/309576e58431d3f0d8300b0a85dc6ce16b488ab5

Modified files:
        libpurple/xmlnode.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/xmlnode.c	efcedf1793b22ae335060f1adc2407dc964f30e0
+++ libpurple/xmlnode.c	eb62571e6bee6f7a583243e50025a21ce4ae12bb
@@ -728,6 +728,13 @@ xmlnode_from_str(const char *str, gssize
 	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 {


More information about the Commits mailing list