Software / code / prosody
Comparison
core/modulemanager.lua @ 1504:9d8c35e98ca2
configmanager, modulemanager: Allow components to have modules specified in the config (but don't load the global set of modules for them)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 09 Jul 2009 14:34:49 +0100 |
| parent | 1447:cc20d6dfa32d |
| child | 1505:e19cb945c25b |
comparison
equal
deleted
inserted
replaced
| 1503:5970e06d9335 | 1504:9d8c35e98ca2 |
|---|---|
| 57 | 57 |
| 58 local NULL = {}; | 58 local NULL = {}; |
| 59 | 59 |
| 60 -- Load modules when a host is activated | 60 -- Load modules when a host is activated |
| 61 function load_modules_for_host(host) | 61 function load_modules_for_host(host) |
| 62 if config.get(host, "core", "modules_enable") == false then | 62 if config.get(host, "core", "load_global_modules") ~= false then |
| 63 return; -- Only load for hosts, not components, etc. | 63 -- Load modules from global section |
| 64 end | 64 local modules_enabled = config.get("*", "core", "modules_enabled"); |
| 65 | 65 local modules_disabled = config.get(host, "core", "modules_disabled"); |
| 66 -- Load modules from global section | 66 local disabled_set = {}; |
| 67 local modules_enabled = config.get("*", "core", "modules_enabled"); | 67 if modules_enabled then |
| 68 local modules_disabled = config.get(host, "core", "modules_disabled"); | 68 if modules_disabled then |
| 69 local disabled_set = {}; | 69 for _, module in ipairs(modules_disabled) do |
| 70 if modules_enabled then | 70 disabled_set[module] = true; |
| 71 if modules_disabled then | 71 end |
| 72 for _, module in ipairs(modules_disabled) do | 72 end |
| 73 disabled_set[module] = true; | 73 for _, module in ipairs({"presence", "message", "iq"}) do |
| 74 end | 74 if not disabled_set[module] then |
| 75 end | 75 load(host, module); |
| 76 for _, module in ipairs({"presence", "message", "iq"}) do | 76 end |
| 77 if not disabled_set[module] then | 77 end |
| 78 load(host, module); | 78 for _, module in ipairs(modules_enabled) do |
| 79 end | 79 if not disabled_set[module] and not is_loaded(host, module) then |
| 80 end | 80 load(host, module); |
| 81 for _, module in ipairs(modules_enabled) do | 81 end |
| 82 if not disabled_set[module] and not is_loaded(host, module) then | 82 end |
| 83 load(host, module); | 83 end |
| 84 end | 84 end |
| 85 end | 85 |
| 86 end | |
| 87 | |
| 88 -- Load modules from just this host | 86 -- Load modules from just this host |
| 89 local modules_enabled = config.get(host, "core", "modules_enabled"); | 87 local modules_enabled = config.get(host, "core", "modules_enabled"); |
| 90 if modules_enabled then | 88 if modules_enabled and modules_enabled ~= config.get("*", "core", "modules_enabled") then |
| 91 for _, module in pairs(modules_enabled) do | 89 for _, module in pairs(modules_enabled) do |
| 92 if not is_loaded(host, module) then | 90 if not is_loaded(host, module) then |
| 93 load(host, module); | 91 load(host, module); |
| 94 end | 92 end |
| 95 end | 93 end |