Software /
code /
prosody
Diff
core/moduleapi.lua @ 4896:27cda15104f2
modulemanager, moduleapi: Turn module.event_handlers into a multitable and track object->event->handler associations correctly (thanks Zash)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 19 May 2012 15:39:16 +0100 |
parent | 4893:98ff89ab5d1d |
child | 4954:318624ffe74e |
child | 5021:85b2689dbcfe |
line wrap: on
line diff
--- a/core/moduleapi.lua Sat May 19 15:35:49 2012 +0100 +++ b/core/moduleapi.lua Sat May 19 15:39:16 2012 +0100 @@ -70,12 +70,7 @@ end function api:hook_object_event(object, event, handler, priority) - local handlers = self.event_handlers[event]; - if not handlers then - handlers = {}; - self.event_handlers[event] = handlers; - end - handlers[event] = { handler = handler, priority = priority, object = object }; + self.event_handlers:set(object, event, handler, true); return object.add_handler(event, handler, priority); end