aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-12-19 00:53:19 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-12-19 00:53:19 +0500
commite8e177385a252d779508d91886dc9d41aabe3a3b (patch)
tree72873253d4b8f3e8983ca6e815947f8833ae6e4e
parent9a65d9ed7b1a458b850e35e554a9fe1478144cfe (diff)
downloadprosody-e8e177385a252d779508d91886dc9d41aabe3a3b.tar.gz
prosody-e8e177385a252d779508d91886dc9d41aabe3a3b.zip
util.events: Remove an event's table when it has no more handlers.
-rw-r--r--util/events.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/events.lua b/util/events.lua
index 8e05072d..412acccd 100644
--- a/util/events.lua
+++ b/util/events.lua
@@ -45,6 +45,9 @@ function new()
if map then
map[handler] = nil;
handlers[event] = nil;
+ if next(map) == nil then
+ event_map[event] = nil;
+ end
end
end;
local function add_handlers(handlers)