# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1261344835 0
# Node ID 391048601d54f3305001ace0e0274b18779abdba
# Parent  f1e9d1d7cf5d1a52f2382e6c01d538925747b373
plugins.ping: Add ping plugin to XMPP ping a JID

diff -r f1e9d1d7cf5d -r 391048601d54 plugins/ping.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/ping.lua	Sun Dec 20 21:33:55 2009 +0000
@@ -0,0 +1,10 @@
+
+function verse.plugins.ping(stream)
+	function stream:ping(jid, callback)
+		local t = socket.gettime();
+		stream:send_iq(verse.iq{ to = jid, type = "get" }:tag("ping", { xmlns = xmlns_ping }), 
+			function (reply)
+				callback(socket.gettime()-t, jid);
+			end);
+	end
+end