mod_saslauth: Got rid of undocumented and useless 'sasl_realm' config option (was...
[prosody.git] / net / xmppserver_listener.lua
index 8700e6f2ebbe6b5c864ba2ad6434e0c277eeeb7a..05e14a0f86d1358d3d52bda9d8e7fada46c5e7f7 100644 (file)
@@ -49,11 +49,14 @@ function stream_callbacks.error(session, error, data)
 end
 
 local function handleerr(err) log("error", "Traceback[s2s]: %s: %s", tostring(err), debug.traceback()); end
-function stream_callbacks.handlestanza(a, b)
-       if b.attr.xmlns == "jabber:client" then --COMPAT: Prosody pre-0.6.2 may send jabber:client
-               b.attr.xmlns = nil;
+function stream_callbacks.handlestanza(session, stanza)
+       if stanza.attr.xmlns == "jabber:client" then --COMPAT: Prosody pre-0.6.2 may send jabber:client
+               stanza.attr.xmlns = nil;
+       end
+       stanza = session.filter("stanzas/in", stanza);
+       if stanza then
+               return xpcall(function () return core_process_stanza(session, stanza) end, handleerr);
        end
-       xpcall(function () core_process_stanza(a, b) end, handleerr);
 end
 
 local connlisteners_register = require "net.connlisteners".register;
@@ -140,10 +143,7 @@ local function initialize_session(session)
        session.close = session_close;
        local handlestanza = stream_callbacks.handlestanza;
        function session.dispatch_stanza(session, stanza)
-               stanza = filters("stanzas/in", stanza);
-               if stanza then
-                       return handlestanza(session, stanza);
-               end
+               return handlestanza(session, stanza);
        end
 end