Software /
code /
prosody
Changeset
2493:ec09d16a51e1
xmlhandlers: Rearranged a little code.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 23 Jan 2010 18:41:20 +0500 |
parents | 2492:b5e2d1919ec3 |
children | 2494:6a60d67b4bb8 |
files | core/xmlhandlers.lua |
diffstat | 1 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/core/xmlhandlers.lua Sat Jan 23 18:33:39 2010 +0500 +++ b/core/xmlhandlers.lua Sat Jan 23 18:41:20 2010 +0500 @@ -116,7 +116,24 @@ 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 @@ 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;