mirror of
https://github.com/bjc/prosody.git
synced 2025-04-06 14:47:37 +03:00
mod_ping: Add ad-hoc command
This commit is contained in:
parent
15afe113cb
commit
c6e47138c4
1 changed files with 12 additions and 0 deletions
|
@ -19,3 +19,15 @@ end
|
|||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue