- 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
- if name == "stream" then
- log("debug", "Stream closed");
- sm_destroy_session(session);
- return;
+ function xml_handlers:EndElement(tagname)
+ local curr_ns,name = tagname:match("^([^\1]*)\1?(.*)$");
+ 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 tagname == stream_tag then
+ if cb_streamclosed then
+ cb_streamclosed(session);
+ end