view mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua @ 7:473b14c59797

adds mod_adhoc_cmd_ping which provides 'ping' adhoc command.
author Thilo Cestonaro <>
date Fri, 25 Sep 2009 16:32:23 +0200
children 2be8bcce5b18
line wrap: on
line source

-- 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 ="%Y-%m-%dT%X")
	origin.send(st.reply(stanza):tag("command", {xmlns="", status="completed", node=item.node, sessionid=now})
		:tag("note", {type="info"}):text(;
	return true;

module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler });