# HG changeset patch # User Matthew Wild # Date 1247146489 -3600 # Node ID 9d8c35e98ca21ddbee3bdc22f93d38b397260d03 # Parent 5970e06d93351b980e92437350462f5e5741c797 configmanager, modulemanager: Allow components to have modules specified in the config (but don't load the global set of modules for them) diff -r 5970e06d9335 -r 9d8c35e98ca2 core/configmanager.lua --- a/core/configmanager.lua Thu Jul 09 04:37:08 2009 +0100 +++ b/core/configmanager.lua Thu Jul 09 14:34:49 2009 +0100 @@ -123,7 +123,7 @@ 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 -r 5970e06d9335 -r 9d8c35e98ca2 core/modulemanager.lua --- a/core/modulemanager.lua Thu Jul 09 04:37:08 2009 +0100 +++ b/core/modulemanager.lua Thu Jul 09 14:34:49 2009 +0100 @@ -59,35 +59,33 @@ -- 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);