From 9858c0f2fc72965fd2410b98fe894ae11f42a259 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 19 Jan 2010 03:58:20 +0000 Subject: xmlhandlers: Move stream-error detection to somewhere more appropriate (it was never reached) - s2s stream errors now reported properly --- core/xmlhandlers.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'core/xmlhandlers.lua') diff --git a/core/xmlhandlers.lua b/core/xmlhandlers.lua index 6e693d86..f3310fb9 100644 --- a/core/xmlhandlers.lua +++ b/core/xmlhandlers.lua @@ -116,13 +116,11 @@ function init_xmlhandlers(session, stream_callbacks) if name == "" then curr_ns, name = "", curr_ns; end - if (not stanza) or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then + if not stanza then if tagname == stream_tag then if cb_streamclosed then cb_streamclosed(session); end - elseif name == "error" then - cb_error(session, "stream-error", stanza); else cb_error(session, "parse-error", "unexpected-element-close", name); end @@ -136,7 +134,11 @@ function init_xmlhandlers(session, stream_callbacks) end -- Complete stanza if #stanza.last_add == 0 then - cb_handlestanza(session, stanza); + if tagname ~= stream_error_tag then + cb_handlestanza(session, stanza); + else + cb_error(session, "stream-error", stanza); + end stanza = nil; else stanza:up(); -- cgit v1.2.3