Properly handle all ISUPPORT negations

This commit is contained in:
Simon Ser 2021-03-15 23:11:42 +01:00
parent 62d4bf2813
commit 3f005d481d

View File

@ -634,22 +634,31 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error {
delete(uc.isupport, parameter) delete(uc.isupport, parameter)
} }
if !negate && hasValue { var err error
// TODO: reset to defaults when the token is negated
switch parameter { switch parameter {
case "CHANMODES": case "CHANMODES":
if err := uc.handleChanModes(value); err != nil { if !negate {
return err err = uc.handleChanModes(value)
} else {
uc.availableChannelModes = stdChannelModes
} }
case "CHANTYPES": case "CHANTYPES":
if !negate {
uc.availableChannelTypes = value uc.availableChannelTypes = value
} else {
uc.availableChannelTypes = stdChannelTypes
}
case "PREFIX": case "PREFIX":
if err := uc.handleMemberships(value); err != nil { if !negate {
err = uc.handleMemberships(value)
} else {
uc.availableMemberships = stdMemberships
}
}
if err != nil {
return err return err
} }
} }
}
}
case "BATCH": case "BATCH":
var tag string var tag string
if err := parseMessageParams(msg, &tag); err != nil { if err := parseMessageParams(msg, &tag); err != nil {