Use downstreamConn.upstreamForCommand when handling user MODE

Provides uniform error messages.
This commit is contained in:
Simon Ser 2023-08-31 00:09:57 +09:00
parent d6fc01e44a
commit fe64c795cd
1 changed files with 4 additions and 8 deletions

View File

@ -2012,15 +2012,11 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
if dc.casemap(name) == dc.nickCM {
if modeStr != "" {
if uc := dc.upstream(); uc != nil {
uc.SendMessageLabeled(ctx, dc.id, msg)
} else {
dc.SendMessage(ctx, &irc.Message{
Prefix: dc.srv.prefix(),
Command: irc.ERR_UMODEUNKNOWNFLAG,
Params: []string{dc.nick, "Cannot change user mode on bouncer connection"},
})
uc, err := dc.upstreamForCommand(msg.Command)
if err != nil {
return err
}
uc.SendMessageLabeled(ctx, dc.id, msg)
} else {
var userMode string
if uc := dc.upstream(); uc != nil {