aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_privacy.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-04-19 16:16:09 +0200
committerKim Alvefur <zash@zash.se>2013-04-19 16:16:09 +0200
commit5f9657f62054e9625810dacb9b59f6ee09bddf69 (patch)
tree3ef0a2ea8688663d800d608db52155b26d6124e1 /plugins/mod_privacy.lua
parent7468a4e6be2e73122272dc88b63b931ac0fa5c0b (diff)
parent968ea7ee25380c09bc8eacfa4cc52f6947d1dcc2 (diff)
downloadprosody-5f9657f62054e9625810dacb9b59f6ee09bddf69.tar.gz
prosody-5f9657f62054e9625810dacb9b59f6ee09bddf69.zip
Merge 0.9->trunk
Diffstat (limited to 'plugins/mod_privacy.lua')
-rw-r--r--plugins/mod_privacy.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/mod_privacy.lua b/plugins/mod_privacy.lua
index dc6b153a..31ace9f9 100644
--- a/plugins/mod_privacy.lua
+++ b/plugins/mod_privacy.lua
@@ -10,7 +10,6 @@
module:add_feature("jabber:iq:privacy");
local st = require "util.stanza";
-local datamanager = require "util.datamanager";
local bare_sessions, full_sessions = prosody.bare_sessions, prosody.full_sessions;
local util_Jid = require "util.jid";
local jid_bare = util_Jid.bare;
@@ -18,6 +17,8 @@ local jid_split, jid_join = util_Jid.split, util_Jid.join;
local load_roster = require "core.rostermanager".load_roster;
local to_number = tonumber;
+local privacy_storage = module:open_store();
+
function isListUsed(origin, name, privacy_lists)
local user = bare_sessions[origin.username.."@"..origin.host];
if user then
@@ -217,7 +218,7 @@ module:hook("iq/bare/jabber:iq:privacy:query", function(data)
if stanza.attr.to == nil then -- only service requests to own bare JID
local query = stanza.tags[1]; -- the query element
local valid = false;
- local privacy_lists = datamanager.load(origin.username, origin.host, "privacy") or { lists = {} };
+ local privacy_lists = privacy_storage:get(origin.username) or { lists = {} };
if privacy_lists.lists[1] then -- Code to migrate from old privacy lists format, remove in 0.8
module:log("info", "Upgrading format of stored privacy lists for %s@%s", origin.username, origin.host);
@@ -272,7 +273,7 @@ module:hook("iq/bare/jabber:iq:privacy:query", function(data)
end
origin.send(st.error_reply(stanza, valid[1], valid[2], valid[3]));
else
- datamanager.store(origin.username, origin.host, "privacy", privacy_lists);
+ privacy_storage:set(origin.username, privacy_lists);
end
return true;
end
@@ -280,7 +281,7 @@ end);
function checkIfNeedToBeBlocked(e, session)
local origin, stanza = e.origin, e.stanza;
- local privacy_lists = datamanager.load(session.username, session.host, "privacy") or {};
+ local privacy_lists = privacy_storage:get(session.username) or {};
local bare_jid = session.username.."@"..session.host;
local to = stanza.attr.to or bare_jid;
local from = stanza.attr.from;