pidgin: ba866099: Don't ignore XML namespace and prefix in...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sun Dec 21 00:05:44 EST 2008


-----------------------------------------------------------------
Revision: ba866099ffed6dd0dae0e6fa6e3d6a2531bab833
Ancestor: b02e49ab446349d1bda77b32abd5de731fa8bcee
Author: neuro at o2.pl
Date: 2008-12-21T04:58:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ba866099ffed6dd0dae0e6fa6e3d6a2531bab833

Modified files:
        COPYRIGHT ChangeLog libpurple/protocols/jabber/parser.c

ChangeLog: 

Don't ignore XML namespace and prefix information when parsing incoming XMPP
data.  Fixes #7681.

-------------- next part --------------
============================================================
--- COPYRIGHT	47d8fa622a0f9d5241fefc50249a8e27070ef913
+++ COPYRIGHT	b6894a8ad604a63a15f7d9e2321256dbf009aaf3
@@ -474,6 +474,7 @@ Dan Winship
 Alex Willmer
 Matt Wilson
 Dan Winship
+Michal Witkowski
 Scott Wolchok
 The Written Word, Inc.
 Kevin Wu Won
============================================================
--- ChangeLog	1a53d2b91aa5040cd71bacc9560a16a3a58a31c3
+++ ChangeLog	2d03a6ab93bd2740f6ad518b8e23f29e03480c73
@@ -4,6 +4,8 @@ version 2.5.4 (??/??/????):
 	libpurple:
 	* Fix a connection timeout with empty Gadu-Gady buddy lists. (Martin
 	  Rosinski)
+	* Don't ignore namespace information when parsing XMPP data. (Michal
+	  Witkowski)
 
 version 2.5.3 (12/20/2008):
 	libpurple:
============================================================
--- libpurple/protocols/jabber/parser.c	922b0b9447575fc37cbde99f86d110a6f0c94b88
+++ libpurple/protocols/jabber/parser.c	543d6e2fa1f94a7d9884851e9fb7b8951988f9f7
@@ -37,7 +37,7 @@ jabber_parser_element_start_libxml(void 
 {
 	JabberStream *js = user_data;
 	xmlnode *node;
-	int i;
+	int i, j;
 
 	if(!element_name) {
 		return;
@@ -57,7 +57,7 @@ jabber_parser_element_start_libxml(void 
 				g_free(js->stream_id);
 				js->stream_id = attrib;
 			} else {
-				g_free(attrib);	
+				g_free(attrib);
 			}
 		}
 		if(js->protocol_version == JABBER_PROTO_0_9)
@@ -72,8 +72,21 @@ jabber_parser_element_start_libxml(void 
 		else
 			node = xmlnode_new((const char*) element_name);
 		xmlnode_set_namespace(node, (const char*) namespace);
+		xmlnode_set_prefix(node, (const char *)prefix);
 
+		if (nb_namespaces != 0) {
+			node->namespace_map = g_hash_table_new_full(
+				g_str_hash, g_str_equal, g_free, g_free);
+
+			for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) {
+				const char *key = (const char *)namespaces[j];
+				const char *val = (const char *)namespaces[j + 1];
+				g_hash_table_insert(node->namespace_map,
+					g_strdup(key ? key : ""), g_strdup(val ? val : ""));
+			}
+		}
 		for(i=0; i < nb_attributes * 5; i+=5) {
+			const char *prefix = (const char *)attributes[i + 1];
 			char *txt;
 			int attrib_len = attributes[i+4] - attributes[i+3];
 			char *attrib = g_malloc(attrib_len + 1);
@@ -90,6 +103,9 @@ jabber_parser_element_start_libxml(void 
 			attrib = purple_unescape_html(txt);
 			g_free(txt);
 			xmlnode_set_attrib_with_namespace(node, (const char*) attributes[i], attrib_ns, attrib);
+			if (prefix && *prefix) {
+				node->prefix = g_strdup(prefix);
+			}
 			g_free(attrib);
 			g_free(attrib_ns);
 		}


More information about the Commits mailing list