modulemanager: Add get_host_type() API method, and fix up call_module_method to work properly
--- 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