From 3f005d481d431d1260f70fccba87709b44a0bf6b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 15 Mar 2021 23:11:42 +0100 Subject: [PATCH] Properly handle all ISUPPORT negations --- upstream.go | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/upstream.go b/upstream.go index 640c673..c0c86b8 100644 --- a/upstream.go +++ b/upstream.go @@ -634,20 +634,29 @@ func (uc *upstreamConn) handleMessage(msg *irc.Message) error { delete(uc.isupport, parameter) } - if !negate && hasValue { - // TODO: reset to defaults when the token is negated - switch parameter { - case "CHANMODES": - if err := uc.handleChanModes(value); err != nil { - return err - } - case "CHANTYPES": - uc.availableChannelTypes = value - case "PREFIX": - if err := uc.handleMemberships(value); err != nil { - return err - } + var err error + switch parameter { + case "CHANMODES": + if !negate { + err = uc.handleChanModes(value) + } else { + uc.availableChannelModes = stdChannelModes } + case "CHANTYPES": + if !negate { + uc.availableChannelTypes = value + } else { + uc.availableChannelTypes = stdChannelTypes + } + case "PREFIX": + if !negate { + err = uc.handleMemberships(value) + } else { + uc.availableMemberships = stdMemberships + } + } + if err != nil { + return err } } case "BATCH":