Software /
code /
prosody
Comparison
util/events.lua @ 2406:2c416334579c
util.events: Rename add_plugin() and remove_plugin() to add_handlers() and remove_handlers() respectively
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 31 Dec 2009 02:39:40 +0000 |
parent | 1522:569d58d21612 |
child | 2925:692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
2405:88f73ee1c46f | 2406:2c416334579c |
---|---|
45 if map then | 45 if map then |
46 map[handler] = nil; | 46 map[handler] = nil; |
47 _rebuild_index(event); | 47 _rebuild_index(event); |
48 end | 48 end |
49 end; | 49 end; |
50 local function add_plugin(plugin) | 50 local function add_handlers(handlers) |
51 for event, handler in pairs(plugin) do | 51 for event, handler in pairs(handlers) do |
52 add_handler(event, handler); | 52 add_handler(event, handler); |
53 end | 53 end |
54 end; | 54 end; |
55 local function remove_plugin(plugin) | 55 local function remove_handlers(handlers) |
56 for event, handler in pairs(plugin) do | 56 for event, handler in pairs(handlers) do |
57 remove_handler(event, handler); | 57 remove_handler(event, handler); |
58 end | 58 end |
59 end; | 59 end; |
60 local function _create_dispatcher(event) -- FIXME duplicate code in fire_event | 60 local function _create_dispatcher(event) -- FIXME duplicate code in fire_event |
61 local h = handlers[event]; | 61 local h = handlers[event]; |