Software /
code /
prosody-modules
Comparison
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 |
comparison
equal
deleted
inserted
replaced
4817:e8e0cb97c480 | 4818:d66162e850cd |
---|---|
59 local clean = skeleton(item); | 59 local clean = skeleton(item); |
60 | 60 |
61 -- Normalize top level attributes | 61 -- Normalize top level attributes |
62 clean.attr.type = item.attr.type; | 62 clean.attr.type = item.attr.type; |
63 if clean.attr.type == nil and clean.name == "message" then clean.attr.type = "normal"; end | 63 if clean.attr.type == nil and clean.name == "message" then clean.attr.type = "normal"; end |
64 clean.attr.id = string.rep("x", #(item.attr.id or "")); -- worth rounding to nearest power of two or so? | 64 clean.attr.id = string.rep("x", math.floor(math.log(1+#(item.attr.id or ""), 2))); |
65 clean.attr.from = classify_jid(item.attr.from); | 65 clean.attr.from = classify_jid(item.attr.from); |
66 clean.attr.to = classify_jid(item.attr.to); | 66 clean.attr.to = classify_jid(item.attr.to); |
67 print(clean); | 67 print(clean); |
68 end | 68 end |
69 | 69 |