Comparison

mod_smacks/mod_smacks.lua @ 4458:5234d0c8883d

mod_smacks: Only act on CSI state changes if smacks is enabled Fixes attempt to get length of a nil value (local 'queue') in request_ack_if_needed()
author Kim Alvefur <zash@zash.se>
date Mon, 22 Feb 2021 16:44:40 +0100
parent 4446:3d593b612e07
child 4463:8b8246031a5e
comparison
equal deleted inserted replaced
4457:091d06c7d724 4458:5234d0c8883d
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) 644 module:hook("csi-client-active", function (event)
645 request_ack_if_needed(event.origin, true, "csi-active", nil); 645 if event.origin.smacks then
646 request_ack_if_needed(event.origin, true, "csi-active", nil);
647 end
646 end); 648 end);
647 649
648 module:hook("csi-flushing", function (event) 650 module:hook("csi-flushing", function (event)
649 request_ack_if_needed(event.session, true, "csi-active", nil); 651 if event.origin.smacks then
652 request_ack_if_needed(event.session, true, "csi-active", nil);
653 end
650 end); 654 end);
651 655
652 local function handle_read_timeout(event) 656 local function handle_read_timeout(event)
653 local session = event.session; 657 local session = event.session;
654 if session.smacks then 658 if session.smacks then