view mod_adhoc.wiki @ 49:4bc6fd5d8fcc

Just used the text from the XEP; it's said in a more understandable way.
author t.ephraim
date Mon, 12 Oct 2009 14:55:54 +0000
parents 5012ffd5d569
children 039a141a9c03
line wrap: on
line source

#summary XEP-0050: Ad-Hoc Commands
#labels Stage-Beta

= Introduction =

implementation of [http://xmpp.org/extensions/xep-0050.html XEP-0050: Ad-Hoc Commands].



= Details =

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.
{{{
module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler });
}}}

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||
||0.5.2||Works||