changeset 4010:ae27f3359df8

mod_muc_occupant_id: Don't store occupant-ids. It seems it's cheap enough to generate so don't unnecessarily store everyone's occupant-ids forever.
author Maxime “pep” Buquet <pep@bouah.net>
date Tue, 05 May 2020 16:27:59 +0200
parents 362997ededb1
children de40686ae9c8
files mod_muc_occupant_id/mod_muc_occupant_id.lua
diffstat 1 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_occupant_id/mod_muc_occupant_id.lua	Fri May 01 22:24:10 2020 +0200
+++ b/mod_muc_occupant_id/mod_muc_occupant_id.lua	Tue May 05 16:27:59 2020 +0200
@@ -17,16 +17,12 @@
 		room._data.occupant_id_salt = uuid.generate();
 	end
 
-	if room._data.occupant_ids == nil then
-		room._data.occupant_ids = {};
-	end
+	-- XXX: Temporary not-so-important migration measure. Remove this next time
+	-- somebody looks at it. This module used to store every participant's
+	-- occupant-id all the time forever.
+	room._data.occupant_ids = nil;
 
-	if room._data.occupant_ids[bare] == nil then
-		local unique_id = b64encode(hmac_sha256(bare, room._data.occupant_id_salt));
-		room._data.occupant_ids[bare] = unique_id;
-	end
-
-	return room._data.occupant_ids[bare];
+	return b64encode(hmac_sha256(bare, room._data.occupant_id_salt));
 end
 
 local function update_occupant(event)