# HG changeset patch # User florob@babelmonkeys.de # Date 1255217651 0 # Node ID 5012ffd5d5691544b12a5ddb9160f39e5e2644f8 # Parent 3a1b652bb12dee6a1aaf0a1dcfc459eb34daafc7 Edited wiki page through web user interface. diff -r 3a1b652bb12d -r 5012ffd5d569 mod_adhoc.wiki --- a/mod_adhoc.wiki Fri Oct 09 21:26:34 2009 +0000 +++ b/mod_adhoc.wiki Sat Oct 10 23:34:11 2009 +0000 @@ -9,23 +9,38 @@ = Details = -It will offer any adhoc command which is registered with "module:add_item("adhoc", ....". +Will offer any adhoc command registered via 'module:add_item("adhoc", ....)'. = Usage = + +First copy (or symlink) the directory "adhoc" which contains mod_adhoc to your plugins directory. Load mod_adhoc and then any module which provides an adhoc command, such as mod_adhoc_cmd_ping. If you want to build your own adhoc command, just register your adhoc command module with module:add_item and a dictonary with name, node and a handler. -e.g. +E.g. {{{ module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler }); }}} -Or have a look into mod_adhoc_cmd_ping for better details. +Such a dictionary can be created for you using functionality provided by mod_adhoc like this: +{{{ +local adhoc_new = module:require "adhoc".new; +local descriptor = adhoc_new("Name", "node", handler); +module:add_item ("adhoc", descriptor) +}}} +This will additionally grant you the possibility to use +{{{ +desc:cmdtag(status, sessionID, action) +}}} +to create a new command tag from within your handler. +In this example desc is the first parameter to your handler. + +For a simple module and details have a look at mod_adhoc_cmd_ping. = Compatibility = ||0.6||Works||