Mercurial > prosody-wiki
diff mod_adhoc.wiki @ 127:040360195e00
More documentation
author | florob@babelmonkeys.de |
---|---|
date | Thu, 29 Apr 2010 21:28:11 +0000 |
parents | 039a141a9c03 |
children | d7a9f3c69e49 |
line wrap: on
line diff
--- a/mod_adhoc.wiki Tue Apr 13 14:50:37 2010 +0000 +++ b/mod_adhoc.wiki Thu Apr 29 21:28:11 2010 +0000 @@ -22,7 +22,6 @@ If you want to build your own adhoc command, just register your adhoc command module with module:add_item and a descriptor for your command. -E.g. A descriptor can be created like this: {{{ local adhoc_new = module:require "adhoc".new; @@ -30,6 +29,28 @@ module:add_item ("adhoc", descriptor) }}} +A handler gets 2 parameters. A data table and a state. + +The data table has 4 fields: +||to||The to attribute of the stanza to be handled|| +||from||The from attribute of the stanza to be handled|| +||action||The action to be performed as specified in the stanza to be handled|| +||form||If the to be handled stanza contains a form this will contains the form element|| + +The handler should return to items. A data table and a state. +The state will be saved and passed to the handler on any adhoc stanza with the same sessionid. + +The returned table can have the following fields: +||*Name*||*Explanation*||*Required?*|| +||status||Status of the command (One of: completed, canceled, error)||yes|| +||error||A table with the fields "type", "condition" and "message"||if status is "error"|| +||info||Informational info for the user||no|| +||warn||A warning for the user||no|| +||actions||The actions avaiable to the client||no|| +||form||A form to be filled out by the user||no|| +||result||A form of type result to be presented to the user||no|| +||other||Any other XML to be included in the response to the user||no|| + For a simple module and details have a look at mod_adhoc_cmd_ping. = Compatibility =