From 522e20cca195054140a60665ca44bcc6d6415cea Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 29 Nov 2021 16:41:52 +0100 Subject: [PATCH] downstream: improve unmarshalEntityNetwork error message Closes: https://todo.sr.ht/~emersion/soju/162 --- downstream.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/downstream.go b/downstream.go index 4fffd42..a4ed984 100644 --- a/downstream.go +++ b/downstream.go @@ -431,6 +431,12 @@ func (dc *downstreamConn) unmarshalEntityNetwork(name string) (*network, string, if dc.network != nil { return dc.network, name, nil } + if !dc.isMultiUpstream { + return nil, "", ircError{&irc.Message{ + Command: irc.ERR_NOSUCHCHANNEL, + Params: []string{dc.nick, name, "Cannot interact with channels and users on the bouncer connection. Did you mean to use a specific network?"}, + }} + } var net *network if i := strings.LastIndexByte(name, '/'); i >= 0 { @@ -448,7 +454,7 @@ func (dc *downstreamConn) unmarshalEntityNetwork(name string) (*network, string, if net == nil { return nil, "", ircError{&irc.Message{ Command: irc.ERR_NOSUCHCHANNEL, - Params: []string{name, "Missing network suffix in name"}, + Params: []string{dc.nick, name, "Missing network suffix in name"}, }} } @@ -466,7 +472,7 @@ func (dc *downstreamConn) unmarshalEntity(name string) (*upstreamConn, string, e if net.conn == nil { return nil, "", ircError{&irc.Message{ Command: irc.ERR_NOSUCHCHANNEL, - Params: []string{name, "Disconnected from upstream network"}, + Params: []string{dc.nick, name, "Disconnected from upstream network"}, }} }