Mercurial > prosody-wiki
comparison mod_adhoc.wiki @ 108:039a141a9c03
Update to reflect module rework.
author | florob@babelmonkeys.de |
---|---|
date | Fri, 22 Jan 2010 15:10:13 +0000 |
parents | 5012ffd5d569 |
children | 040360195e00 |
comparison
equal
deleted
inserted
replaced
107:958865cc13b3 | 108:039a141a9c03 |
---|---|
18 First copy (or symlink) the directory "adhoc" which contains mod_adhoc to your plugins directory. | 18 First copy (or symlink) the directory "adhoc" which contains mod_adhoc to your plugins directory. |
19 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 |
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 dictonary with name, node and a handler. | 23 module:add_item and a descriptor for your command. |
24 | 24 |
25 E.g. | 25 E.g. |
26 {{{ | 26 A descriptor can be created like this: |
27 module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler }); | |
28 }}} | |
29 | |
30 Such a dictionary can be created for you using functionality provided by mod_adhoc like this: | |
31 {{{ | 27 {{{ |
32 local adhoc_new = module:require "adhoc".new; | 28 local adhoc_new = module:require "adhoc".new; |
33 local descriptor = adhoc_new("Name", "node", handler); | 29 local descriptor = adhoc_new("Name", "node", handler); |
34 module:add_item ("adhoc", descriptor) | 30 module:add_item ("adhoc", descriptor) |
35 }}} | 31 }}} |
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 | 32 |
43 For a simple module and details have a look at mod_adhoc_cmd_ping. | 33 For a simple module and details have a look at mod_adhoc_cmd_ping. |
44 | 34 |
45 = Compatibility = | 35 = Compatibility = |
46 ||0.6||Works|| | 36 ||trunk||Works|| |
47 ||0.5.2||Works|| | 37 ||0.6||Most commands work|| |