# HG changeset patch # User Kim Alvefur # Date 1569709937 -7200 # Node ID 7570976318a99cc69ad4f13f475b88cd8b0d9a2b # Parent f9a93d7b6c50d30bd3ad890ae9298a5660be1afb 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. diff -r f9a93d7b6c50 -r 7570976318a9 mod_csi_grace_period/mod_csi_grace_period.lua --- 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);