Changeset

12029:631b2afa7bc1

MUC: Remove <{muc}x> tags in some errors Including the payload of the stanza that caused the error is optional and we're generally not doing it anywhere else.
author Kim Alvefur <zash@zash.se>
date Wed, 08 Dec 2021 21:55:25 +0100
parents 12028:9ab202e942f5
children 12030:9f8206e99b89
files plugins/muc/members_only.lib.lua plugins/muc/muc.lib.lua plugins/muc/password.lib.lua plugins/muc/register.lib.lua spec/scansion/muc_register.scs spec/scansion/muc_show_offline.scs
diffstat 6 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/members_only.lib.lua	Wed Dec 08 21:06:16 2021 +0100
+++ b/plugins/muc/members_only.lib.lua	Wed Dec 08 21:55:25 2021 +0100
@@ -122,7 +122,7 @@
 		local affiliation = room:get_affiliation(stanza.attr.from);
 		if valid_affiliations[affiliation or "none"] <= valid_affiliations.none then
 			local reply = st.error_reply(stanza, "auth", "registration-required", nil, room.jid):up();
-			event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+			event.origin.send(reply);
 			return true;
 		end
 	end
--- a/plugins/muc/muc.lib.lua	Wed Dec 08 21:06:16 2021 +0100
+++ b/plugins/muc/muc.lib.lua	Wed Dec 08 21:55:25 2021 +0100
@@ -449,7 +449,7 @@
 	local affiliation = room:get_affiliation(stanza.attr.from);
 	if affiliation == "outcast" then
 		local reply = st.error_reply(stanza, "auth", "forbidden", nil, room.jid):up();
-		event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+		event.origin.send(reply);
 		return true;
 	end
 end, -10);
@@ -691,7 +691,7 @@
 		-- new nick or has different bare real jid
 		log("debug", "%s couldn't join due to nick conflict: %s", real_jid, dest_occupant.nick);
 		local reply = st.error_reply(stanza, "cancel", "conflict", nil, self.jid):up();
-		origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+		origin.send(reply);
 		return true;
 	end
 
--- a/plugins/muc/password.lib.lua	Wed Dec 08 21:06:16 2021 +0100
+++ b/plugins/muc/password.lib.lua	Wed Dec 08 21:55:25 2021 +0100
@@ -51,7 +51,7 @@
 		local from, to = stanza.attr.from, stanza.attr.to;
 		module:log("debug", "%s couldn't join due to invalid password: %s", from, to);
 		local reply = st.error_reply(stanza, "auth", "not-authorized", nil, room.jid):up();
-		event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+		event.origin.send(reply);
 		return true;
 	end
 end, -20);
--- a/plugins/muc/register.lib.lua	Wed Dec 08 21:06:16 2021 +0100
+++ b/plugins/muc/register.lib.lua	Wed Dec 08 21:55:25 2021 +0100
@@ -85,7 +85,7 @@
 	if reserved_by and reserved_by ~= jid_bare(stanza.attr.from) then
 		module:log("debug", "%s attempted to use nick %s reserved by %s", stanza.attr.from, requested_nick, reserved_by);
 		local reply = st.error_reply(stanza, "cancel", "conflict", nil, room.jid):up();
-		origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+		origin.send(reply);
 		return true;
 	end
 
@@ -98,7 +98,7 @@
 			elseif event.dest_occupant.nick ~= jid_bare(event.dest_occupant.nick) .. "/" .. nick then
 				module:log("debug", "Attempt by %s to join as %s, but their reserved nick is %s", stanza.attr.from, requested_nick, nick);
 				local reply = st.error_reply(stanza, "cancel", "not-acceptable", nil, room.jid):up();
-				origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"}));
+				origin.send(reply);
 				return true;
 			end
 		end
--- a/spec/scansion/muc_register.scs	Wed Dec 08 21:06:16 2021 +0100
+++ b/spec/scansion/muc_register.scs	Wed Dec 08 21:55:25 2021 +0100
@@ -180,7 +180,6 @@
 		<error type='cancel' by='room@conference.localhost'>
 			<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
 		</error>
-		<x xmlns='http://jabber.org/protocol/muc'/>
 	</presence>
 
 # In a heated moment, Juliet unregisters from the room
@@ -291,7 +290,6 @@
 		<error type='cancel' by='room@conference.localhost'>
 			<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
 		</error>
-		<x xmlns='http://jabber.org/protocol/muc'/>
 	</presence>
 
 # Juliet, however, quietly joins the room with success
--- a/spec/scansion/muc_show_offline.scs	Wed Dec 08 21:06:16 2021 +0100
+++ b/spec/scansion/muc_show_offline.scs	Wed Dec 08 21:55:25 2021 +0100
@@ -185,7 +185,6 @@
 		<error type='cancel' by='room@conference.localhost'>
 			<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
 		</error>
-		<x xmlns='http://jabber.org/protocol/muc'/>
 	</presence>
 
 # In a heated moment, Juliet unregisters from the room
@@ -296,7 +295,6 @@
 		<error type='cancel' by='room@conference.localhost'>
 			<conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
 		</error>
-		<x xmlns='http://jabber.org/protocol/muc'/>
 	</presence>
 
 # Juliet, however, quietly joins the room with success