diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-05-04 23:43:01 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-05-04 23:43:01 +0100 |
commit | 1331d1dbbe855459ece589021a548559d4b27720 (patch) | |
tree | 2ba5d4fb08c6ab053125d5d5b613350d556c3856 /core/eventmanager.lua | |
parent | bb00df3f5e95d57c7dff489c5a3da1b292251f85 (diff) | |
download | prosody-1331d1dbbe855459ece589021a548559d4b27720.tar.gz prosody-1331d1dbbe855459ece589021a548559d4b27720.zip |
eventmanager, prosody: Adapt eventmanager to use prosody.events, as a step towards removing it entirely
Diffstat (limited to 'core/eventmanager.lua')
-rw-r--r-- | core/eventmanager.lua | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/core/eventmanager.lua b/core/eventmanager.lua index 0e766c30..1f69c8e1 100644 --- a/core/eventmanager.lua +++ b/core/eventmanager.lua @@ -10,24 +10,18 @@ local t_insert = table.insert; local ipairs = ipairs; +local events = _G.prosody.events; + module "eventmanager" local event_handlers = {}; function add_event_hook(name, handler) - if not event_handlers[name] then - event_handlers[name] = {}; - end - t_insert(event_handlers[name] , handler); + return events.add_handler(name, handler); end function fire_event(name, ...) - local event_handlers = event_handlers[name]; - if event_handlers then - for name, handler in ipairs(event_handlers) do - handler(...); - end - end + return events.fire_event(name, ...); end -return _M;
\ No newline at end of file +return _M; |