aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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
commit6805cf54ec5979d3abb91d8b8c742c519e027f6f (patch)
treebde99cf0df6a677e7aecc5be71bb88fbdb8c83e0 /plugins
parentd68051abe4de30d6b1ea196b1812a276e6acb61a (diff)
downloadprosody-6805cf54ec5979d3abb91d8b8c742c519e027f6f.tar.gz
prosody-6805cf54ec5979d3abb91d8b8c742c519e027f6f.zip
mod_blocklist: Check first level cache before calling blocklist getter
Diffstat (limited to 'plugins')
-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