Mercurial > prosody-wiki
annotate mod_adhoc.wiki @ 287:1a00ae04a358
Added an example of how to generate your client side certificate with a id-on-xmppAddr field, thanks to Zash for the cnf file.
author | thijsalkemade@gmail.com |
---|---|
date | Sun, 10 Jun 2012 11:08:09 +0000 |
parents | 84cd497e50ff |
children | c929df198f10 |
rev | line source |
---|---|
10 | 1 #summary XEP-0050: Ad-Hoc Commands |
33 | 2 #labels Stage-Beta |
9 | 3 |
4 = Introduction = | |
5 | |
156 | 6 implementation of [http://xmpp.org/extensions/xep-0050.html XEP-0050: Ad-Hoc Commands], which allows clients to execute commands on the Prosody server. This plugin adds no commands itself, see the other `mod_adhoc_*` plugins for those. |
9 | 7 |
155
7aa92b889524
Expand introduction and note that this plugin is not needed for 0.8+
MWild1
parents:
133
diff
changeset
|
8 This module along with the other adhoc modules in prosody-modules are included in Prosody as of 0.8, making this plugin unnecessary for users of this version and later. |
9 | 9 |
10 = Details = | |
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 | 13 |
14 | |
15 | |
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 | 19 Load mod_adhoc and then any module which provides an adhoc command, such as |
20 mod_adhoc_cmd_ping. | |
21 | |
22 If you want to build your own adhoc command, just register your adhoc command module with | |
108 | 23 module:add_item and a descriptor for your command. |
9 | 24 |
108 | 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 | 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|| | |
157 | 38 ||form||If the to be handled stanza contains a form this will contain the form element|| |
127 | 39 |
157 | 40 The handler should return two items. A data table and a state. |
41 The state will be saved and passed to the handler on invocation for any adhoc stanza with the same sessionid. If a session has ended the state returned should be nil. | |
127 | 42 |
43 The returned table can have the following fields: | |
44 ||*Name*||*Explanation*||*Required?*|| | |
157 | 45 ||status||Status of the command (One of: "completed", "canceled", "error")||yes|| |
46 ||error||A table with the fields "type", "condition" and "message"||when status is "error"|| | |
47 ||info||Informational text for display to the user||no|| | |
127 | 48 ||warn||A warning for the user||no|| |
49 ||actions||The actions avaiable to the client||no|| | |
157 | 50 ||form||A dataform to be filled out by the user||no|| |
51 ||result||A dataform of type result to be presented to the user||no|| | |
127 | 52 ||other||Any other XML to be included in the response to the user||no|| |
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 | 55 |
24 | 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|| |