aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-06-11 13:23:10 +0100
committerMatthew Wild <mwild1@gmail.com>2010-06-11 13:23:10 +0100
commit3bc4f15db0c64106ad2c268a5f9601bc7033d6f0 (patch)
tree2647fd5d1b511e8b6af9ed7a00b42c13e15475c9 /plugins
parentbe24b569b04c8c1b940de279584f6be2c69776f0 (diff)
downloadprosody-3bc4f15db0c64106ad2c268a5f9601bc7033d6f0.tar.gz
prosody-3bc4f15db0c64106ad2c268a5f9601bc7033d6f0.zip
mod_adhoc: Scan through list of items on load, in case items have been added before we were loaded
Diffstat (limited to 'plugins')
-rw-r--r--plugins/adhoc/mod_adhoc.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/adhoc/mod_adhoc.lua b/plugins/adhoc/mod_adhoc.lua
index 6a5165ed..6f91a61b 100644
--- a/plugins/adhoc/mod_adhoc.lua
+++ b/plugins/adhoc/mod_adhoc.lua
@@ -58,10 +58,19 @@ module:hook("iq/host", function (event)
end
end, 500);
+local function handle_item_added(item)
+ commands[item.node] = item;
+end
+
module:hook("item-added/adhoc", function (event)
- commands[event.item.node] = event.item;
+ return handle_item_added(event.item);
end, 500);
module:hook("item-removed/adhoc", function (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