Changeset

9649:a20849226598 0.11

mod_csi_simple: Bypass importance event in active mode (fixes #1249)
author Kim Alvefur <zash@zash.se>
date Tue, 27 Nov 2018 19:05:11 +0100
parents 9648:dfebf6cac027
children 9650:db6bcafd76c9
files plugins/mod_csi_simple.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua	Tue Nov 27 18:56:22 2018 +0100
+++ b/plugins/mod_csi_simple.lua	Tue Nov 27 19:05:11 2018 +0100
@@ -71,6 +71,7 @@
 
 module:hook("csi-client-inactive", function (event)
 	local session = event.origin;
+	session.state = "inactive";
 	if session.pump then
 		session.pump:pause();
 	else
@@ -81,7 +82,7 @@
 		pump:pause();
 		session.pump = pump;
 		function session.send(stanza)
-			if module:fire_event("csi-is-stanza-important", { stanza = stanza, session = session }) then
+			if session.state == "active" or module:fire_event("csi-is-stanza-important", { stanza = stanza, session = session }) then
 				pump:flush();
 				send(stanza);
 			else
@@ -98,6 +99,7 @@
 
 module:hook("csi-client-active", function (event)
 	local session = event.origin;
+	session.state = "active";
 	if session.pump then
 		session.pump:resume();
 	end