Software /
code /
prosody
Diff
core/modulemanager.lua @ 573:f6555ebf84ec
Move module loading to modulemanager
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 06 Dec 2008 04:03:33 +0000 |
parent | 569:5216efe6088b |
child | 577:22f54a04471f |
child | 578:5879264e28e2 |
line wrap: on
line diff
--- a/core/modulemanager.lua Sat Dec 06 03:42:21 2008 +0000 +++ b/core/modulemanager.lua Sat Dec 06 04:03:33 2008 +0000 @@ -25,6 +25,7 @@ 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 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