annotate mod_adhoc.wiki @ 149:4616d70c974a

Edited wiki page through web user interface.
author shinysky1986@gmail.com
date Fri, 13 Aug 2010 13:24:32 +0000
parents d7a9f3c69e49
children 7aa92b889524
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
eabbd329830c Edited wiki page through web user interface.
t.ephraim
parents: 9
diff changeset
1 #summary XEP-0050: Ad-Hoc Commands
33
ecb2ae0bbeea Edited wiki page through web user interface.
t.ephraim
parents: 24
diff changeset
2 #labels Stage-Beta
9
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
3
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
4 = Introduction =
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
5
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
6 implementation of [http://xmpp.org/extensions/xep-0050.html XEP-0050: Ad-Hoc Commands].
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
7
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
8
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
9
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
10 = Details =
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
11
47
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
12 Will offer any adhoc command registered via 'module:add_item("adhoc", ....)'.
9
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
13
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
14
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
15
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
16 = Usage =
47
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
17
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
18 First copy (or symlink) the directory "adhoc" which contains mod_adhoc to your plugins directory.
9
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
19 Load mod_adhoc and then any module which provides an adhoc command, such as
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
20 mod_adhoc_cmd_ping.
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
21
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
22 If you want to build your own adhoc command, just register your adhoc command module with
108
039a141a9c03 Update to reflect module rework.
florob@babelmonkeys.de
parents: 47
diff changeset
23 module:add_item and a descriptor for your command.
9
8739493ced0d Created wiki page through web user interface.
t.ephraim
parents:
diff changeset
24
108
039a141a9c03 Update to reflect module rework.
florob@babelmonkeys.de
parents: 47
diff changeset
25 A descriptor can be created like this:
47
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
26 {{{
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
27 local adhoc_new = module:require "adhoc".new;
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
28 local descriptor = adhoc_new("Name", "node", handler);
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
29 module:add_item ("adhoc", descriptor)
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
30 }}}
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
31
127
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
32 A handler gets 2 parameters. A data table and a state.
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
33
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
34 The data table has 4 fields:
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
35 ||to||The to attribute of the stanza to be handled||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
36 ||from||The from attribute of the stanza to be handled||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
37 ||action||The action to be performed as specified in the stanza to be handled||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
38 ||form||If the to be handled stanza contains a form this will contains the form element||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
39
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
40 The handler should return to items. A data table and a state.
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
41 The state will be saved and passed to the handler on any adhoc stanza with the same sessionid.
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
42
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
43 The returned table can have the following fields:
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
44 ||*Name*||*Explanation*||*Required?*||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
45 ||status||Status of the command (One of: completed, canceled, error)||yes||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
46 ||error||A table with the fields "type", "condition" and "message"||if status is "error"||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
47 ||info||Informational info for the user||no||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
48 ||warn||A warning for the user||no||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
49 ||actions||The actions avaiable to the client||no||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
50 ||form||A form to be filled out by the user||no||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
51 ||result||A form of type result to be presented to the user||no||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
52 ||other||Any other XML to be included in the response to the user||no||
040360195e00 More documentation
florob@babelmonkeys.de
parents: 108
diff changeset
53
47
5012ffd5d569 Edited wiki page through web user interface.
florob@babelmonkeys.de
parents: 33
diff changeset
54 For a simple module and details have a look at mod_adhoc_cmd_ping.
12
3ff19e27dacb Edited wiki page through web user interface.
t.ephraim
parents: 10
diff changeset
55
24
c09b888b8ceb Added compatibility section
MWild1
parents: 12
diff changeset
56 = Compatibility =
133
d7a9f3c69e49 Add that the plugin has been included for Prosody 0.8
MWild1
parents: 127
diff changeset
57 ||0.6||Most commands work||
d7a9f3c69e49 Add that the plugin has been included for Prosody 0.8
MWild1
parents: 127
diff changeset
58 ||0.7||Works||
d7a9f3c69e49 Add that the plugin has been included for Prosody 0.8
MWild1
parents: 127
diff changeset
59 ||0.8||Included in Prosody||