aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/adhoc/mod_adhoc.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-04-29 02:10:55 +0100
committerMatthew Wild <mwild1@gmail.com>2012-04-29 02:10:55 +0100
commitbd5f9b8cbfd168a21141607218446222ab9d8642 (patch)
treee78baabff21e9b6fefaeef4a709098ca30b35922 /plugins/adhoc/mod_adhoc.lua
parent9b89441dd008a8b3fda12d9217ff6f9ba240df9a (diff)
parenta2055895d362fed58ff314820bb7fddd53e40436 (diff)
downloadprosody-bd5f9b8cbfd168a21141607218446222ab9d8642.tar.gz
prosody-bd5f9b8cbfd168a21141607218446222ab9d8642.zip
Merge 0.9->trunk
Diffstat (limited to 'plugins/adhoc/mod_adhoc.lua')
-rw-r--r--plugins/adhoc/mod_adhoc.lua16
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);