Mercurial > prosody-wiki
changeset 47:5012ffd5d569
Edited wiki page through web user interface.
author | florob@babelmonkeys.de |
---|---|
date | Sat, 10 Oct 2009 23:34:11 +0000 |
parents | 3a1b652bb12d |
children | 874161e36952 |
files | mod_adhoc.wiki |
diffstat | 1 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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||