aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-01-23 18:41:20 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-01-23 18:41:20 +0500
commit05f3218e101d65f7628e38f3b5b9e686fe6f46e4 (patch)
treea704d8b389988c108143543fa35103e02ff95ccd /core
parente8b118df7dcb44523e2dc366de721b8ed0ea41eb (diff)
downloadprosody-05f3218e101d65f7628e38f3b5b9e686fe6f46e4.tar.gz
prosody-05f3218e101d65f7628e38f3b5b9e686fe6f46e4.zip
xmlhandlers: Rearranged a little code.
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;