diff options
author | Matthew Wild <mwild1@gmail.com> | 2016-01-02 20:42:53 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2016-01-02 20:42:53 +0000 |
commit | 6d5bf3651160efa69fb89bd2f92b11f7d69f4034 (patch) | |
tree | cb3e8bce329accde5bcfa6c8138f4868a7aa9c58 /util | |
parent | b70c2783801a3fa01d498432f74de66a770636cd (diff) | |
parent | e5691fed7972bf6c0d4e0e494f79850322b794c4 (diff) | |
download | prosody-6d5bf3651160efa69fb89bd2f92b11f7d69f4034.tar.gz prosody-6d5bf3651160efa69fb89bd2f92b11f7d69f4034.zip |
Merge 0.10->trunk
Diffstat (limited to 'util')
-rw-r--r-- | util/events.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util/events.lua b/util/events.lua index 825ffb19..073d2a60 100644 --- a/util/events.lua +++ b/util/events.lua @@ -17,10 +17,15 @@ local next = next; local _ENV = nil; local function new() + -- Map event name to ordered list of handlers (lazily built): handlers[event_name] = array_of_handler_functions local handlers = {}; + -- Array of wrapper functions that wrap all events (nil if empty) local global_wrappers; + -- Per-event wrappers: wrappers[event_name] = wrapper_function local wrappers = {}; + -- Event map: event_map[handler_function] = priority_number local event_map = {}; + -- Called on-demand to build handlers entries local function _rebuild_index(handlers, event) local _handlers = event_map[event]; if not _handlers or next(_handlers) == nil then return; end |