aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/modulemanager.lua12
-rwxr-xr-xprosody12
2 files changed, 12 insertions, 12 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index aa59b9da..b997c6e0 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -25,6 +25,7 @@ local logger = require "util.logger";
local log = logger.init("modulemanager");
local addDiscoInfoHandler = require "core.discomanager".addDiscoInfoHandler;
local eventmanager = require "core.eventmanager";
+local config = require "core.configmanager";
local loadfile, pcall = loadfile, pcall;
@@ -49,6 +50,17 @@ local stanza_handlers = {};
local modulehelpers = setmetatable({}, { __index = _G });
+-- Load modules when a host is activated
+function load_modules_for_host(host)
+ local modules_enabled = config.get(host, "core", "modules_enabled");
+ if modules_enabled then
+ for _, module in pairs(modules_enabled) do
+ load(host, module);
+ end
+ end
+end
+eventmanager.add_event_hook("host-activated", load_modules_for_host);
+--
function load(host, module_name, config)
if not (host and module_name) then
diff --git a/prosody b/prosody
index 9fd5e4ff..584af214 100755
--- a/prosody
+++ b/prosody
@@ -135,18 +135,6 @@ eventmanager.add_event_hook("host-activated", mkdirs);
eventmanager.fire_event("server-starting");
--- Initialise modules
-
-for host in pairs(hosts) do
- if host ~= "*" then
- local modules_enabled = config.get(host, "core", "modules_enabled");
- if modules_enabled then
- for _, module in pairs(modules_enabled) do
- modulemanager.load(host, module);
- end
- end
- end
-end
-- setup error handling
setmetatable(_G, { __index = function (t, k) print("WARNING: ATTEMPT TO READ A NIL GLOBAL!!!", k); error("Attempt to read a non-existent global. Naughty boy.", 2); end, __newindex = function (t, k, v) print("ATTEMPT TO SET A GLOBAL!!!!", tostring(k).." = "..tostring(v)); error("Attempt to set a global. Naughty boy.", 2); end }) --]][][[]][];