diff options
author | Kim Alvefur <zash@zash.se> | 2016-02-09 16:54:56 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-02-09 16:54:56 +0100 |
commit | 38cee98c50dbbddd39cfd2cc91370807d22323a3 (patch) | |
tree | e0db159c372ad6bbbf9fd7913f67104cca345d4c /core | |
parent | 07aeb61310bc5187677798f0fcf38e4241ddaae6 (diff) | |
download | prosody-38cee98c50dbbddd39cfd2cc91370807d22323a3.tar.gz prosody-38cee98c50dbbddd39cfd2cc91370807d22323a3.zip |
storagemanager: Add set_keys method to map store shim
Diffstat (limited to 'core')
-rw-r--r-- | core/storagemanager.lua | 17 |
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 = {}; }; } |