diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-12-06 04:03:33 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-12-06 04:03:33 +0000 |
commit | 0f1d3c4074baa7ea119e3fc086467f4db7bcdafe (patch) | |
tree | 67409cad4c1a2f2c717bcdfbfea237c07bf2361d /core/modulemanager.lua | |
parent | 698624de46ac08573b914736b7f3fcae7fa9b6c8 (diff) | |
download | prosody-0f1d3c4074baa7ea119e3fc086467f4db7bcdafe.tar.gz prosody-0f1d3c4074baa7ea119e3fc086467f4db7bcdafe.zip |
Move module loading to modulemanager
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r-- | core/modulemanager.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua index aa59b9da..b997c6e0 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -25,6 +25,7 @@ local logger = require "util.logger"; local log = logger.init("modulemanager"); local addDiscoInfoHandler = require "core.discomanager".addDiscoInfoHandler; local eventmanager = require "core.eventmanager"; +local config = require "core.configmanager"; local loadfile, pcall = loadfile, pcall; @@ -49,6 +50,17 @@ local stanza_handlers = {}; local modulehelpers = setmetatable({}, { __index = _G }); +-- Load modules when a host is activated +function load_modules_for_host(host) + local modules_enabled = config.get(host, "core", "modules_enabled"); + if modules_enabled then + for _, module in pairs(modules_enabled) do + load(host, module); + end + end +end +eventmanager.add_event_hook("host-activated", load_modules_for_host); +-- function load(host, module_name, config) if not (host and module_name) then |