114 function xml_handlers:EndElement(tagname) |
114 function xml_handlers:EndElement(tagname) |
115 local curr_ns,name = tagname:match(ns_pattern); |
115 local curr_ns,name = tagname:match(ns_pattern); |
116 if name == "" then |
116 if name == "" then |
117 curr_ns, name = "", curr_ns; |
117 curr_ns, name = "", curr_ns; |
118 end |
118 end |
119 if (not stanza) or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then |
119 if not stanza then |
120 if tagname == stream_tag then |
120 if tagname == stream_tag then |
121 if cb_streamclosed then |
121 if cb_streamclosed then |
122 cb_streamclosed(session); |
122 cb_streamclosed(session); |
123 end |
123 end |
124 elseif name == "error" then |
|
125 cb_error(session, "stream-error", stanza); |
|
126 else |
124 else |
127 cb_error(session, "parse-error", "unexpected-element-close", name); |
125 cb_error(session, "parse-error", "unexpected-element-close", name); |
128 end |
126 end |
129 stanza, chardata = nil, {}; |
127 stanza, chardata = nil, {}; |
130 return; |
128 return; |