Software /
code /
prosody
Comparison
core/modulemanager.lua @ 4893:98ff89ab5d1d
moduleapi, modulemanager: Re-structure module.event_handlers so that the same handler can harmlessly handle multiple events (thanks Zash)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 18 May 2012 23:53:02 +0100 |
parent | 4883:b798d59919b1 |
child | 4896:27cda15104f2 |
comparison
equal
deleted
inserted
replaced
4892:6c8074f47ca4 | 4893:98ff89ab5d1d |
---|---|
89 if (not ok) and err then | 89 if (not ok) and err then |
90 log("warn", "Non-fatal error unloading module '%s' on '%s': %s", name, host, err); | 90 log("warn", "Non-fatal error unloading module '%s' on '%s': %s", name, host, err); |
91 end | 91 end |
92 end | 92 end |
93 | 93 |
94 for handler, event in pairs(mod.module.event_handlers) do | 94 for event, data in pairs(mod.module.event_handlers) do |
95 event.object.remove_handler(event.name, handler); | 95 data.object.remove_handler(event, data.handler); |
96 end | 96 end |
97 | 97 |
98 if mod.module.items then -- remove items | 98 if mod.module.items then -- remove items |
99 local events = (host == "*" and prosody.events) or hosts[host].events; | 99 local events = (host == "*" and prosody.events) or hosts[host].events; |
100 for key,t in pairs(mod.module.items) do | 100 for key,t in pairs(mod.module.items) do |