From 2dfb31ac0b7706db731edc49c59c556e6647eb74 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 28 Feb 2023 18:40:07 +0100 Subject: [PATCH] upstream: drop unnecessary casemapIsSet field --- upstream.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/upstream.go b/upstream.go index 4cb3540..0e1bc46 100644 --- a/upstream.go +++ b/upstream.go @@ -220,8 +220,6 @@ type upstreamConn struct { saslClient sasl.Client saslStarted bool - casemapIsSet bool - // Queue of commands in progress, indexed by type. The first entry has been // sent to the server and is awaiting reply. The following entries have not // been sent yet. @@ -948,7 +946,6 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err casemap = casemapRFC1459 } uc.network.updateCasemapping(casemap) - uc.casemapIsSet = true case "CHANMODES": if !negate { err = uc.handleChanModes(value) @@ -989,18 +986,17 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err } }) case irc.ERR_NOMOTD, irc.RPL_ENDOFMOTD: - if !uc.casemapIsSet { - // upstream did not send any CASEMAPPING token, thus - // we assume it implements the old RFCs with rfc1459. - uc.casemapIsSet = true - uc.network.updateCasemapping(casemapRFC1459) - } - if !uc.gotMotd { // Ignore the initial MOTD upon connection, but forward // subsequent MOTD messages downstream uc.gotMotd = true + // If upstream did not send any CASEMAPPING token, assume it + // implements the old RFCs with rfc1459. + if uc.isupport["CASEMAPPING"] == nil { + uc.network.updateCasemapping(casemapRFC1459) + } + // If the server doesn't support MONITOR, periodically try to // regain our desired nick if _, ok := uc.isupport["MONITOR"]; !ok {