Mercurial > prosody-modules
comparison mod_pinger/mod_pinger.lua @ 2671:80b6c63cb559
mod_pinger: Fix hardcoded smacks namespace, fixes #712
| author | tmolitor <thilo@eightysoft.de> |
|---|---|
| date | Thu, 06 Apr 2017 02:31:16 +0200 |
| parents | 256a5e3591db |
| children | 75ab061069aa |
comparison
equal
deleted
inserted
replaced
| 2670:6e01878103c0 | 2671:80b6c63cb559 |
|---|---|
| 13 | 13 |
| 14 function check_session(watchdog) | 14 function check_session(watchdog) |
| 15 local session = watchdog.session; | 15 local session = watchdog.session; |
| 16 if not session.idle_pinged then | 16 if not session.idle_pinged then |
| 17 session.idle_pinged = true; | 17 session.idle_pinged = true; |
| 18 if session.smacks and not session.awaiting_ack then | 18 if session.smacks and not session.awaiting_ack then |
| 19 session.send(st.stanza("r", { xmlns = "urn:xmpp:sm:2" })) -- TODO: hardcoded sm:2 | 19 session.send(st.stanza("r", { xmlns = session.smacks })) |
| 20 else | 20 else |
| 21 session.send(st.iq({ type = "get", from = module.host, id = "idle-check" }) | 21 session.send(st.iq({ type = "get", from = module.host, id = "idle-check" }) |
| 22 :tag("ping", { xmlns = "urn:xmpp:ping" })); | 22 :tag("ping", { xmlns = "urn:xmpp:ping" })); |
| 23 end | 23 end |
| 24 return ping_timeout; -- Call us again after ping_timeout | 24 return ping_timeout; -- Call us again after ping_timeout |
| 25 else | 25 else |
| 26 module:log("info", "Client %q silent for too long, closing...", session.full_jid); | 26 module:log("info", "Client %q silent for too long, closing...", session.full_jid); |
| 27 session:close("connection-timeout"); | 27 session:close("connection-timeout"); |
| 28 end | 28 end |
