Software /
code /
prosody
Changeset
747:40837f3422ab
modulemanager: Add get_host_type() API method, and fix up call_module_method to work properly
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 29 Jan 2009 01:58:11 +0000 |
parents | 746:7027de4c039d |
children | 748:172c43d735e9 |
files | core/modulemanager.lua |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/core/modulemanager.lua Sat Jan 24 20:29:25 2009 +0000 +++ b/core/modulemanager.lua Thu Jan 29 01:58:11 2009 +0000 @@ -29,6 +29,8 @@ local multitable_new = require "util.multitable".new; local register_actions = require "core.actions".register; +local hosts = hosts; + local loadfile, pcall = loadfile, pcall; local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv; local pairs, ipairs = pairs, ipairs; @@ -231,9 +233,9 @@ return type(module.module[method]) == "function"; end -function call_module_method(module, func, ...) - local f = module.module[func]; +function call_module_method(module, method, ...) if module_has_method(module, method) then + local f = module.module[func]; return pcall(f, ...); else return false, "no-such-method"; @@ -259,6 +261,10 @@ return self.host; end +function api:get_host_type() + return hosts[self.host].type; +end + function api:set_global() self.host = "*"; end