comparison mod_adhoc.wiki @ 127:040360195e00

More documentation
author florob@babelmonkeys.de
date Thu, 29 Apr 2010 21:28:11 +0000
parents 039a141a9c03
children d7a9f3c69e49
comparison
equal deleted inserted replaced
126:e61fe5ca5c47 127:040360195e00
20 mod_adhoc_cmd_ping. 20 mod_adhoc_cmd_ping.
21 21
22 If you want to build your own adhoc command, just register your adhoc command module with 22 If you want to build your own adhoc command, just register your adhoc command module with
23 module:add_item and a descriptor for your command. 23 module:add_item and a descriptor for your command.
24 24
25 E.g.
26 A descriptor can be created like this: 25 A descriptor can be created like this:
27 {{{ 26 {{{
28 local adhoc_new = module:require "adhoc".new; 27 local adhoc_new = module:require "adhoc".new;
29 local descriptor = adhoc_new("Name", "node", handler); 28 local descriptor = adhoc_new("Name", "node", handler);
30 module:add_item ("adhoc", descriptor) 29 module:add_item ("adhoc", descriptor)
31 }}} 30 }}}
32 31
32 A handler gets 2 parameters. A data table and a state.
33
34 The data table has 4 fields:
35 ||to||The to attribute of the stanza to be handled||
36 ||from||The from attribute of the stanza to be handled||
37 ||action||The action to be performed as specified in the stanza to be handled||
38 ||form||If the to be handled stanza contains a form this will contains the form element||
39
40 The handler should return to items. A data table and a state.
41 The state will be saved and passed to the handler on any adhoc stanza with the same sessionid.
42
43 The returned table can have the following fields:
44 ||*Name*||*Explanation*||*Required?*||
45 ||status||Status of the command (One of: completed, canceled, error)||yes||
46 ||error||A table with the fields "type", "condition" and "message"||if status is "error"||
47 ||info||Informational info for the user||no||
48 ||warn||A warning for the user||no||
49 ||actions||The actions avaiable to the client||no||
50 ||form||A form to be filled out by the user||no||
51 ||result||A form of type result to be presented to the user||no||
52 ||other||Any other XML to be included in the response to the user||no||
53
33 For a simple module and details have a look at mod_adhoc_cmd_ping. 54 For a simple module and details have a look at mod_adhoc_cmd_ping.
34 55
35 = Compatibility = 56 = Compatibility =
36 ||trunk||Works|| 57 ||trunk||Works||
37 ||0.6||Most commands work|| 58 ||0.6||Most commands work||