diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-12-10 03:02:04 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-12-10 03:02:04 +0500 |
commit | 2f8bd04c9ca0fbbc40b1f9630816f3976e6754df (patch) | |
tree | 9a3afc1ab5b42d248b38afa61c8aa28467a6bb49 | |
parent | b62a35519f8f76f702a504cbb28d63647c93745a (diff) | |
download | prosody-2f8bd04c9ca0fbbc40b1f9630816f3976e6754df.tar.gz prosody-2f8bd04c9ca0fbbc40b1f9630816f3976e6754df.zip |
modulemanager: Fire item-removed events on module unload.
-rw-r--r-- | core/modulemanager.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 9cd56187..ecb1bc6c 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -197,6 +197,15 @@ function unload(host, name, ...) 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 |