Software /
code /
prosody-modules
Diff
mod_export_skeletons/mod_export_skeletons.lua @ 4818:d66162e850cd
mod_export_skeletons: Generate ids based on log2 of the original length
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 10 Dec 2021 00:14:12 +0100 |
parent | 4815:9c2af2146ee2 |
child | 4820:5704082b8703 |
line wrap: on
line diff
--- a/mod_export_skeletons/mod_export_skeletons.lua Fri Dec 10 00:04:56 2021 +0100 +++ b/mod_export_skeletons/mod_export_skeletons.lua Fri Dec 10 00:14:12 2021 +0100 @@ -61,7 +61,7 @@ -- Normalize top level attributes clean.attr.type = item.attr.type; if clean.attr.type == nil and clean.name == "message" then clean.attr.type = "normal"; end - clean.attr.id = string.rep("x", #(item.attr.id or "")); -- worth rounding to nearest power of two or so? + clean.attr.id = string.rep("x", math.floor(math.log(1+#(item.attr.id or ""), 2))); clean.attr.from = classify_jid(item.attr.from); clean.attr.to = classify_jid(item.attr.to); print(clean);