aboutsummaryrefslogtreecommitdiffstats
path: root/core/modulemanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-01-29 01:58:11 +0000
committerMatthew Wild <mwild1@gmail.com>2009-01-29 01:58:11 +0000
commit6057fe64c95a06c9c8e2901c89324f543b2a8730 (patch)
tree87aa0fdc33cb8662015f3fa2e575010894065a07 /core/modulemanager.lua
parent9b0ee1a5fb2abb96ef4c34b4ff5043201033984f (diff)
downloadprosody-6057fe64c95a06c9c8e2901c89324f543b2a8730.tar.gz
prosody-6057fe64c95a06c9c8e2901c89324f543b2a8730.zip
modulemanager: Add get_host_type() API method, and fix up call_module_method to work properly
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r--core/modulemanager.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 5305e5c6..b0b2b636 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -29,6 +29,8 @@ local config = require "core.configmanager";
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 @@ function module_has_method(module, method)
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 @@ function api:get_host()
return self.host;
end
+function api:get_host_type()
+ return hosts[self.host].type;
+end
+
function api:set_global()
self.host = "*";
end