Make user MODE commands fail in multi-upstream mode

References: https://todo.sr.ht/~emersion/soju/20
This commit is contained in:
Simon Ser 2021-06-10 11:24:10 +02:00
parent 0e9ef1f97c
commit 2b3782a507
1 changed files with 8 additions and 2 deletions

View File

@ -1601,12 +1601,18 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error {
if casemapASCII(name) == dc.nickCM {
if modeStr != "" {
dc.forEachUpstream(func(uc *upstreamConn) {
if uc := dc.upstream(); uc != nil {
uc.SendMessageLabeled(dc.id, &irc.Message{
Command: "MODE",
Params: []string{uc.nick, modeStr},
})
})
} else {
dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(),
Command: irc.ERR_UMODEUNKNOWNFLAG,
Params: []string{dc.nick, "Cannot change user mode in multi-upstream mode"},
})
}
} else {
var userMode string
if uc := dc.upstream(); uc != nil {