Software /
code /
prosody
Comparison
core/modulemanager.lua @ 698:d8a678e40a0a
Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 12 Jan 2009 04:05:10 +0000 |
parent | 695:3384f2784795 |
child | 709:8bb83563cb21 |
comparison
equal
deleted
inserted
replaced
697:8ddc85fa7602 | 698:d8a678e40a0a |
---|---|
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; |
252 event_hooks:set(self.host, self.name, name, handler, true); | 252 event_hooks:set(self.host, self.name, name, handler, true); |
253 end | 253 end |
254 | 254 |
255 -------------------------------------------------------------------- | 255 -------------------------------------------------------------------- |
256 | 256 |
257 local actions = {}; | |
258 | |
259 function actions.load(params) | |
260 --return true, "Module loaded ("..params.module.." on "..params.host..")"; | |
261 return load(params.host, params.module); | |
262 end | |
263 | |
264 function actions.unload(params) | |
265 return unload(params.host, params.module); | |
266 end | |
267 | |
268 register_actions("/modules", actions); | |
269 | |
257 return _M; | 270 return _M; |