Software / code / verse
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 31:f1e9d1d7cf5d | 32:391048601d54 |
|---|---|
| 1 | |
| 2 function verse.plugins.ping(stream) | |
| 3 function stream:ping(jid, callback) | |
| 4 local t = socket.gettime(); | |
| 5 stream:send_iq(verse.iq{ to = jid, type = "get" }:tag("ping", { xmlns = xmlns_ping }), | |
| 6 function (reply) | |
| 7 callback(socket.gettime()-t, jid); | |
| 8 end); | |
| 9 end | |
| 10 end |