downstream: fix MARKREAD/READ command name in broadcast

We wouldn't send a MARKREAD message to draft/read-marker downstreams
when receiving a READ command.
This commit is contained in:
Simon Ser 2022-07-08 15:17:30 +02:00
parent 0d44413e85
commit 7e21e79eab

View File

@ -2983,9 +2983,13 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
} }
network.forEachDownstream(func(d *downstreamConn) { network.forEachDownstream(func(d *downstreamConn) {
if broadcast || dc.id == d.id { if broadcast || dc.id == d.id {
cmd := "MARKREAD"
if !dc.caps.IsEnabled("draft/read-marker") {
cmd = "READ"
}
d.SendMessage(&irc.Message{ d.SendMessage(&irc.Message{
Prefix: d.prefix(), Prefix: d.prefix(),
Command: msg.Command, Command: cmd,
Params: []string{d.marshalEntity(network, entity), timestampStr}, Params: []string{d.marshalEntity(network, entity), timestampStr},
}) })
} }