aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-10-16 22:12:46 +0100
committerMatthew Wild <mwild1@gmail.com>2009-10-16 22:12:46 +0100
commit6c0b6f76fbc3df0a1d80754fd69729de4acfe347 (patch)
tree3870091265d0e390c09891a3f04aaab9f6436aad /core/modulemanager.lua
parente442e6afe51ef2fef9ec06988333756bb6136031 (diff)
downloadprosody-6c0b6f76fbc3df0a1d80754fd69729de4acfe347.tar.gz
prosody-6c0b6f76fbc3df0a1d80754fd69729de4acfe347.zip
modulemanager: Re-organise module loading to still work when no global modules_enabled is defined in the config (thanks hoelzro for accidentally discovering this one)
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua29
1 files changed, 16 insertions, 13 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 465b9dd8..312ca738 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -56,22 +56,25 @@ local NULL = {};
-- Load modules when a host is activated
function load_modules_for_host(host)
+ local disabled_set = {};
+ local modules_disabled = config.get(host, "core", "modules_disabled");
+ if modules_disabled then
+ for _, module in ipairs(modules_disabled) do
+ disabled_set[module] = true;
+ end
+ end
+
+ -- Load auto-loaded modules for this host
+ for _, module in ipairs(autoload_modules) do
+ if not disabled_set[module] then
+ load(host, module);
+ end
+ end
+
+ -- Load modules from global section
if config.get(host, "core", "load_global_modules") ~= false then
- -- Load modules from global section
local modules_enabled = config.get("*", "core", "modules_enabled");
- local modules_disabled = config.get(host, "core", "modules_disabled");
- local disabled_set = {};
if modules_enabled then
- if modules_disabled then
- for _, module in ipairs(modules_disabled) do
- disabled_set[module] = true;
- end
- end
- for _, module in ipairs(autoload_modules) do
- if not disabled_set[module] then
- load(host, module);
- end
- end
for _, module in ipairs(modules_enabled) do
if not disabled_set[module] and not is_loaded(host, module) then
load(host, module);