Diff

plugins/mod_csi_simple.lua @ 9919:d602a495409b

mod_csi_simple: Disable optimizations on unload and re-enable on load
author Kim Alvefur <zash@zash.se>
date Sun, 24 Mar 2019 20:43:15 +0100
parent 9918:6e9dcec259d0
child 9920:4a56d7891bd3
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua	Sun Mar 24 20:41:25 2019 +0100
+++ b/plugins/mod_csi_simple.lua	Sun Mar 24 20:43:15 2019 +0100
@@ -111,3 +111,24 @@
 		session.conn:pause_writes();
 	end
 end);
+
+function module.load()
+	for _, user_session in pairs(prosody.hosts[module.host].sessions) do
+		for _, session in pairs(user_session.sessions) do
+			if session.state == "inactive" then
+				enable_optimizations(session);
+			end
+		end
+	end
+end
+
+function module.unload()
+	for _, user_session in pairs(prosody.hosts[module.host].sessions) do
+		for _, session in pairs(user_session.sessions) do
+			if session.state == "inactive" then
+				disble_optimizations(session);
+			end
+		end
+	end
+end
+