comparison mod_smacks/mod_smacks.lua @ 2670:6e01878103c0

mod_smacks: Ignore user when writing or reading session_cache on prosody 0.9 At least under some circumstances it seems that session.username is nil when a user tries to resume his session in prosody 0.9. The username is not relevant when no limiting is done (limiting the number of entries in the session cache is only possible in prosody 0.10), so this commit removes the usage of the username when accessing the prosody 0.9 session cache.
author tmolitor <thilo@eightysoft.de>
date Thu, 06 Apr 2017 02:12:14 +0200
parents c110b6bfe5d1
children d96831e46b64
comparison
equal deleted inserted replaced
2669:e6d243ed88ca 2670:6e01878103c0
47 local function init_session_cache(max_entries, evict_callback) 47 local function init_session_cache(max_entries, evict_callback)
48 -- old prosody version < 0.10 (no limiting at all!) 48 -- old prosody version < 0.10 (no limiting at all!)
49 if not cache then 49 if not cache then
50 local store = {}; 50 local store = {};
51 return { 51 return {
52 get = function(user, key) return store[user.."@"..key]; end; 52 get = function(user, key) return store[key]; end;
53 set = function(user, key, value) store[user.."@"..key] = value; end; 53 set = function(user, key, value) store[key] = value; end;
54 }; 54 };
55 end 55 end
56 56
57 -- use per user limited cache for prosody >= 0.10 57 -- use per user limited cache for prosody >= 0.10
58 local stores = {}; 58 local stores = {};