Software /
code /
prosody-modules
Comparison
mod_lastlog2/mod_lastlog2.lua @ 5799:5239ed05bd71
mod_lastlog2: Fix to interpret stored data structure correctly
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 06 Dec 2023 15:07:09 +0000 |
parent | 5797:7b722955c59b |
child | 5900:c5df6d53f17f |
comparison
equal
deleted
inserted
replaced
5798:4c3216d9b118 | 5799:5239ed05bd71 |
---|---|
54 if user_sessions[username] then | 54 if user_sessions[username] then |
55 return os.time(); -- Currently connected | 55 return os.time(); -- Currently connected |
56 else | 56 else |
57 local last_activity = kv_store:get(username); | 57 local last_activity = kv_store:get(username); |
58 if not last_activity then return nil; end | 58 if not last_activity then return nil; end |
59 local latest = math.max(last_activity.login or 0, last_activity.logout or 0); | 59 local last_login = last_activity.login; |
60 local last_logout = last_activity.logout; | |
61 local latest = math.max(last_login and last_login.timestamp or 0, last_logout and last_logout.timestamp or 0); | |
60 if latest == 0 then | 62 if latest == 0 then |
61 return nil; -- Never logged in | 63 return nil; -- Never logged in |
62 end | 64 end |
63 return latest; | 65 return latest; |
64 end | 66 end |