Comparison

core/modulemanager.lua @ 709:8bb83563cb21

Automated merge with http://waqas.ath.cx:8000/
author Matthew Wild <mwild1@gmail.com>
date Tue, 13 Jan 2009 15:29:00 +0000
parent 708:b72d408f5f15
parent 698:d8a678e40a0a
child 710:56f6c115bc69
comparison
equal deleted inserted replaced
708:b72d408f5f15 709:8bb83563cb21
25 local log = logger.init("modulemanager"); 25 local log = logger.init("modulemanager");
26 local addDiscoInfoHandler = require "core.discomanager".addDiscoInfoHandler; 26 local addDiscoInfoHandler = require "core.discomanager".addDiscoInfoHandler;
27 local eventmanager = require "core.eventmanager"; 27 local eventmanager = require "core.eventmanager";
28 local config = require "core.configmanager"; 28 local config = require "core.configmanager";
29 local multitable_new = require "util.multitable".new; 29 local multitable_new = require "util.multitable".new;
30 30 local register_actions = require "core.actions".register;
31 31
32 local loadfile, pcall = loadfile, pcall; 32 local loadfile, pcall = loadfile, pcall;
33 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv; 33 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv;
34 local pairs, ipairs = pairs, ipairs; 34 local pairs, ipairs = pairs, ipairs;
35 local t_insert = table.insert; 35 local t_insert = table.insert;
66 local modules_enabled = config.get("*", "core", "modules_enabled"); 66 local modules_enabled = config.get("*", "core", "modules_enabled");
67 local modules_disabled = config.get(host, "core", "modules_disabled"); 67 local modules_disabled = config.get(host, "core", "modules_disabled");
68 local disabled_set = {}; 68 local disabled_set = {};
69 if modules_enabled then 69 if modules_enabled then
70 if modules_disabled then 70 if modules_disabled then
71 for _, module in pairs(modules_disabled) do 71 for _, module in ipairs(modules_disabled) do
72 disabled_set[module] = true; 72 disabled_set[module] = true;
73 end 73 end
74 end 74 end
75 for _, module in pairs(modules_enabled) do 75 for _, module in ipairs(modules_enabled) do
76 if not disabled_set[module] then 76 if not disabled_set[module] then
77 load(host, module); 77 load(host, module);
78 end 78 end
79 end 79 end
80 end 80 end
254 event_hooks:set(self.host, self.name, name, handler, true); 254 event_hooks:set(self.host, self.name, name, handler, true);
255 end 255 end
256 256
257 -------------------------------------------------------------------- 257 --------------------------------------------------------------------
258 258
259 local actions = {};
260
261 function actions.load(params)
262 --return true, "Module loaded ("..params.module.." on "..params.host..")";
263 return load(params.host, params.module);
264 end
265
266 function actions.unload(params)
267 return unload(params.host, params.module);
268 end
269
270 register_actions("/modules", actions);
271
259 return _M; 272 return _M;