Diff

plugins/ping.lua @ 399:82ad158714e5

Merge with Zash
author Matthew Wild <mwild1@gmail.com>
date Tue, 12 Jan 2016 13:14:36 +0000
parent 393:69229fa1d24f
child 457:73d4eb93657b
line wrap: on
line diff
--- a/plugins/ping.lua	Sat Jan 09 11:03:30 2016 +0000
+++ b/plugins/ping.lua	Tue Jan 12 13:14:36 2016 +0000
@@ -1,11 +1,12 @@
 local verse = require "verse";
+local gettime = require"socket".gettime;
 
 local xmlns_ping = "urn:xmpp:ping";
 
 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 }), 
+		local t = gettime();
+		stream:send_iq(verse.iq{ to = jid, type = "get" }:tag("ping", { xmlns = xmlns_ping }),
 			function (reply)
 				if reply.attr.type == "error" then
 					local type, condition, text = reply:get_error();
@@ -14,7 +15,7 @@
 						return;
 					end
 				end
-				callback(socket.gettime()-t, jid);
+				callback(gettime()-t, jid);
 			end);
 	end
 	stream:hook("iq/"..xmlns_ping, function(stanza)