Mercurial > prosody-modules
comparison mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua @ 121:a9898f13c89e
mod_adhoc: Major refactoring. Actuall data exchange happens here now
mod_adhoc_cmd_*: Update to work with aforementioned change
| author | Florian Zeitz <florob@babelmonkeys.de> |
|---|---|
| date | Fri, 22 Jan 2010 04:25:58 +0100 |
| parents | 9b63fd1196c0 |
| children | 843cadf36306 |
comparison
equal
deleted
inserted
replaced
| 120:7a2d33e8ad1f | 121:a9898f13c89e |
|---|---|
| 5 -- | 5 -- |
| 6 | 6 |
| 7 local st = require "util.stanza"; | 7 local st = require "util.stanza"; |
| 8 local adhoc_new = module:require "adhoc".new; | 8 local adhoc_new = module:require "adhoc".new; |
| 9 | 9 |
| 10 function ping_command_handler (item, origin, stanza) | 10 function ping_command_handler (self, data, sessid) |
| 11 local now = os.date("%Y-%m-%dT%X"); | 11 local now = os.date("%Y-%m-%dT%X"); |
| 12 origin.send(st.reply(stanza):add_child(item:cmdtag("completed", now):tag("note", {type="info"}):text("Pong\n" .. now))); | 12 return { info = "Pong\n"..now, status = "completed" }, now; |
| 13 return true; | |
| 14 end | 13 end |
| 15 | 14 |
| 16 local descriptor = adhoc_new("Ping", "ping", ping_command_handler); | 15 local descriptor = adhoc_new("Ping", "ping", ping_command_handler); |
| 17 | 16 |
| 18 module:add_item ("adhoc", descriptor); | 17 module:add_item ("adhoc", descriptor); |
