Mercurial > prosody-modules
comparison mod_mam/mamprefs.lib.lua @ 2819:9ffb059c9ba5
mod_mam: Load archiving preferes for offline users (fixes #1024)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 17 Oct 2017 12:42:20 +0200 |
parents | d81882aa0e1e |
children |
comparison
equal
deleted
inserted
replaced
2818:88474dd1af48 | 2819:9ffb059c9ba5 |
---|---|
22 local prefs = module:open_store(archive_store .. "_prefs"); | 22 local prefs = module:open_store(archive_store .. "_prefs"); |
23 | 23 |
24 local function get_prefs(user) | 24 local function get_prefs(user) |
25 local user_sessions = sessions[user]; | 25 local user_sessions = sessions[user]; |
26 local user_prefs = user_sessions and user_sessions.archive_prefs | 26 local user_prefs = user_sessions and user_sessions.archive_prefs |
27 if not user_prefs and user_sessions then | 27 if not user_prefs then |
28 user_prefs = prefs:get(user); | 28 user_prefs = prefs:get(user); |
29 user_sessions.archive_prefs = user_prefs; | 29 if user_sessions then |
30 user_sessions.archive_prefs = user_prefs; | |
31 end | |
30 end | 32 end |
31 return user_prefs or { [false] = global_default_policy }; | 33 return user_prefs or { [false] = global_default_policy }; |
32 end | 34 end |
33 local function set_prefs(user, user_prefs) | 35 local function set_prefs(user, user_prefs) |
34 local user_sessions = sessions[user]; | 36 local user_sessions = sessions[user]; |