Software /
code /
prosody
Changeset
9838:40ed04014b97 0.11
mod_storage_memory: Generate ID using standard util (fixes #1326)
The previous method relied on tostring(table) returning the pointer address,
which might not be portable.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 02 Mar 2019 22:26:01 +0100 |
parents | 9833:86fe021f16a6 |
children | 9839:9007ae90aeb1 9840:ec353524b739 |
files | plugins/mod_storage_memory.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_memory.lua Wed Feb 27 10:27:17 2019 +0100 +++ b/plugins/mod_storage_memory.lua Sat Mar 02 22:26:01 2019 +0100 @@ -3,6 +3,7 @@ local envload = require "util.envload".envload; local st = require "util.stanza"; local is_stanza = st.is_stanza or function (s) return getmetatable(s) == st.stanza_mt end +local new_id = require "util.id".medium; local auto_purge_enabled = module:get_option_boolean("storage_memory_temporary", false); local auto_purge_stores = module:get_option_set("storage_memory_temporary_stores", {}); @@ -56,7 +57,7 @@ end local v = { key = key, when = when, with = with, value = value }; if not key then - key = tostring(a):match"%x+$"..tostring(v):match"%x+$"; + key = new_id(); v.key = key; end if a[key] then