Diff

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
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Mon Feb 22 13:45:29 2021 +0000
+++ b/mod_smacks/mod_smacks.lua	Mon Feb 22 16:44:40 2021 +0100
@@ -642,11 +642,15 @@
 module:hook_stanza(xmlns_sm3, "resume", function (session, stanza) return handle_resume(session, stanza, xmlns_sm3); end);
 
 module:hook("csi-client-active", function (event)
-	request_ack_if_needed(event.origin, true, "csi-active", nil);
+	if event.origin.smacks then
+		request_ack_if_needed(event.origin, true, "csi-active", nil);
+	end
 end);
 
 module:hook("csi-flushing", function (event)
-	request_ack_if_needed(event.session, true, "csi-active", nil);
+	if event.origin.smacks then
+		request_ack_if_needed(event.session, true, "csi-active", nil);
+	end
 end);
 
 local function handle_read_timeout(event)