plugins.ping: Add ping plugin to XMPP ping a JID

Sun, 20 Dec 2009 21:33:55 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 20 Dec 2009 21:33:55 +0000
changeset 32
391048601d54
parent 31
f1e9d1d7cf5d
child 33
4581b2e61429

plugins.ping: Add ping plugin to XMPP ping a JID

plugins/ping.lua file | annotate | diff | comparison | revisions
--- /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