From 26c5c11caf714556eb92d89d713f6d84863eaa3e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 16 Mar 2021 09:13:46 +0100 Subject: [PATCH] Improve ERR_NOSUCHCHANNEL error messages References: https://todo.sr.ht/~emersion/soju/63 --- downstream.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/downstream.go b/downstream.go index 5e57cb3..a6fe74c 100644 --- a/downstream.go +++ b/downstream.go @@ -244,6 +244,12 @@ func (dc *downstreamConn) unmarshalEntity(name string) (*upstreamConn, string, e if uc := dc.upstream(); uc != nil { return uc, name, nil } + if dc.network != nil { + return nil, "", ircError{&irc.Message{ + Command: irc.ERR_NOSUCHCHANNEL, + Params: []string{name, "Disconnected from upstream network"}, + }} + } var conn *upstreamConn if i := strings.LastIndexByte(name, '/'); i >= 0 { @@ -261,7 +267,7 @@ func (dc *downstreamConn) unmarshalEntity(name string) (*upstreamConn, string, e if conn == nil { return nil, "", ircError{&irc.Message{ Command: irc.ERR_NOSUCHCHANNEL, - Params: []string{name, "No such channel"}, + Params: []string{name, "Missing network suffix in channel name"}, }} } return conn, name, nil