Mercurial > prosody-modules
diff mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua @ 37:6018c0370d89
merge
author | Thilo Cestonaro <thilo@cestona.ro> |
---|---|
date | Mon, 12 Oct 2009 23:09:21 +0200 |
parents | 58d326d86a9a |
children | 9b63fd1196c0 |
line wrap: on
line diff
--- a/mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua Mon Oct 12 23:08:43 2009 +0200 +++ b/mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua Mon Oct 12 23:09:21 2009 +0200 @@ -5,15 +5,15 @@ -- local st = require "util.stanza"; +local adhoc_new = module:require "adhoc".new; function ping_command_handler (item, origin, stanza) local now = os.date("%Y-%m-%dT%X"); - origin.send(st.reply(stanza):tag("command", {xmlns="http://jabber.org/protocol/commands", status="completed", node=item.node, sessionid=now}) - :tag("note", {type="info"}):text("Pong\n" .. now)); + origin.send(st.reply(stanza):add_child(item:cmdtag("completed", now):tag("note", {type="info"}):text("Pong\n" .. now))); return true; end -local descriptor = { name="Ping", node="ping", handler=ping_command_handler }; +local descriptor = adhoc_new("Ping", "ping", ping_command_handler); function module.unload() module:remove_item("adhoc", descriptor);