Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/core/modulemanager.lua Thu Dec 10 02:50:23 2009 +0500 +++ b/core/modulemanager.lua Thu Dec 10 03:02:04 2009 +0500 @@ -197,6 +197,15 @@ end end hooks:remove(host, name); + if mod.module.items then -- remove items + for key,t in pairs(mod.module.items) do + for i = #t,1,-1 do + local value = t[i]; + t[i] = nil; + hosts[host].events.fire_event("item-removed/"..key, {source = self, item = value}); + end + end + end modulemap[host][name] = nil; return true; end