diff -r c04d4fd34685 -r ab02540afcf3 xmppstream.lua --- a/xmppstream.lua Fri Sep 17 14:47:45 2010 +0100 +++ b/xmppstream.lua Mon Dec 06 04:00:24 2010 +0000 @@ -77,20 +77,11 @@ if not stanza then --if we are not currently inside a stanza if session.notopen then - if tagname == stream_tag then - if cb_streamopened then - cb_streamopened(session, attr); - end - else - -- Garbage before stream? - cb_error(session, "no-stream"); + if cb_streamopened then + cb_streamopened(session, attr, name); end return; end - if curr_ns == "jabber:client" and name ~= "iq" and name ~= "presence" and name ~= "message" then - cb_error(session, "invalid-top-level-element"); - end - stanza = st.stanza(name, attr); else -- we are inside a stanza, so add a tag attr.xmlns = nil; @@ -124,16 +115,8 @@ stanza:up(); end else - if tagname == stream_tag then - if cb_streamclosed then - cb_streamclosed(session); - end - else - local curr_ns,name = tagname:match(ns_pattern); - if name == "" then - curr_ns, name = "", curr_ns; - end - cb_error(session, "parse-error", "unexpected-element-close", name); + if cb_streamclosed then + cb_streamclosed(session); end stanza, chardata = nil, {}; end