aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_bosh.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-11-22 19:35:50 +0000
committerMatthew Wild <mwild1@gmail.com>2012-11-22 19:35:50 +0000
commit286a40227ef27ed88e034defe5e4dffa791f7c2c (patch)
tree90b4204d9c0eea533008a3fe1d19cc17656c242f /plugins/mod_bosh.lua
parent99b1aadc42240d7a920125147d9e5d24d3cb833d (diff)
downloadprosody-286a40227ef27ed88e034defe5e4dffa791f7c2c.tar.gz
prosody-286a40227ef27ed88e034defe5e4dffa791f7c2c.zip
mod_bosh: Add support for stanza filters to BOSH sessions (needed by some plugins)
Diffstat (limited to 'plugins/mod_bosh.lua')
-rw-r--r--plugins/mod_bosh.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index 249c4792..b54fc9d4 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -18,6 +18,7 @@ local core_process_stanza = prosody.core_process_stanza;
local st = require "util.stanza";
local logger = require "util.logger";
local log = logger.init("mod_bosh");
+local initialize_filters = require "util.filters".initialize;
local math_min = math.min;
local xmlns_streams = "http://etherx.jabber.org/streams";
@@ -254,6 +255,8 @@ function stream_callbacks.streamopened(context, attr)
};
sessions[sid] = session;
+ local filter = initialize_filters(session);
+
session.log("debug", "BOSH session created for request from %s", session.ip);
log("info", "New BOSH session, assigned it sid '%s'", sid);
@@ -267,6 +270,7 @@ function stream_callbacks.streamopened(context, attr)
s = st.clone(s);
s.attr.xmlns = "jabber:client";
end
+ s = filter("stanzas/out", s);
--log("debug", "Sending BOSH data: %s", tostring(s));
t_insert(session.send_buffer, tostring(s));
@@ -354,6 +358,7 @@ function stream_callbacks.handlestanza(context, stanza)
if stanza.attr.xmlns == xmlns_bosh then
stanza.attr.xmlns = nil;
end
+ stanza = session.filter("stanzas/in", stanza);
core_process_stanza(session, stanza);
end
end