Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
7151:584d5229cb91 | 7152:ca64255bf7cd |
---|---|
116 end | 116 end |
117 end | 117 end |
118 current[key] = data; | 118 current[key] = data; |
119 return self.keyval_store:set(username, current); | 119 return self.keyval_store:set(username, current); |
120 end; | 120 end; |
121 set_keys = function (self, username, keydatas) | |
122 local current, err = self.keyval_store:get(username); | |
123 if current == nil then | |
124 if err then | |
125 return nil, err; | |
126 else | |
127 current = keydatas; | |
128 end | |
129 else | |
130 for k,v in pairs(keydatas) do | |
131 if v == self.remove then v = nil; end | |
132 current[k] = v; | |
133 end | |
134 end | |
135 return self.keyval_store:set(username, current); | |
136 end; | |
137 remove = {}; | |
121 }; | 138 }; |
122 } | 139 } |
123 | 140 |
124 local open; | 141 local open; |
125 | 142 |