aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-20 02:28:40 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-20 02:28:40 +0500
commit22ee83cf0c7f03e1d4cba8c564446a782c023708 (patch)
treedb7176e393932b7f20efa37239dd0513b387ba51 /util
parentd36a55a5fab1417186454cd1c8347f2df7180c8d (diff)
downloadprosody-22ee83cf0c7f03e1d4cba8c564446a782c023708.tar.gz
prosody-22ee83cf0c7f03e1d4cba8c564446a782c023708.zip
util.xmppstream: Preserve the stream content namespace on descendents of elements which are in another namespace.
Diffstat (limited to 'util')
-rw-r--r--util/xmppstream.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua
index 2f232fd8..0a6d554b 100644
--- a/util/xmppstream.lua
+++ b/util/xmppstream.lua
@@ -48,6 +48,7 @@ function new_sax_handlers(session, stream_callbacks)
local stream_default_ns = stream_callbacks.default_ns;
local chardata, stanza = {};
+ local non_streamns_depth = 0;
function xml_handlers:StartElement(tagname, attr)
if stanza and #chardata > 0 then
-- We have some character data in the buffer
@@ -59,8 +60,9 @@ function new_sax_handlers(session, stream_callbacks)
curr_ns, name = "", curr_ns;
end
- if curr_ns ~= stream_default_ns then
+ if curr_ns ~= stream_default_ns or non_streamns_depth > 0 then
attr.xmlns = curr_ns;
+ non_streamns_depth = non_streamns_depth + 1;
end
-- FIXME !!!!!
@@ -80,6 +82,7 @@ function new_sax_handlers(session, stream_callbacks)
if not stanza then --if we are not currently inside a stanza
if session.notopen then
if tagname == stream_tag then
+ non_streamns_depth = 0;
if cb_streamopened then
cb_streamopened(session, attr);
end
@@ -104,6 +107,9 @@ function new_sax_handlers(session, stream_callbacks)
end
end
function xml_handlers:EndElement(tagname)
+ if non_streamns_depth > 0 then
+ non_streamns_depth = non_streamns_depth - 1;
+ end
if stanza then
if #chardata > 0 then
-- We have some character data in the buffer