Mercurial > pidgin
changeset 24853:f5c0cdaef99a
Don't ignore XML namespace and prefix information when parsing incoming XMPP
data. Fixes #7681.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | Michal Witkowski <neuro@o2.pl> |
---|---|
date | Sun, 21 Dec 2008 04:58:36 +0000 |
parents | c9c4b31d98a7 |
children | 95c9c306d582 |
files | COPYRIGHT ChangeLog libpurple/protocols/jabber/parser.c |
diffstat | 3 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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:
--- 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); }