Software /
code /
prosody
Changeset
3538:3ea38f44420c
modulemanager: Removed another legacy events API (add_event_hook), and related code.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sat, 16 Oct 2010 08:15:11 +0500 |
parents | 3537:7bbb19804d82 |
children | 3539:8bbd965267b2 |
files | core/modulemanager.lua |
diffstat | 1 files changed, 0 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/core/modulemanager.lua Sat Oct 16 07:45:12 2010 +0500 +++ b/core/modulemanager.lua Sat Oct 16 08:15:11 2010 +0500 @@ -53,9 +53,7 @@ local modulehelpers = setmetatable({}, { __index = _G }); -local hooked = multitable_new(); local hooks = multitable_new(); -local event_hooks = multitable_new(); local NULL = {}; @@ -188,7 +186,6 @@ log("warn", "Non-fatal error unloading module '%s' on '%s': %s", name, host, err); end end - event_hooks:remove(host, name); -- unhook event handlers hooked by module:hook for event, handlers in pairs(hooks:get(host, name) or NULL) do for handler in pairs(handlers or NULL) do @@ -319,20 +316,6 @@ self:add_item("identity", {category = category, type = type, name = name}); end -local event_hook = function(host, mod_name, event_name, ...) - if type((...)) == "table" and (...).host and (...).host ~= host then return; end - for handler in pairs(event_hooks:get(host, mod_name, event_name) or NULL) do - handler(...); - end -end; -function api:add_event_hook(name, handler) - if not hooked:get(self.host, self.name, name) then - prosody_events.add_handler(name, function(...) event_hook(self.host, self.name, name, ...); end); - hooked:set(self.host, self.name, name, true); - end - event_hooks:set(self.host, self.name, name, handler, true); -end - function api:fire_event(...) return (hosts[self.host] or prosody).events.fire_event(...); end