Software / code / prosody
Comparison
plugins/mod_storage_memory.lua @ 9468:bd5e4485a245
mod_storage_memory: Switch from '@' prefix to '=' for chunks, '@' is used to indicate a source file name only
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2018 10:36:01 +0100 |
| parent | 9340:368b092bf4bf |
| child | 9533:00a8e627854e |
comparison
equal
deleted
inserted
replaced
| 9467:2098794ac866 | 9468:bd5e4485a245 |
|---|---|
| 28 return (self.store[username or NULL] or NULL)(); | 28 return (self.store[username or NULL] or NULL)(); |
| 29 end | 29 end |
| 30 | 30 |
| 31 function keyval_store:set(username, data) | 31 function keyval_store:set(username, data) |
| 32 if data ~= nil then | 32 if data ~= nil then |
| 33 data = envload("return "..serialize(data), "@data", {}); | 33 data = envload("return "..serialize(data), "=(data)", {}); |
| 34 end | 34 end |
| 35 self.store[username or NULL] = data; | 35 self.store[username or NULL] = data; |
| 36 return true; | 36 return true; |
| 37 end | 37 end |
| 38 | 38 |
| 45 if type(when) ~= "number" then | 45 if type(when) ~= "number" then |
| 46 when, with, value = value, when, with; | 46 when, with, value = value, when, with; |
| 47 end | 47 end |
| 48 if is_stanza(value) then | 48 if is_stanza(value) then |
| 49 value = st.preserialize(value); | 49 value = st.preserialize(value); |
| 50 value = envload("return xml"..serialize(value), "@stanza", { xml = st.deserialize }) | 50 value = envload("return xml"..serialize(value), "=(stanza)", { xml = st.deserialize }) |
| 51 else | 51 else |
| 52 value = envload("return "..serialize(value), "@data", {}); | 52 value = envload("return "..serialize(value), "=(data)", {}); |
| 53 end | 53 end |
| 54 local a = self.store[username or NULL]; | 54 local a = self.store[username or NULL]; |
| 55 if not a then | 55 if not a then |
| 56 a = {}; | 56 a = {}; |
| 57 self.store[username or NULL] = a; | 57 self.store[username or NULL] = a; |