X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_muc.lua;h=0b610835c417ef11413ea6e6c4e47e4b12ee97a4;hb=61fbebe4017d142510fbcfce61714ecb48b99503;hp=f1b46eed86f1a96200efd434af15648bede3f63f;hpb=7e85b925ca35139c994e63d556aabe84bf451e4a;p=prosody.git diff --git a/plugins/mod_muc.lua b/plugins/mod_muc.lua index f1b46eed..0b610835 100644 --- a/plugins/mod_muc.lua +++ b/plugins/mod_muc.lua @@ -8,7 +8,12 @@ local st = require "util.stanza"; local log = require "util.logger".init("mod_muc"); local multitable_new = require "util.multitable".new; -local muc_domain = "conference."..module:get_host(); +if module:get_host_type() ~= "component" then + error("MUC should be loaded as a component, please see http://prosody.im/doc/components", 0); +end + +local muc_domain = module:get_host(); + local muc_name = "MUCMUCMUC!!!"; -- room_name -> room @@ -256,7 +261,7 @@ function handle_to_domain(origin, stanza) end end -component = register_component(muc_domain, function(origin, stanza) +function handle_stanza(origin, stanza) local to_node, to_host, to_resource = jid_split(stanza.attr.to); if stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then if type == "error" or type == "result" then return; end @@ -272,7 +277,11 @@ component = register_component(muc_domain, function(origin, stanza) if type == "error" or type == "result" then return; end handle_to_domain(origin, stanza); end -end); +end + +module.load_component = function() + return handle_stanza; -- Return the function that we want to handle incoming stanzas +end module.unload = function() deregister_component(muc_domain);