Software /
code /
prosody
Comparison
core/modulemanager.lua @ 2350:443e388988e7
modulemanager: Fire item-removed events on module unload.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 10 Dec 2009 03:02:04 +0500 |
parent | 2349:e0d9f4000d6b |
child | 2479:9c074ba1f662 |
comparison
equal
deleted
inserted
replaced
2349:e0d9f4000d6b | 2350:443e388988e7 |
---|---|
198 for handler in pairs(handlers or NULL) do | 198 for handler in pairs(handlers or NULL) do |
199 (hosts[host] or prosody).events.remove_handler(event, handler); | 199 (hosts[host] or prosody).events.remove_handler(event, handler); |
200 end | 200 end |
201 end | 201 end |
202 hooks:remove(host, name); | 202 hooks:remove(host, name); |
203 if mod.module.items then -- remove items | |
204 for key,t in pairs(mod.module.items) do | |
205 for i = #t,1,-1 do | |
206 local value = t[i]; | |
207 t[i] = nil; | |
208 hosts[host].events.fire_event("item-removed/"..key, {source = self, item = value}); | |
209 end | |
210 end | |
211 end | |
203 modulemap[host][name] = nil; | 212 modulemap[host][name] = nil; |
204 hosts[host].events.fire_event("module-unloaded", { module = name, host = host }); | 213 hosts[host].events.fire_event("module-unloaded", { module = name, host = host }); |
205 return true; | 214 return true; |
206 end | 215 end |
207 | 216 |