Comparison

plugins/mod_ping.lua @ 3486:8a46bb70016f

mod_ping: Add ad-hoc command
author Florian Zeitz <florob@babelmonkeys.de>
date Thu, 02 Sep 2010 21:57:49 +0200
parent 2923:b7049746bd29
child 4129:c86b68abe12e
comparison
equal deleted inserted replaced
3485:3eee60c6a436 3486:8a46bb70016f
17 end 17 end
18 end 18 end
19 19
20 module:hook("iq/bare/urn:xmpp:ping:ping", ping_handler); 20 module:hook("iq/bare/urn:xmpp:ping:ping", ping_handler);
21 module:hook("iq/host/urn:xmpp:ping:ping", ping_handler); 21 module:hook("iq/host/urn:xmpp:ping:ping", ping_handler);
22
23 -- Ad-hoc command
24
25 function ping_command_handler (self, data, state)
26 local now = os.date("%Y-%m-%dT%X");
27 return { info = "Pong\n"..now, status = "completed" };
28 end
29
30 local adhoc_new = module:require "adhoc".new;
31 local descriptor = adhoc_new("Ping", "ping", ping_command_handler);
32 module:add_item ("adhoc", descriptor);
33