irctest/irctest/specifications.py

58 lines
1.3 KiB
Python
Raw Normal View History

import enum
2021-02-22 18:02:13 +00:00
@enum.unique
class Specifications(enum.Enum):
2021-02-22 18:02:13 +00:00
RFC1459 = "RFC1459"
RFC2812 = "RFC2812"
IRCv3 = "IRCv3" # Mark with capabilities whenever possible
2021-02-22 18:02:13 +00:00
Oragono = "Oragono"
Ircdocs = "ircdocs"
"""Any document on ircdocs.horse (especially defs.ircdocs.horse),
excluding modern.ircdocs.horse"""
Modern = "modern"
@classmethod
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"
STS = "sts"
@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"
STATUSMSG = "STATUSMSG"
@classmethod
def from_name(cls, name):
try:
return cls(name.upper())
except ValueError:
raise ValueError(name) from None