# HG changeset patch
# User Thilo Cestonaro <thilo@cestona.ro>
# Date 1253889143 -7200
# Node ID 473b14c597976f63b74c1417d4efa5fa4668be56
# Parent  d497d5df360d47e625c4c31877d21cbebf947ac1
adds mod_adhoc_cmd_ping which provides 'ping' adhoc command.

diff -r d497d5df360d -r 473b14c59797 mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua	Fri Sep 25 16:32:23 2009 +0200
@@ -0,0 +1,16 @@
+-- Copyright (C) 2009 Thilo Cestonaro
+-- 
+-- This file is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
+--
+
+local st = require "util.stanza";
+
+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(item.name));
+	return true;
+end
+
+module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler });