downstream: ensure numerics always carry a source prefix
From [1]: > Distinct from a normal message, a numeric reply MUST contain a > <source> and use a three-digit numeric as the command. [1]: https://modern.ircdocs.horse/#numeric-replies
This commit is contained in:
parent
d5108f3994
commit
51a12983d8
|
@ -530,6 +530,12 @@ func (dc *downstreamConn) SendMessage(ctx context.Context, msg *irc.Message) {
|
||||||
msg = &msgCopy
|
msg = &msgCopy
|
||||||
msg.Prefix = nil
|
msg.Prefix = nil
|
||||||
}
|
}
|
||||||
|
if msg.Prefix == nil && isNumeric(msg.Command) {
|
||||||
|
// Numerics must always carry a source
|
||||||
|
msgCopy := *msg
|
||||||
|
msg = &msgCopy
|
||||||
|
msg.Prefix = dc.srv.prefix()
|
||||||
|
}
|
||||||
|
|
||||||
dc.srv.metrics.downstreamOutMessagesTotal.Inc()
|
dc.srv.metrics.downstreamOutMessagesTotal.Inc()
|
||||||
dc.conn.SendMessage(ctx, msg)
|
dc.conn.SendMessage(ctx, msg)
|
||||||
|
|
Loading…
Reference in a new issue