# HG changeset patch # User "Georg Lukas " # Date 1360501760 -3600 # Node ID 16cdeb9cd879e13d064676638e1c13f7c52f6503 # Parent 5ad042476235b688c08ff5ac378f00ffd143ad6e Add clix module to send XMPP pings to JIDs Signed-off-by: Georg Lukas diff -r 5ad042476235 -r 16cdeb9cd879 clix/ping.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clix/ping.lua Sun Feb 10 14:09:20 2013 +0100 @@ -0,0 +1,24 @@ +return function (opts, arg) + if opts.short_help then + print("Measure the round-trip latency time of a given JID"); + return; + end + if #arg == 0 or opts.help then + return 0; + end + local conn; + local function on_reply(time, jid, reply) + if time then + print(string.format("%s latency: %1.3fs", jid, time)); + else + print("Error requesting ping ("..(reply.condition or "unknown")..")"..(reply.text and (": "..reply.text) or "")); + end + conn:close(); + end + local function on_connect(_conn) + conn = _conn; + conn:add_plugin("ping"); + conn:ping(arg[1], on_reply); + end + clix_connect(opts, on_connect); +end diff -r 5ad042476235 -r 16cdeb9cd879 squishy --- a/squishy Mon Aug 27 00:13:02 2012 +0200 +++ b/squishy Sun Feb 10 14:09:20 2013 +0100 @@ -2,6 +2,7 @@ "send"; "receive"; "version"; + "ping"; "bounce"; "mirror"; "raw";