aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/configmanager.lua2
-rw-r--r--core/modulemanager.lua42
2 files changed, 21 insertions, 23 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 37646017..77cfd575 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -123,7 +123,7 @@ do
function env.Component(name)
set(name, "core", "component_module", "component");
-- Don't load the global modules by default
- set(name, "core", "modules_enable", false);
+ set(name, "core", "load_global_modules", false);
rawset(env, "__currenthost", name);
return function (module)
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 5ea0a22e..cc9e2686 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -59,35 +59,33 @@ local NULL = {};
-- Load modules when a host is activated
function load_modules_for_host(host)
- if config.get(host, "core", "modules_enable") == false then
- return; -- Only load for hosts, not components, etc.
- end
-
- -- 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;
+ 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
- end
- for _, module in ipairs({"presence", "message", "iq"}) do
- if not disabled_set[module] then
- load(host, module);
+ for _, module in ipairs({"presence", "message", "iq"}) do
+ if not disabled_set[module] then
+ load(host, module);
+ end
end
- end
- for _, module in ipairs(modules_enabled) do
- if not disabled_set[module] and not is_loaded(host, module) then
- load(host, module);
+ for _, module in ipairs(modules_enabled) do
+ if not disabled_set[module] and not is_loaded(host, module) then
+ load(host, module);
+ end
end
end
end
-
+
-- Load modules from just this host
local modules_enabled = config.get(host, "core", "modules_enabled");
- if modules_enabled then
+ if modules_enabled and modules_enabled ~= config.get("*", "core", "modules_enabled") then
for _, module in pairs(modules_enabled) do
if not is_loaded(host, module) then
load(host, module);