aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-07-08 14:28:42 +0100
committerMatthew Wild <mwild1@gmail.com>2010-07-08 14:28:42 +0100
commitec41e71baaad7d6be6da1447e7388bfe7857cc09 (patch)
treef1ac94158961e746d02aba6d09d40c039fbec58a
parentce782869b3b1824c61e619e83e71d2b5043ed095 (diff)
downloadprosody-ec41e71baaad7d6be6da1447e7388bfe7857cc09.tar.gz
prosody-ec41e71baaad7d6be6da1447e7388bfe7857cc09.zip
xmpp{client,server}_listener: Put stanzas/in filtering code in the correct place to make it actually work :)
-rw-r--r--net/xmppclient_listener.lua12
-rw-r--r--net/xmppserver_listener.lua16
2 files changed, 14 insertions, 14 deletions
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua
index 623a98c8..a7da6d22 100644
--- a/net/xmppclient_listener.lua
+++ b/net/xmppclient_listener.lua
@@ -63,8 +63,11 @@ function stream_callbacks.error(session, error, data)
end
local function handleerr(err) log("error", "Traceback[c2s]: %s: %s", tostring(err), debug.traceback()); end
-function stream_callbacks.handlestanza(a, b)
- xpcall(function () core_process_stanza(a, b) end, handleerr);
+function stream_callbacks.handlestanza(session, stanza)
+ stanza = session.filter("stanzas/in", stanza);
+ if stanza then
+ xpcall(function () core_process_stanza(session, stanza) end, handleerr);
+ end
end
local sessions = {};
@@ -151,10 +154,7 @@ function xmppclient.onconnect(conn)
local handlestanza = stream_callbacks.handlestanza;
function session.dispatch_stanza(session, stanza)
- stanza = filter("stanzas/in", stanza);
- if stanza then
- return handlestanza(session, stanza);
- end
+ return handlestanza(session, stanza);
end
end
diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua
index 8700e6f2..6989c202 100644
--- a/net/xmppserver_listener.lua
+++ b/net/xmppserver_listener.lua
@@ -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
+ xpcall(function () core_process_stanza(a, b) 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