upstream: drop unnecessary casemapIsSet field

This commit is contained in:
Simon Ser 2023-02-28 18:40:07 +01:00
parent 36d6cb19a4
commit 2dfb31ac0b

View File

@ -220,8 +220,6 @@ type upstreamConn struct {
saslClient sasl.Client saslClient sasl.Client
saslStarted bool saslStarted bool
casemapIsSet bool
// Queue of commands in progress, indexed by type. The first entry has been // 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 // sent to the server and is awaiting reply. The following entries have not
// been sent yet. // been sent yet.
@ -948,7 +946,6 @@ func (uc *upstreamConn) handleMessage(ctx context.Context, msg *irc.Message) err
casemap = casemapRFC1459 casemap = casemapRFC1459
} }
uc.network.updateCasemapping(casemap) uc.network.updateCasemapping(casemap)
uc.casemapIsSet = true
case "CHANMODES": case "CHANMODES":
if !negate { if !negate {
err = uc.handleChanModes(value) 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: 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 { if !uc.gotMotd {
// Ignore the initial MOTD upon connection, but forward // Ignore the initial MOTD upon connection, but forward
// subsequent MOTD messages downstream // subsequent MOTD messages downstream
uc.gotMotd = true 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 // If the server doesn't support MONITOR, periodically try to
// regain our desired nick // regain our desired nick
if _, ok := uc.isupport["MONITOR"]; !ok { if _, ok := uc.isupport["MONITOR"]; !ok {