mod_adhoc_cmd_ping/mod_adhoc_cmd_ping.lua
changeset 7 473b14c59797
child 9 2be8bcce5b18
equal deleted inserted replaced
6:d497d5df360d 7:473b14c59797
       
     1 -- Copyright (C) 2009 Thilo Cestonaro
       
     2 -- 
       
     3 -- This file is MIT/X11 licensed. Please see the
       
     4 -- COPYING file in the source package for more information.
       
     5 --
       
     6 
       
     7 local st = require "util.stanza";
       
     8 
       
     9 function ping_command_handler (item, origin, stanza)
       
    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})
       
    12 		:tag("note", {type="info"}):text(item.name));
       
    13 	return true;
       
    14 end
       
    15 
       
    16 module:add_item ("adhoc", { name="Ping", node="ping", handler=ping_command_handler });