diff options
author | Kim Alvefur <zash@zash.se> | 2021-12-17 15:59:06 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-12-17 15:59:06 +0100 |
commit | b5c32b6572869e71be6d53ca0e5f8014bf63e749 (patch) | |
tree | e14bd2dcc3eea16ad9c1376e6e38a3c6deb33979 /plugins/mod_smacks.lua | |
parent | e10845657cc02ea806676e6f4825481cfd48929b (diff) | |
download | prosody-b5c32b6572869e71be6d53ca0e5f8014bf63e749.tar.gz prosody-b5c32b6572869e71be6d53ca0e5f8014bf63e749.zip |
mod_smacks: Simplify access to local user sessions
Less to type if per chance the next commit also wants to access
sessions.
Diffstat (limited to 'plugins/mod_smacks.lua')
-rw-r--r-- | plugins/mod_smacks.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua index 6d872f5a..18be51ce 100644 --- a/plugins/mod_smacks.lua +++ b/plugins/mod_smacks.lua @@ -45,6 +45,7 @@ local max_inactive_unacked_stanzas = module:get_option_number("smacks_max_inacti 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 @@ module:hook("delivery/failure", function(event) 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)); |