downstream: copy message when degrading extended-join

Otherwise we mutate the input argument and loops over downstream
connections to send messages will be messed up.
This commit is contained in:
Simon Ser 2022-03-21 17:13:55 +01:00
parent 5defd29509
commit 8e4c8f7e5a

View File

@ -563,6 +563,7 @@ func (dc *downstreamConn) SendMessage(msg *irc.Message) {
delete(msg.Tags, "batch") delete(msg.Tags, "batch")
} }
if msg.Command == "JOIN" && !dc.caps.IsEnabled("extended-join") { if msg.Command == "JOIN" && !dc.caps.IsEnabled("extended-join") {
msg = msg.Copy()
msg.Params = msg.Params[:1] msg.Params = msg.Params[:1]
} }
if msg.Command == "SETNAME" && !dc.caps.IsEnabled("setname") { if msg.Command == "SETNAME" && !dc.caps.IsEnabled("setname") {