Comparison

plugins/muc/register.lib.lua @ 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
parent 12028:9ab202e942f5
child 12977:74b9e05af71e
comparison
equal deleted inserted replaced
12028:9ab202e942f5 12029:631b2afa7bc1
83 local requested_nick = jid_resource(stanza.attr.to); 83 local requested_nick = jid_resource(stanza.attr.to);
84 local reserved_by = get_registered_jid(room, requested_nick); 84 local reserved_by = get_registered_jid(room, requested_nick);
85 if reserved_by and reserved_by ~= jid_bare(stanza.attr.from) then 85 if reserved_by and reserved_by ~= jid_bare(stanza.attr.from) then
86 module:log("debug", "%s attempted to use nick %s reserved by %s", stanza.attr.from, requested_nick, reserved_by); 86 module:log("debug", "%s attempted to use nick %s reserved by %s", stanza.attr.from, requested_nick, reserved_by);
87 local reply = st.error_reply(stanza, "cancel", "conflict", nil, room.jid):up(); 87 local reply = st.error_reply(stanza, "cancel", "conflict", nil, room.jid):up();
88 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); 88 origin.send(reply);
89 return true; 89 return true;
90 end 90 end
91 91
92 -- Check if the occupant has a reservation they must use 92 -- Check if the occupant has a reservation they must use
93 if enforce_nick then 93 if enforce_nick then
96 if event.occupant then 96 if event.occupant then
97 event.occupant.nick = jid_bare(event.occupant.nick) .. "/" .. nick; 97 event.occupant.nick = jid_bare(event.occupant.nick) .. "/" .. nick;
98 elseif event.dest_occupant.nick ~= jid_bare(event.dest_occupant.nick) .. "/" .. nick then 98 elseif event.dest_occupant.nick ~= jid_bare(event.dest_occupant.nick) .. "/" .. nick then
99 module:log("debug", "Attempt by %s to join as %s, but their reserved nick is %s", stanza.attr.from, requested_nick, nick); 99 module:log("debug", "Attempt by %s to join as %s, but their reserved nick is %s", stanza.attr.from, requested_nick, nick);
100 local reply = st.error_reply(stanza, "cancel", "not-acceptable", nil, room.jid):up(); 100 local reply = st.error_reply(stanza, "cancel", "not-acceptable", nil, room.jid):up();
101 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); 101 origin.send(reply);
102 return true; 102 return true;
103 end 103 end
104 end 104 end
105 end 105 end
106 end 106 end