X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmuc%2Fmod_muc.lua;h=329b927022f7ca33e4916c5a0acdbe92492fe576;hb=9e237b2b10201b73e512ae3a4e9129a8019592fc;hp=60602050dc25e63a3ecb189c3b6be6e1a5302218;hpb=c3e937756c9eea82284cb15fcb17af57f462346a;p=prosody.git diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index 60602050..329b9270 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -23,8 +23,6 @@ if restrict_room_creation then end end local muc_new_room = module:require "muc".new_room; -local register_component = require "core.componentmanager".register_component; -local deregister_component = require "core.componentmanager".deregister_component; local jid_split = require "util.jid".split; local jid_bare = require "util.jid".bare; local st = require "util.stanza"; @@ -35,7 +33,7 @@ local um_is_admin = require "core.usermanager".is_admin; rooms = {}; local rooms = rooms; local persistent_rooms = datamanager.load(nil, muc_host, "persistent") or {}; -local component; +local component = hosts[module.host]; -- Configurable options local max_history_messages = module:get_option_number("max_history_messages"); @@ -153,18 +151,17 @@ function stanza_handler(event) handle_to_domain(origin, stanza); return true; 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); +module:hook("iq/bare", stanza_handler, -1); +module:hook("message/bare", stanza_handler, -1); +module:hook("presence/bare", stanza_handler, -1); +module:hook("iq/full", stanza_handler, -1); +module:hook("message/full", stanza_handler, -1); +module:hook("presence/full", stanza_handler, -1); +module:hook("iq/host", stanza_handler, -1); +module:hook("message/host", stanza_handler, -1); +module:hook("presence/host", stanza_handler, -1); -component = register_component(muc_host, function() end); -function component.send(stanza) -- FIXME do a generic fix +hosts[module.host].send = function(stanza) -- FIXME do a generic fix if stanza.attr.type == "result" or stanza.attr.type == "error" then core_post_stanza(component, stanza); else error("component.send only supports result and error stanzas at the moment"); end @@ -172,9 +169,6 @@ end prosody.hosts[module:get_host()].muc = { rooms = rooms }; -module.unload = function() - deregister_component(muc_host); -end module.save = function() return {rooms = rooms}; end