Changeset

3680:7570976318a9

mod_csi_grace_period: Fix to store state on correct table Can cause problems for things that iterate the hosts sessions table. I blame autocomplete.
author Kim Alvefur <zash@zash.se>
date Sun, 29 Sep 2019 00:32:17 +0200
parents 3679:f9a93d7b6c50
children 3681:d267e381255f
files mod_csi_grace_period/mod_csi_grace_period.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_csi_grace_period/mod_csi_grace_period.lua	Sat Sep 28 21:26:28 2019 +0200
+++ b/mod_csi_grace_period/mod_csi_grace_period.lua	Sun Sep 29 00:32:17 2019 +0200
@@ -18,11 +18,11 @@
 	local user_session = user_sessions[session.username];
 	if not user_session then return; end
 
-	if user_sessions.grace_time_start then
-		if user_sessions.last_active == session.resource then
+	if user_session.grace_time_start then
+		if user_session.last_active == session.resource then
 			return;
 		end
-		if (os.time() - user_sessions.grace_time_start) < grace_period then
+		if (os.time() - user_session.grace_time_start) < grace_period then
 			session.log("debug", "Within grace period, probably seen");
 			return false;
 		end
@@ -35,8 +35,8 @@
 	if not user_session then return; end
 
 	if stanza:get_child("body") or stanza:get_child("active", "http://jabber.org/protocol/chatstates") then
-		user_sessions.last_active = origin.resource;
-		user_sessions.grace_time_start = os.time();
+		user_session.last_active = origin.resource;
+		user_session.grace_time_start = os.time();
 	end
 end
 module:hook("pre-message/full", on_activity);