Don't forward duplicate JOIN commands

Closes: https://todo.sr.ht/~emersion/soju/171
This commit is contained in:
Simon Ser 2021-12-08 18:23:46 +01:00
parent 66aea1b4a2
commit bad8154da8

View File

@ -1771,14 +1771,20 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
continue continue
} }
params := []string{upstreamName} // Most servers ignore duplicate JOIN messages. We ignore them here
if key != "" { // because some clients automatically send JOIN messages in bulk
params = append(params, key) // when reconnecting to the bouncer. We don't want to flood the
// upstream connection with these.
if !uc.channels.Has(upstreamName) {
params := []string{upstreamName}
if key != "" {
params = append(params, key)
}
uc.SendMessageLabeled(ctx, dc.id, &irc.Message{
Command: "JOIN",
Params: params,
})
} }
uc.SendMessageLabeled(ctx, dc.id, &irc.Message{
Command: "JOIN",
Params: params,
})
ch := uc.network.channels.Value(upstreamName) ch := uc.network.channels.Value(upstreamName)
if ch != nil { if ch != nil {