Software /
code /
prosody
Diff
core/modulemanager.lua @ 1960:1e674dae31ae
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)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Oct 2009 22:12:46 +0100 |
parent | 1946:0eb3835ef9bf |
child | 1986:d4ba9d94eb74 |
line wrap: on
line diff
--- a/core/modulemanager.lua Fri Oct 16 22:03:32 2009 +0100 +++ b/core/modulemanager.lua Fri Oct 16 22:12:46 2009 +0100 @@ -56,22 +56,25 @@ -- 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);