File

plugins/ping.lua @ 32:391048601d54

plugins.ping: Add ping plugin to XMPP ping a JID
author Matthew Wild <mwild1@gmail.com>
date Sun, 20 Dec 2009 21:33:55 +0000
child 34:dd5899412e3f
line wrap: on
line source


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