# HG changeset patch # User Kim Alvefur # Date 1551561961 -3600 # Node ID 40ed04014b9784c1f7cef60eab0c18686579f08e # Parent 86fe021f16a65e5704cbb2b50000d38172e60fdf 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. diff -r 86fe021f16a6 -r 40ed04014b97 plugins/mod_storage_memory.lua --- 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