Software /
code /
prosody
Diff
plugins/mod_bosh.lua @ 5187:d71f731e8fe4
mod_bosh: Add support for stanza filters to BOSH sessions (needed by some plugins)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 22 Nov 2012 19:35:50 +0000 |
parent | 5185:ca30b21946ef |
child | 5188:6689605f8591 |
line wrap: on
line diff
--- a/plugins/mod_bosh.lua Thu Nov 22 18:32:27 2012 +0000 +++ b/plugins/mod_bosh.lua Thu Nov 22 19:35:50 2012 +0000 @@ -18,6 +18,7 @@ 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 @@ }; 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 @@ 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 @@ 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