changeset 4298:020dd0a59f1f

mod_muc_markers: Add option for @id rewriting, default off (may break some clients) XEP-0333 was updated to clarify that stanza-id should be used instead of the 'id' attribute when in a MUC. Some clients still use the id attribute, which is why we were rewriting it. Rewriting is bad because mod_muc advertises stable_id, indicating that Prosody does *not* rewrite ids. Recent versions of Conversations actually depend on this being true. All clients should migrate to using stanza-id for markers. See XEP-0333.
author Matthew Wild <mwild1@gmail.com>
date Mon, 14 Dec 2020 12:09:25 +0000
parents 4a5c4a352b78
children 8006da2cf44c
files mod_muc_markers/mod_muc_markers.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_markers/mod_muc_markers.lua	Mon Dec 14 13:05:18 2020 +0100
+++ b/mod_muc_markers/mod_muc_markers.lua	Mon Dec 14 12:09:25 2020 +0000
@@ -21,6 +21,7 @@
 end
 
 local marker_element_name = module:get_option_string("muc_marker_type", "displayed");
+local rewrite_id_attribute = module:get_option_boolean("muc_marker_rewrite_id", false);
 
 assert(marker_order[marker_element_name], "invalid marker name: "..marker_element_name);
 
@@ -50,8 +51,11 @@
 	-- We are not interested in stanzas that didn't get archived
 	if not archive_id then return; end
 
-	-- Add stanza id as id attribute
-	stanza.attr.id = archive_id;
+	if rewrite_id_attribute then
+		-- Add stanza id as id attribute
+		stanza.attr.id = archive_id;
+	end
+
 	-- Add markable element to request markers from clients
 	stanza:tag("markable", { xmlns = xmlns_markers }):up();
 end, -1);