aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/xmlhandlers.lua36
1 files changed, 18 insertions, 18 deletions
diff --git a/core/xmlhandlers.lua b/core/xmlhandlers.lua
index 85ce1040..3d6ace12 100644
--- a/core/xmlhandlers.lua
+++ b/core/xmlhandlers.lua
@@ -116,7 +116,24 @@ function init_xmlhandlers(session, stream_callbacks)
if name == "" then
curr_ns, name = "", curr_ns;
end
- if not stanza then
+ if stanza then
+ if #chardata > 0 then
+ -- We have some character data in the buffer
+ stanza:text(t_concat(chardata));
+ chardata = {};
+ end
+ -- Complete stanza
+ if #stanza.last_add == 0 then
+ if tagname ~= stream_error_tag then
+ cb_handlestanza(session, stanza);
+ else
+ cb_error(session, "stream-error", stanza);
+ end
+ stanza = nil;
+ else
+ stanza:up();
+ end
+ else
if tagname == stream_tag then
if cb_streamclosed then
cb_streamclosed(session);
@@ -125,23 +142,6 @@ function init_xmlhandlers(session, stream_callbacks)
cb_error(session, "parse-error", "unexpected-element-close", name);
end
stanza, chardata = nil, {};
- return;
- end
- if #chardata > 0 then
- -- We have some character data in the buffer
- stanza:text(t_concat(chardata));
- chardata = {};
- end
- -- Complete stanza
- if #stanza.last_add == 0 then
- if tagname ~= stream_error_tag then
- cb_handlestanza(session, stanza);
- else
- cb_error(session, "stream-error", stanza);
- end
- stanza = nil;
- else
- stanza:up();
end
end
return xml_handlers;