# HG changeset patch # User Michal Witkowski # Date 1229835516 0 # Node ID f5c0cdaef99a9e5859cc509683d0faf5fda6b0a4 # Parent c9c4b31d98a72599ff0f911db8bdfe0b3752dbec Don't ignore XML namespace and prefix information when parsing incoming XMPP data. Fixes #7681. committer: John Bailey diff -r c9c4b31d98a7 -r f5c0cdaef99a COPYRIGHT --- a/COPYRIGHT Sun Dec 21 04:45:20 2008 +0000 +++ b/COPYRIGHT Sun Dec 21 04:58:36 2008 +0000 @@ -474,6 +474,7 @@ Alex Willmer Matt Wilson Dan Winship +Michal Witkowski Scott Wolchok The Written Word, Inc. Kevin Wu Won diff -r c9c4b31d98a7 -r f5c0cdaef99a ChangeLog --- a/ChangeLog Sun Dec 21 04:45:20 2008 +0000 +++ b/ChangeLog Sun Dec 21 04:58:36 2008 +0000 @@ -4,6 +4,8 @@ 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: diff -r c9c4b31d98a7 -r f5c0cdaef99a libpurple/protocols/jabber/parser.c --- a/libpurple/protocols/jabber/parser.c Sun Dec 21 04:45:20 2008 +0000 +++ b/libpurple/protocols/jabber/parser.c Sun Dec 21 04:58:36 2008 +0000 @@ -37,7 +37,7 @@ { JabberStream *js = user_data; xmlnode *node; - int i; + int i, j; if(!element_name) { return; @@ -57,7 +57,7 @@ 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 @@ 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 @@ 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); }