Software /
code /
prosody
Changeset
3486:8a46bb70016f
mod_ping: Add ad-hoc command
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Thu, 02 Sep 2010 21:57:49 +0200 |
parents | 3485:3eee60c6a436 |
children | 3487:b5c92275910b |
files | plugins/mod_ping.lua |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_ping.lua Wed Sep 01 22:46:35 2010 +0200 +++ b/plugins/mod_ping.lua Thu Sep 02 21:57:49 2010 +0200 @@ -19,3 +19,15 @@ module:hook("iq/bare/urn:xmpp:ping:ping", ping_handler); module:hook("iq/host/urn:xmpp:ping:ping", ping_handler); + +-- Ad-hoc command + +function ping_command_handler (self, data, state) + local now = os.date("%Y-%m-%dT%X"); + return { info = "Pong\n"..now, status = "completed" }; +end + +local adhoc_new = module:require "adhoc".new; +local descriptor = adhoc_new("Ping", "ping", ping_command_handler); +module:add_item ("adhoc", descriptor); +