Changeset

6028:2d2766328179

mod_muc_occupant_id: Obsolete this module, its functionality has been included in mod_muc since 0.12
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 28 Oct 2024 20:38:39 +0100
parents 6027:98951dab5851
children 6029:4ac59707bcfb
files mod_muc_occupant_id/README.md mod_muc_occupant_id/mod_muc_occupant_id.lua
diffstat 2 files changed, 4 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_occupant_id/README.md	Sun Oct 27 14:22:34 2024 +0100
+++ b/mod_muc_occupant_id/README.md	Mon Oct 28 20:38:39 2024 +0100
@@ -1,22 +1,8 @@
 ---
 summary: 'Anonymous unique occupant identifiers for MUCs'
+superseded_by: mod_muc
+labels:
+- 'Stage-Obsolete'
 ...
 
-Introduction
-============
-
-This module implements [XEP-0421: Anonymous unique occupant identifiers for
-MUCs](https://xmpp.org/extensions/xep-0421.html).
-
-TODO
-====
-
-- Subject messages
-
-Compatibility
-=============
-
-  ------- ------------------
-  0.12    Built-in, not needed
-  0.11    Works; except in MUC-PMs
-  ------- ------------------
+Since Prosody 0.12, this module has been merged into [`mod_muc`, included in Prosody](https://prosody.im/doc/modules/mod_muc).
--- a/mod_muc_occupant_id/mod_muc_occupant_id.lua	Sun Oct 27 14:22:34 2024 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-
--- Implementation of https://xmpp.org/extensions/inbox/occupant-id.html
--- XEP-0421: Anonymous unique occupant identifiers for MUCs
-
-module:depends("muc");
-
-local uuid = require "util.uuid";
-local hmac_sha256 = require "util.hashes".hmac_sha256;
-local b64encode = require "util.encodings".base64.encode;
-
-local xmlns_occupant_id = "urn:xmpp:occupant-id:0";
-
-local function generate_id(occupant, room)
-	local bare = occupant.bare_jid;
-
-	if room._data.occupant_id_salt == nil then
-		room._data.occupant_id_salt = uuid.generate();
-	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;
-
-	return b64encode(hmac_sha256(bare, room._data.occupant_id_salt));
-end
-
-local function update_occupant(event)
-	local stanza, room, occupant, dest_occupant = event.stanza, event.room, event.occupant, event.dest_occupant;
-
-	-- "muc-occupant-pre-change" provides "dest_occupant" but not "occupant".
-	if dest_occupant ~= nil then
-		occupant = dest_occupant;
-	end
-
-	-- strip any existing <occupant-id/> tags to avoid forgery
-	stanza:remove_children("occupant-id", xmlns_occupant_id);
-
-	local unique_id = generate_id(occupant, room);
-	stanza:tag("occupant-id", { xmlns = xmlns_occupant_id, id = unique_id }):up();
-end
-
-local function muc_private(event)
-	local stanza, room = event.stanza, event.room;
-	local occupant = room._occupants[stanza.attr.from];
-
-	update_occupant({
-		stanza = stanza,
-		room = room,
-		occupant = occupant,
-	});
-end
-
-module:add_feature(xmlns_occupant_id);
-module:hook("muc-disco#info", function (event)
-	event.reply:tag("feature", { var = xmlns_occupant_id }):up();
-end);
-
-module:hook("muc-broadcast-presence", update_occupant);
-module:hook("muc-occupant-pre-join", update_occupant);
-module:hook("muc-occupant-pre-change", update_occupant);
-module:hook("muc-occupant-groupchat", update_occupant);
-module:hook("muc-private-message", muc_private);