Change IRCv3 marks to reference capabilities instead of v3.1 / v3.2

This commit is contained in:
2021-02-27 10:36:30 +01:00
committed by Valentin Lorentz
parent 5ab2fa709e
commit 0352a83a73
20 changed files with 188 additions and 71 deletions

View File

@ -5,16 +5,51 @@ import enum
class Specifications(enum.Enum):
RFC1459 = "RFC1459"
RFC2812 = "RFC2812"
IRC301 = "IRCv3.1"
IRC302 = "IRCv3.2"
IRCv3 = "IRCv3" # Mark with capabilities whenever possible
Oragono = "Oragono"
Multiline = "multiline"
MessageTags = "message-tags"
Ircdocs = "ircdocs"
"""Any document on ircdocs.horse (especially defs.ircdocs.horse),
excluding modern.ircdocs.horse"""
Modern = "modern"
@classmethod
def of_name(cls, name):
def from_name(cls, name):
name = name.upper()
for spec in cls:
if spec.value.upper() == name:
return spec
raise ValueError(name)
@enum.unique
class Capabilities(enum.Enum):
AWAY_NOTIFY = "away-notify"
BATCH = "batch"
ECHO_MESSAGE = "echo-message"
EXTENDED_JOIN = "extended-join"
LABELED_RESPONSE = "labeled-response"
MESSAGE_TAGS = "message-tags"
MULTILINE = "draft/multiline"
MULTI_PREFIX = "multi-prefix"
SERVER_TIME = "server-time"
@classmethod
def from_name(cls, name):
try:
return cls(name.lower())
except ValueError:
raise ValueError(name) from None
@enum.unique
class IsupportTokens(enum.Enum):
MONITOR = "MONITOR"
@classmethod
def from_name(cls, name):
try:
return cls(name.upper())
except ValueError:
raise ValueError(name) from None