Comparison

core/modulemanager.lua @ 2828:fbddc3ed0d09

modulemanager: Fire item-removed events on module unload.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 10 Dec 2009 03:02:04 +0500
parent 2072:464a5392bc80
child 2923:b7049746bd29
comparison
equal deleted inserted replaced
2827:b9df83793d84 2828:fbddc3ed0d09
195 for handler in pairs(handlers or NULL) do 195 for handler in pairs(handlers or NULL) do
196 (hosts[host] or prosody).events.remove_handler(event, handler); 196 (hosts[host] or prosody).events.remove_handler(event, handler);
197 end 197 end
198 end 198 end
199 hooks:remove(host, name); 199 hooks:remove(host, name);
200 if mod.module.items then -- remove items
201 for key,t in pairs(mod.module.items) do
202 for i = #t,1,-1 do
203 local value = t[i];
204 t[i] = nil;
205 hosts[host].events.fire_event("item-removed/"..key, {source = self, item = value});
206 end
207 end
208 end
200 modulemap[host][name] = nil; 209 modulemap[host][name] = nil;
201 return true; 210 return true;
202 end 211 end
203 212
204 function reload(host, name, ...) 213 function reload(host, name, ...)