Software /
code /
verse
Comparison
plugins/ping.lua @ 380:0891b4e27766
Discard trailing whitespace
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 May 2015 23:27:29 +0200 |
parent | 339:72fbfb0367e9 |
child | 393:69229fa1d24f |
comparison
equal
deleted
inserted
replaced
379:d80d27234e38 | 380:0891b4e27766 |
---|---|
3 local xmlns_ping = "urn:xmpp:ping"; | 3 local xmlns_ping = "urn:xmpp:ping"; |
4 | 4 |
5 function verse.plugins.ping(stream) | 5 function verse.plugins.ping(stream) |
6 function stream:ping(jid, callback) | 6 function stream:ping(jid, callback) |
7 local t = socket.gettime(); | 7 local t = socket.gettime(); |
8 stream:send_iq(verse.iq{ to = jid, type = "get" }:tag("ping", { xmlns = xmlns_ping }), | 8 stream:send_iq(verse.iq{ to = jid, type = "get" }:tag("ping", { xmlns = xmlns_ping }), |
9 function (reply) | 9 function (reply) |
10 if reply.attr.type == "error" then | 10 if reply.attr.type == "error" then |
11 local type, condition, text = reply:get_error(); | 11 local type, condition, text = reply:get_error(); |
12 if condition ~= "service-unavailable" and condition ~= "feature-not-implemented" then | 12 if condition ~= "service-unavailable" and condition ~= "feature-not-implemented" then |
13 callback(nil, jid, { type = type, condition = condition, text = text }); | 13 callback(nil, jid, { type = type, condition = condition, text = text }); |