aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-01-07 20:03:59 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-01-07 20:03:59 +0500
commit7c24c84226680524cdfc5e43c8fece0ee838ee8f (patch)
treebf33788d0f5186eb3b8feddcb796fddc8d56fa8f
parent311a737c2c08cd52b4ba554c4e168fe114581730 (diff)
downloadprosody-7c24c84226680524cdfc5e43c8fece0ee838ee8f.tar.gz
prosody-7c24c84226680524cdfc5e43c8fece0ee838ee8f.zip
modulemanager: module.unload now gets called when modules are being unloaded
-rw-r--r--core/modulemanager.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 354d8810..f782f174 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -35,6 +35,7 @@ local pairs, ipairs = pairs, ipairs;
local t_insert = table.insert;
local type = type;
local next = next;
+local rawget = rawget;
local tostring, print = tostring, print;
@@ -134,12 +135,12 @@ function unload(host, name, ...)
local mod = modulemap[host] and modulemap[host][name];
if not mod then return nil, "module-not-loaded"; end
- --[[if type(mod.unload) == "function" then
- local ok, err = pcall(mod.unload, ...)
+ if type(rawget(mod, "unload")) == "function" then
+ local ok, err = pcall(rawget(mod, "unload"), ...)
if (not ok) and err then
log("warn", "Non-fatal error unloading module '%s' from '%s': %s", name, host, err);
end
- end]]
+ end
modulemap[host][name] = nil;
features_table:remove(host, name);
local params = handler_table:get(host, name); -- , {module.host, origin_type, tag, xmlns}