diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-11-04 19:38:05 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-11-04 19:38:05 +0500 |
commit | c0b885a49c74bf95e6d52aab91b9fd543d26d650 (patch) | |
tree | d1c2996b08b315904c52c6f5b5618d8629f0bb95 /plugins | |
parent | bac978fe600081fdae2e685a221e5893ffbf67c3 (diff) | |
download | prosody-c0b885a49c74bf95e6d52aab91b9fd543d26d650.tar.gz prosody-c0b885a49c74bf95e6d52aab91b9fd543d26d650.zip |
MUC: Use events for hooking stanzas instead of the component stanza handler.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/mod_muc.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index 3eab0cf5..b58f8bd0 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -113,7 +113,8 @@ local function handle_to_domain(origin, stanza) end end -component = register_component(muc_host, function(origin, stanza) +function stanza_handler(event) + local origin, stanza = event.origin, event.stanza; local to_node, to_host, to_resource = jid_split(stanza.attr.to); if to_node then local bare = to_node.."@"..to_host; @@ -142,7 +143,18 @@ component = register_component(muc_host, function(origin, stanza) end -- to the main muc domain handle_to_domain(origin, stanza); -end); +end +module:hook("iq/bare", stanza_handler); +module:hook("message/bare", stanza_handler); +module:hook("presence/bare", stanza_handler); +module:hook("iq/full", stanza_handler); +module:hook("message/full", stanza_handler); +module:hook("presence/full", stanza_handler); +module:hook("iq/host", stanza_handler); +module:hook("message/host", stanza_handler); +module:hook("presence/host", stanza_handler); + +component = register_component(muc_host, function() end); function component.send(stanza) -- FIXME do a generic fix if stanza.attr.type == "result" or stanza.attr.type == "error" then core_post_stanza(component, stanza); |