aboutsummaryrefslogtreecommitdiffstats
path: root/core/storagemanager.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-09 16:54:56 +0100
committerKim Alvefur <zash@zash.se>2016-02-09 16:54:56 +0100
commit38cee98c50dbbddd39cfd2cc91370807d22323a3 (patch)
treee0db159c372ad6bbbf9fd7913f67104cca345d4c /core/storagemanager.lua
parent07aeb61310bc5187677798f0fcf38e4241ddaae6 (diff)
downloadprosody-38cee98c50dbbddd39cfd2cc91370807d22323a3.tar.gz
prosody-38cee98c50dbbddd39cfd2cc91370807d22323a3.zip
storagemanager: Add set_keys method to map store shim
Diffstat (limited to 'core/storagemanager.lua')
-rw-r--r--core/storagemanager.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/storagemanager.lua b/core/storagemanager.lua
index cf2c65d5..4f04e594 100644
--- a/core/storagemanager.lua
+++ b/core/storagemanager.lua
@@ -118,6 +118,23 @@ local map_shim_mt = {
current[key] = data;
return self.keyval_store:set(username, current);
end;
+ set_keys = function (self, username, keydatas)
+ local current, err = self.keyval_store:get(username);
+ if current == nil then
+ if err then
+ return nil, err;
+ else
+ current = keydatas;
+ end
+ else
+ for k,v in pairs(keydatas) do
+ if v == self.remove then v = nil; end
+ current[k] = v;
+ end
+ end
+ return self.keyval_store:set(username, current);
+ end;
+ remove = {};
};
}