Mercurial > prosody-wiki
comparison mod_adhoc.wiki @ 47:5012ffd5d569
Edited wiki page through web user interface.
author | florob@babelmonkeys.de |
---|---|
date | Sat, 10 Oct 2009 23:34:11 +0000 |
parents | ecb2ae0bbeea |
children | 039a141a9c03 |
comparison
equal
deleted
inserted
replaced
46:3a1b652bb12d | 47:5012ffd5d569 |
---|---|
7 | 7 |
8 | 8 |
9 | 9 |
10 = Details = | 10 = Details = |
11 | 11 |
12 It will offer any adhoc command which is registered with "module:add_item("adhoc", ....". | 12 Will offer any adhoc command registered via 'module:add_item("adhoc", ....)'. |
13 | 13 |
14 | 14 |
15 | 15 |
16 = Usage = | 16 = Usage = |
17 | |
18 First copy (or symlink) the directory "adhoc" which contains mod_adhoc to your plugins directory. | |
17 Load mod_adhoc and then any module which provides an adhoc command, such as | 19 Load mod_adhoc and then any module which provides an adhoc command, such as |
18 mod_adhoc_cmd_ping. | 20 mod_adhoc_cmd_ping. |
19 | 21 |
20 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 |
21 module:add_item and a dictonary with name, node and a handler. | 23 module:add_item and a dictonary with name, node and a handler. |
22 | 24 |
23 e.g. | 25 E.g. |
24 {{{ | 26 {{{ |
25 module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler }); | 27 module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler }); |
26 }}} | 28 }}} |
27 | 29 |
28 Or have a look into mod_adhoc_cmd_ping for better details. | 30 Such a dictionary can be created for you using functionality provided by mod_adhoc like this: |
31 {{{ | |
32 local adhoc_new = module:require "adhoc".new; | |
33 local descriptor = adhoc_new("Name", "node", handler); | |
34 module:add_item ("adhoc", descriptor) | |
35 }}} | |
36 This will additionally grant you the possibility to use | |
37 {{{ | |
38 desc:cmdtag(status, sessionID, action) | |
39 }}} | |
40 to create a new command tag from within your handler. | |
41 In this example desc is the first parameter to your handler. | |
42 | |
43 For a simple module and details have a look at mod_adhoc_cmd_ping. | |
29 | 44 |
30 = Compatibility = | 45 = Compatibility = |
31 ||0.6||Works|| | 46 ||0.6||Works|| |
32 ||0.5.2||Works|| | 47 ||0.5.2||Works|| |