comparison mod_storage_memory/mod_storage_memory.lua @ 1753:54c8a0cb2996

mod_storage_(archive-capable): Change order of arguments to :append to be the same as return values from :find iterator (see prosody 41725f3df3cc)
author Kim Alvefur <zash@zash.se>
date Tue, 19 May 2015 18:34:08 +0200
parents 59fdf4f12343
children e72f9eac51c8
comparison
equal deleted inserted replaced
1752:3f3689a16133 1753:54c8a0cb2996
40 end 40 end
41 41
42 local archive_store = {}; 42 local archive_store = {};
43 archive_store.__index = archive_store; 43 archive_store.__index = archive_store;
44 44
45 function archive_store:append(username, key, when, with, value) 45 function archive_store:append(username, key, value, when, with)
46 if type(when) ~= "number" then
47 value, when, with = when, with, value;
48 end
46 local a = self.store[username]; 49 local a = self.store[username];
47 if not a then 50 if not a then
48 a = {}; 51 a = {};
49 self.store[username] = a; 52 self.store[username] = a;
50 end 53 end
114 local t; 117 local t;
115 for i = 1, #old do 118 for i = 1, #old do
116 i = old[i]; 119 i = old[i];
117 t = i.when; 120 t = i.when;
118 if not(qstart >= t and qend <= t and (not qwith or i.with == qwith)) then 121 if not(qstart >= t and qend <= t and (not qwith or i.with == qwith)) then
119 self:append(username, i.key, t, i.with, i.value); 122 self:append(username, i.key, i.value, t, i.with);
120 end 123 end
121 end 124 end
122 if #new == 0 then 125 if #new == 0 then
123 self.store[username] = nil; 126 self.store[username] = nil;
124 end 127 end