Mercurial > prosody-hg
diff plugins/adhoc/mod_adhoc.lua @ 4797:e239668aa6d2
Merge 0.9->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 29 Apr 2012 02:10:55 +0100 |
| parents | 15547fba1f09 |
| children | 58714123f600 |
line wrap: on
line diff
--- a/plugins/adhoc/mod_adhoc.lua Sun Apr 29 02:09:12 2012 +0100 +++ b/plugins/adhoc/mod_adhoc.lua Sun Apr 29 02:10:55 2012 +0100 @@ -90,19 +90,13 @@ 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); +end --- 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);
