~emersion/soju

2b3782a507f669501aaaa0965a7da994f3373d27 — Simon Ser 3 days ago 0e9ef1f
Make user MODE commands fail in multi-upstream mode

References: https://todo.sr.ht/~emersion/soju/20
1 files changed, 8 insertions(+), 2 deletions(-)

M downstream.go
M downstream.go => downstream.go +8 -2
@@ 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 {