comparison mod_smacks/mod_smacks.lua @ 4445:e13eb0f851c8

mod_smacks: Explicitly request ack when leaving CSI-inactive mode There may be a lot of unacked stanzas in the queue, might as well...
author Kim Alvefur <zash@zash.se>
date Tue, 16 Feb 2021 22:49:44 +0100
parents 2f5e52d67928
children 3d593b612e07
comparison
equal deleted inserted replaced
4444:2f5e52d67928 4445:e13eb0f851c8
1 -- XEP-0198: Stream Management for Prosody IM 1 -- XEP-0198: Stream Management for Prosody IM
2 -- 2 --
3 -- Copyright (C) 2010-2015 Matthew Wild 3 -- Copyright (C) 2010-2015 Matthew Wild
4 -- Copyright (C) 2010 Waqas Hussain 4 -- Copyright (C) 2010 Waqas Hussain
5 -- Copyright (C) 2012-2015 Kim Alvefur 5 -- Copyright (C) 2012-2021 Kim Alvefur
6 -- Copyright (C) 2012 Thijs Alkemade 6 -- Copyright (C) 2012 Thijs Alkemade
7 -- Copyright (C) 2014 Florian Zeitz 7 -- Copyright (C) 2014 Florian Zeitz
8 -- Copyright (C) 2016-2020 Thilo Molitor 8 -- Copyright (C) 2016-2020 Thilo Molitor
9 -- 9 --
10 -- This project is MIT/X11 licensed. Please see the 10 -- This project is MIT/X11 licensed. Please see the
639 return true; 639 return true;
640 end 640 end
641 module:hook_stanza(xmlns_sm2, "resume", function (session, stanza) return handle_resume(session, stanza, xmlns_sm2); end); 641 module:hook_stanza(xmlns_sm2, "resume", function (session, stanza) return handle_resume(session, stanza, xmlns_sm2); end);
642 module:hook_stanza(xmlns_sm3, "resume", function (session, stanza) return handle_resume(session, stanza, xmlns_sm3); end); 642 module:hook_stanza(xmlns_sm3, "resume", function (session, stanza) return handle_resume(session, stanza, xmlns_sm3); end);
643 643
644 module:hook("csi-client-active", function (event)
645 request_ack_if_needed(event.origin, true, "csi-active", nil);
646 end);
647
644 local function handle_read_timeout(event) 648 local function handle_read_timeout(event)
645 local session = event.session; 649 local session = event.session;
646 if session.smacks then 650 if session.smacks then
647 if session.awaiting_ack then 651 if session.awaiting_ack then
648 if session.awaiting_ack_timer then 652 if session.awaiting_ack_timer then