Software /
code /
prosody
Comparison
plugins/mod_mam/mamprefs.lib.lua @ 8353:aa6497031924
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 |
parent | 7979:a1e88642411d |
child | 8538:3eb4cafb3b64 |
comparison
equal
deleted
inserted
replaced
8348:c3de5b454ec4 | 8353:aa6497031924 |
---|---|
31 local prefs = module:open_store(archive_store .. "_prefs"); | 31 local prefs = module:open_store(archive_store .. "_prefs"); |
32 | 32 |
33 local function get_prefs(user) | 33 local function get_prefs(user) |
34 local user_sessions = sessions[user]; | 34 local user_sessions = sessions[user]; |
35 local user_prefs = user_sessions and user_sessions.archive_prefs | 35 local user_prefs = user_sessions and user_sessions.archive_prefs |
36 if not user_prefs and user_sessions then | 36 if not user_prefs then |
37 user_prefs = prefs:get(user); | 37 user_prefs = prefs:get(user); |
38 user_sessions.archive_prefs = user_prefs; | 38 if user_sessions then |
39 user_sessions.archive_prefs = user_prefs; | |
40 end | |
39 end | 41 end |
40 return user_prefs or { [false] = global_default_policy }; | 42 return user_prefs or { [false] = global_default_policy }; |
41 end | 43 end |
42 local function set_prefs(user, user_prefs) | 44 local function set_prefs(user, user_prefs) |
43 local user_sessions = sessions[user]; | 45 local user_sessions = sessions[user]; |