aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_blocklist.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-12-05 17:35:38 +0100
committerKim Alvefur <zash@zash.se>2016-12-05 17:35:38 +0100
commit9ac77204baa77df1d42db6f713219601a7bd4e78 (patch)
treebde99cf0df6a677e7aecc5be71bb88fbdb8c83e0 /plugins/mod_blocklist.lua
parent088d53b68f48faa00d798adccdbf4fbf8831e5be (diff)
downloadprosody-9ac77204baa77df1d42db6f713219601a7bd4e78.tar.gz
prosody-9ac77204baa77df1d42db6f713219601a7bd4e78.zip
mod_blocklist: Check first level cache before calling blocklist getter
Diffstat (limited to 'plugins/mod_blocklist.lua')
-rw-r--r--plugins/mod_blocklist.lua9
1 files changed, 3 insertions, 6 deletions
diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua
index 2233045e..283d52fa 100644
--- a/plugins/mod_blocklist.lua
+++ b/plugins/mod_blocklist.lua
@@ -77,10 +77,7 @@ local function migrate_privacy_list(username)
end
local function get_blocklist(username)
- local blocklist = cache[username];
- if not blocklist then
- blocklist = cache2:get(username);
- end
+ local blocklist = cache2:get(username);
if not blocklist then
if not user_exists(username, module.host) then
return null_blocklist;
@@ -102,7 +99,7 @@ module:hook("iq-get/self/urn:xmpp:blocking:blocklist", function (event)
local origin, stanza = event.origin, event.stanza;
local username = origin.username;
local reply = st.reply(stanza):tag("blocklist", { xmlns = "urn:xmpp:blocking" });
- local blocklist = get_blocklist(username);
+ local blocklist = cache[username] or get_blocklist(username);
for jid in pairs(blocklist) do
if jid then
reply:tag("item", { jid = jid }):up();
@@ -156,7 +153,7 @@ local function edit_blocklist(event)
return true;
end
- local blocklist = get_blocklist(username);
+ local blocklist = cache[username] or get_blocklist(username);
local new_blocklist = {
-- We set the [false] key to someting as a signal not to migrate privacy lists