Software / code / prosody
Comparison
core/modulemanager.lua @ 5377:898454038524
core.*: Complete removal of all traces of the "core" section and section-related code.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 23 Mar 2013 02:33:15 +0100 |
| parent | 5192:3fc3a3072cc2 |
| child | 5410:bea93cfd6c54 |
comparison
equal
deleted
inserted
replaced
| 5376:ba9be0be4bbb | 5377:898454038524 |
|---|---|
| 42 -- [host] = { [module] = module_env } | 42 -- [host] = { [module] = module_env } |
| 43 local modulemap = { ["*"] = {} }; | 43 local modulemap = { ["*"] = {} }; |
| 44 | 44 |
| 45 -- Load modules when a host is activated | 45 -- Load modules when a host is activated |
| 46 function load_modules_for_host(host) | 46 function load_modules_for_host(host) |
| 47 local component = config.get(host, "core", "component_module"); | 47 local component = config.get(host, "component_module"); |
| 48 | 48 |
| 49 local global_modules_enabled = config.get("*", "core", "modules_enabled"); | 49 local global_modules_enabled = config.get("*", "modules_enabled"); |
| 50 local global_modules_disabled = config.get("*", "core", "modules_disabled"); | 50 local global_modules_disabled = config.get("*", "modules_disabled"); |
| 51 local host_modules_enabled = config.get(host, "core", "modules_enabled"); | 51 local host_modules_enabled = config.get(host, "modules_enabled"); |
| 52 local host_modules_disabled = config.get(host, "core", "modules_disabled"); | 52 local host_modules_disabled = config.get(host, "modules_disabled"); |
| 53 | 53 |
| 54 if host_modules_enabled == global_modules_enabled then host_modules_enabled = nil; end | 54 if host_modules_enabled == global_modules_enabled then host_modules_enabled = nil; end |
| 55 if host_modules_disabled == global_modules_disabled then host_modules_disabled = nil; end | 55 if host_modules_disabled == global_modules_disabled then host_modules_disabled = nil; end |
| 56 | 56 |
| 57 local global_modules = set.new(autoload_modules) + set.new(global_modules_enabled) - set.new(global_modules_disabled); | 57 local global_modules = set.new(autoload_modules) + set.new(global_modules_enabled) - set.new(global_modules_disabled); |
| 216 local ok, ret, err = call_module_method(mod, "save"); | 216 local ok, ret, err = call_module_method(mod, "save"); |
| 217 if ok then | 217 if ok then |
| 218 saved = ret; | 218 saved = ret; |
| 219 else | 219 else |
| 220 log("warn", "Error saving module '%s:%s' state: %s", host, name, ret); | 220 log("warn", "Error saving module '%s:%s' state: %s", host, name, ret); |
| 221 if not config.get(host, "core", "force_module_reload") then | 221 if not config.get(host, "force_module_reload") then |
| 222 log("warn", "Aborting reload due to error, set force_module_reload to ignore this"); | 222 log("warn", "Aborting reload due to error, set force_module_reload to ignore this"); |
| 223 return nil, "save-state-failed"; | 223 return nil, "save-state-failed"; |
| 224 else | 224 else |
| 225 log("warn", "Continuing with reload (using the force)"); | 225 log("warn", "Continuing with reload (using the force)"); |
| 226 end | 226 end |