diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-12-10 05:45:07 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-12-10 05:45:07 +0000 |
commit | 77135ff9c038d029b2ebe9f274ce8cb14b8b5d3d (patch) | |
tree | 1d714f798e06a2f2127ff9c8813dcb4359451368 | |
parent | a2f97afa0c57587b77bff3819d04aa694bc60db3 (diff) | |
download | prosody-77135ff9c038d029b2ebe9f274ce8cb14b8b5d3d.tar.gz prosody-77135ff9c038d029b2ebe9f274ce8cb14b8b5d3d.zip |
mod_adhoc: Use module:handle_items()
-rw-r--r-- | plugins/adhoc/mod_adhoc.lua | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/plugins/adhoc/mod_adhoc.lua b/plugins/adhoc/mod_adhoc.lua index 6d826338..49d07103 100644 --- a/plugins/adhoc/mod_adhoc.lua +++ b/plugins/adhoc/mod_adhoc.lua @@ -90,19 +90,13 @@ module:hook("iq/host/"..xmlns_cmd..":command", function (event) end end, 500); -local function handle_item_added(item) +local function adhoc_added(event) + local item = event.item; commands[item.node] = item; end -module:hook("item-added/adhoc", function (event) - return handle_item_added(event.item); -end, 500); - -module:hook("item-removed/adhoc", function (event) +local function adhoc_removed(event) commands[event.item.node] = nil; -end, 500); - --- Pick up any items that are already added -for _, item in ipairs(module:get_host_items("adhoc")) do - handle_item_added(item); end + +module:handle_items("adhoc", adhoc_added, adhoc_removed); |