Software /
code /
prosody
Diff
core/storagemanager.lua @ 7152:ca64255bf7cd
storagemanager: Add set_keys method to map store shim
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 09 Feb 2016 16:54:56 +0100 |
parent | 7151:584d5229cb91 |
child | 7157:0890a428a99b |
child | 7244:8c6943918279 |
line wrap: on
line diff
--- a/core/storagemanager.lua Fri Aug 08 12:38:35 2014 +0200 +++ b/core/storagemanager.lua Tue Feb 09 16:54:56 2016 +0100 @@ -118,6 +118,23 @@ 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 = {}; }; }