Software /
code /
prosody
Changeset
12063:d308f6901397
mod_smacks: Simplify access to local user sessions
Less to type if per chance the next commit also wants to access
sessions.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 17 Dec 2021 15:59:06 +0100 |
parents | 12062:4972244fe87b |
children | 12064:d2380fd5e421 |
files | plugins/mod_smacks.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_smacks.lua Thu Dec 16 23:04:50 2021 +0100 +++ b/plugins/mod_smacks.lua Fri Dec 17 15:59:06 2021 +0100 @@ -45,6 +45,7 @@ local delayed_ack_timeout = module:get_option_number("smacks_max_ack_delay", 30); local c2s_sessions = module:shared("/*/c2s/sessions"); +local local_sessions = prosody.hosts[module.host].sessions; local function format_h(h) if h then return string.format("%d", h) end end @@ -413,8 +414,7 @@ return true; -- stanza handled, don't send an error end -- store message in offline store, if this client does not use mam *and* was the last client online - local sessions = prosody.hosts[module.host].sessions[session.username] and - prosody.hosts[module.host].sessions[session.username].sessions or nil; + local sessions = local_sessions[session.username] and local_sessions[session.username].sessions or nil; if sessions and next(sessions) == session.resource and next(sessions, session.resource) == nil then local ok = module:fire_event("message/offline/handle", { origin = session, username = session.username, stanza = stanza }); session.log("debug", "mod_smacks delivery/failure returning %s for offline-handled stanza", tostring(ok));