plugins/ping.lua

changeset 32
391048601d54
child 34
dd5899412e3f
--- /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

mercurial