From f7e151396d78a1b63be171e03a284735829e88ee Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 7 Dec 2021 09:42:32 +0100 Subject: [PATCH] Use dc.nick instead of "*" for RPL_* messages Makes it clearer what these fields are used for. The default value for dc.nick is "*". --- downstream.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/downstream.go b/downstream.go index 3f7d8cd..6efe756 100644 --- a/downstream.go +++ b/downstream.go @@ -927,21 +927,21 @@ func (dc *downstreamConn) handleAuthenticateCommand(msg *irc.Message) (result *d return nil, ircError{&irc.Message{ Prefix: dc.srv.prefix(), Command: irc.ERR_SASLFAIL, - Params: []string{"*", "AUTHENTICATE requires the \"sasl\" capability to be enabled"}, + Params: []string{dc.nick, "AUTHENTICATE requires the \"sasl\" capability to be enabled"}, }} } if len(msg.Params) == 0 { return nil, ircError{&irc.Message{ Prefix: dc.srv.prefix(), Command: irc.ERR_SASLFAIL, - Params: []string{"*", "Missing AUTHENTICATE argument"}, + Params: []string{dc.nick, "Missing AUTHENTICATE argument"}, }} } if msg.Params[0] == "*" { return nil, ircError{&irc.Message{ Prefix: dc.srv.prefix(), Command: irc.ERR_SASLABORTED, - Params: []string{"*", "SASL authentication aborted"}, + Params: []string{dc.nick, "SASL authentication aborted"}, }} } @@ -960,7 +960,7 @@ func (dc *downstreamConn) handleAuthenticateCommand(msg *irc.Message) (result *d return nil, ircError{&irc.Message{ Prefix: dc.srv.prefix(), Command: irc.ERR_SASLFAIL, - Params: []string{"*", fmt.Sprintf("Unsupported SASL mechanism %q", mech)}, + Params: []string{dc.nick, fmt.Sprintf("Unsupported SASL mechanism %q", mech)}, }} } @@ -973,7 +973,7 @@ func (dc *downstreamConn) handleAuthenticateCommand(msg *irc.Message) (result *d return nil, ircError{&irc.Message{ Prefix: dc.srv.prefix(), Command: irc.ERR_SASLFAIL, - Params: []string{"*", "Invalid base64-encoded response"}, + Params: []string{dc.nick, "Invalid base64-encoded response"}, }} } } @@ -1229,7 +1229,7 @@ func (dc *downstreamConn) register(ctx context.Context) error { dc.endSASL(&irc.Message{ Prefix: dc.srv.prefix(), Command: irc.ERR_SASLABORTED, - Params: []string{"*", "SASL authentication aborted"}, + Params: []string{dc.nick, "SASL authentication aborted"}, }) } @@ -1285,7 +1285,7 @@ func (dc *downstreamConn) loadNetwork(ctx context.Context) error { dc.logger.Printf("failed to connect to %q: %v", addr, err) return ircError{&irc.Message{ Command: irc.ERR_PASSWDMISMATCH, - Params: []string{"*", fmt.Sprintf("Failed to connect to %q", dc.networkName)}, + Params: []string{dc.nick, fmt.Sprintf("Failed to connect to %q", dc.networkName)}, }} }