Comparison

plugins/muc/muc.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 12027:5fb16f41f861
child 12109:83bec90a352c
comparison
equal deleted inserted replaced
12028:9ab202e942f5 12029:631b2afa7bc1
447 module:hook("muc-occupant-pre-join", function(event) 447 module:hook("muc-occupant-pre-join", function(event)
448 local room, stanza = event.room, event.stanza; 448 local room, stanza = event.room, event.stanza;
449 local affiliation = room:get_affiliation(stanza.attr.from); 449 local affiliation = room:get_affiliation(stanza.attr.from);
450 if affiliation == "outcast" then 450 if affiliation == "outcast" then
451 local reply = st.error_reply(stanza, "auth", "forbidden", nil, room.jid):up(); 451 local reply = st.error_reply(stanza, "auth", "forbidden", nil, room.jid):up();
452 event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); 452 event.origin.send(reply);
453 return true; 453 return true;
454 end 454 end
455 end, -10); 455 end, -10);
456 456
457 module:hook("muc-occupant-pre-join", function(event) 457 module:hook("muc-occupant-pre-join", function(event)
689 if dest_occupant ~= nil and not is_first_dest_session 689 if dest_occupant ~= nil and not is_first_dest_session
690 and bare_jid ~= jid_bare(dest_occupant.bare_jid) then 690 and bare_jid ~= jid_bare(dest_occupant.bare_jid) then
691 -- new nick or has different bare real jid 691 -- new nick or has different bare real jid
692 log("debug", "%s couldn't join due to nick conflict: %s", real_jid, dest_occupant.nick); 692 log("debug", "%s couldn't join due to nick conflict: %s", real_jid, dest_occupant.nick);
693 local reply = st.error_reply(stanza, "cancel", "conflict", nil, self.jid):up(); 693 local reply = st.error_reply(stanza, "cancel", "conflict", nil, self.jid):up();
694 origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); 694 origin.send(reply);
695 return true; 695 return true;
696 end 696 end
697 697
698 -- Send presence stanza about original occupant 698 -- Send presence stanza about original occupant
699 if orig_occupant ~= nil and orig_occupant ~= dest_occupant then 699 if orig_occupant ~= nil and orig_occupant ~= dest_occupant then