- function xml_handlers:EndElement(name)
- curr_ns,name = name:match("^(.+):(%w+)$");
- if (not stanza) or #stanza.last_add < 0 or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then error("XML parse error in client stream"); end
- if stanza and #chardata > 0 then
+ function xml_handlers:EndElement(tagname)
+ curr_ns,name = tagname:match("^(.-)|?([^%|]-)$");
+ if not 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 tagname == stream_tag then
+ if cb_streamclosed then
+ cb_streamclosed(session);
+ end
+ return;
+ elseif name == "error" then
+ cb_error(session, "stream-error", stanza);
+ else
+ cb_error(session, "parse-error", "unexpected-element-close", name);
+ end
+ end
+ if #chardata > 0 then