diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-07-09 14:34:49 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-07-09 14:34:49 +0100 |
commit | 455e77f21d657b34d8fa6910fb2c0c32d2ea4085 (patch) | |
tree | 78c4f70004ad82e4b7c0d3c72c15bc8146ba81f4 | |
parent | 8460bb4079c46e59d19152d7dcce113a25700504 (diff) | |
download | prosody-455e77f21d657b34d8fa6910fb2c0c32d2ea4085.tar.gz prosody-455e77f21d657b34d8fa6910fb2c0c32d2ea4085.zip |
configmanager, modulemanager: Allow components to have modules specified in the config (but don't load the global set of modules for them)
-rw-r--r-- | core/configmanager.lua | 2 | ||||
-rw-r--r-- | core/modulemanager.lua | 42 |
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); |