Mercurial > prosody-modules
comparison mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 2595:307ddebb72e1
mod_storage_xmlarchive: Assume offset to be zero if not included (thanks pep.)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 04 Mar 2017 19:52:41 +0100 |
parents | d47a7e6e9adc |
children | 9ec8289f6bb2 |
comparison
equal
deleted
inserted
replaced
2594:1e1c929c1aa5 | 2595:307ddebb72e1 |
---|---|
43 end | 43 end |
44 | 44 |
45 -- If the day-file is missing then we need to add it to the list of days | 45 -- If the day-file is missing then we need to add it to the list of days |
46 local first_of_day = not lfs.attributes(dm.getpath(username .. "@" .. day, module.host, self.store, "list")); | 46 local first_of_day = not lfs.attributes(dm.getpath(username .. "@" .. day, module.host, self.store, "list")); |
47 | 47 |
48 local offset = ok and err; | 48 local offset = ok and err or 0; |
49 | 49 |
50 local id = day .. "-" .. hmac_sha256(username.."@"..day.."+"..offset, data, true):sub(-16); | 50 local id = day .. "-" .. hmac_sha256(username.."@"..day.."+"..offset, data, true):sub(-16); |
51 ok, err = dm.list_append(username.."@"..day, module.host, self.store, { id = id, when = dt.datetime(when), with = with, offset = offset, length = #data }); | 51 ok, err = dm.list_append(username.."@"..day, module.host, self.store, { id = id, when = dt.datetime(when), with = with, offset = offset, length = #data }); |
52 if ok and first_of_day then | 52 if ok and first_of_day then |
53 ok, err = dm.list_append(username, module.host, self.store, day); | 53 ok, err = dm.list_append(username, module.host, self.store, day); |