mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua
changeset 121 a9898f13c89e
parent 109 9b63fd1196c0
child 124 843cadf36306
--- a/mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua	Fri Jan 15 10:17:57 2010 +0100
+++ b/mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua	Fri Jan 22 04:25:58 2010 +0100
@@ -7,10 +7,9 @@
 local st = require "util.stanza";
 local adhoc_new = module:require "adhoc".new;
 
-function ping_command_handler (item, origin, stanza)
+function ping_command_handler (self, data, sessid)
 	local now = os.date("%Y-%m-%dT%X");
-	origin.send(st.reply(stanza):add_child(item:cmdtag("completed", now):tag("note", {type="info"}):text("Pong\n" .. now)));
-	return true;
+	return { info = "Pong\n"..now, status = "completed" }, now;
 end
 
 local descriptor = adhoc_new("Ping", "ping", ping_command_handler);