diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-11-19 05:10:16 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-11-19 05:10:16 +0000 |
commit | 0da8b7b741f592c1e2b7d54639d81a485ee8d8da (patch) | |
tree | a3d3131db4345d22f83b2c4e37be3288b311855d /core | |
parent | f611cb1c738092e8653512f88d97b9f84f38784b (diff) | |
download | prosody-0da8b7b741f592c1e2b7d54639d81a485ee8d8da.tar.gz prosody-0da8b7b741f592c1e2b7d54639d81a485ee8d8da.zip |
Don't error if streamopened/streamclosed callback is not specified for a session
Diffstat (limited to 'core')
-rw-r--r-- | core/xmlhandlers.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/xmlhandlers.lua b/core/xmlhandlers.lua index 61a9e387..42ccf388 100644 --- a/core/xmlhandlers.lua +++ b/core/xmlhandlers.lua @@ -69,8 +69,10 @@ function init_xmlhandlers(session, stream_callbacks) if not stanza then --if we are not currently inside a stanza if session.notopen then print("client opening with "..tostring(name)); - if name == "stream" and cb_streamopened then - cb_streamopened(session, attr); + if name == "stream" then + if cb_streamopened then + cb_streamopened(session, attr); + end return; end error("Client failed to open stream successfully"); @@ -97,14 +99,16 @@ function init_xmlhandlers(session, stream_callbacks) function xml_handlers:EndElement(name) curr_ns,name = name:match("^(.+)|([%w%-]+)$"); if (not stanza) or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then - if name == "stream" and cb_streamclosed then + if name == "stream" then log("debug", "Stream closed"); - cb_streamclosed(session); + if cb_streamclosed then + cb_streamclosed(session); + end return; elseif name == "error" then error("Stream error: "..tostring(name)..": "..tostring(stanza)); else - error("XML parse error in client stream"); + error("XML parse error in client stream with element: "..name); end end if stanza and #chardata > 0 then |