local log = require "util.logger".init("mod_muc");\r
local multitable_new = require "util.multitable".new;\r
\r
-local muc_domain = "conference."..module:get_host();\r
+if module:get_host_type() ~= "component" then\r
+ error("MUC should be loaded as a component, please see http://prosody.im/doc/components", 0);\r
+end\r
+\r
+local muc_domain = module:get_host();\r
+\r
local muc_name = "MUCMUCMUC!!!";\r
\r
-- room_name -> room\r
end\r
end\r
\r
-component = register_component(muc_domain, function(origin, stanza)\r
+function handle_stanza(origin, stanza)\r
local to_node, to_host, to_resource = jid_split(stanza.attr.to);\r
if stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then\r
if type == "error" or type == "result" then return; end\r
if type == "error" or type == "result" then return; end\r
handle_to_domain(origin, stanza);\r
end\r
-end);\r
+end\r
+\r
+module.load_component = function()\r
+ return handle_stanza; -- Return the function that we want to handle incoming stanzas\r
+end\r
\r
module.unload = function()\r
deregister_component(muc_domain);\r