equal
deleted
inserted
replaced
5 -- |
5 -- |
6 |
6 |
7 local st = require "util.stanza"; |
7 local st = require "util.stanza"; |
8 |
8 |
9 function ping_command_handler (item, origin, stanza) |
9 function ping_command_handler (item, origin, stanza) |
10 local now = os.date("%Y-%m-%dT%X") |
10 local now = os.date("%Y-%m-%dT%X"); |
11 origin.send(st.reply(stanza):tag("command", {xmlns="http://jabber.org/protocol/commands", status="completed", node=item.node, sessionid=now}) |
11 origin.send(st.reply(stanza):tag("command", {xmlns="http://jabber.org/protocol/commands", status="completed", node=item.node, sessionid=now}) |
12 :tag("note", {type="info"}):text(item.name)); |
12 :tag("note", {type="info"}):text("Pong\n" .. now)); |
13 return true; |
13 return true; |
14 end |
14 end |
15 |
15 |
16 module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler }); |
16 local descriptor = { name="Ping", node="ping", handler=ping_command_handler }; |
|
17 |
|
18 function module.unload() |
|
19 module:log("debug", "Removing ping command"); |
|
20 module:remove_item("adhoc", descriptor); |
|
21 end |
|
22 |
|
23 module:add_item ("adhoc", descriptor); |
|
24 |