irctest/irctest/specifications.py

71 lines
1.7 KiB
Python
Raw Normal View History

from __future__ import annotations
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-05-27 03:55:21 +00:00
Ergo = "Ergo"
Ircdocs = "ircdocs"
"""Any document on ircdocs.horse (especially defs.ircdocs.horse),
excluding modern.ircdocs.horse"""
Modern = "modern"
@classmethod
def from_name(cls, name: str) -> Specifications:
name = name.upper()
for spec in cls:
if spec.value.upper() == name:
return spec
raise ValueError(name)
@enum.unique
class Capabilities(enum.Enum):
ACCOUNT_NOTIFY = "account-notify"
ACCOUNT_TAG = "account-tag"
AWAY_NOTIFY = "away-notify"
BATCH = "batch"
ECHO_MESSAGE = "echo-message"
EXTENDED_JOIN = "extended-join"
EXTENDED_MONITOR = "extended-monitor"
LABELED_RESPONSE = "labeled-response"
MESSAGE_TAGS = "message-tags"
MULTILINE = "draft/multiline"
MULTI_PREFIX = "multi-prefix"
SERVER_TIME = "server-time"
SETNAME = "setname"
STS = "sts"
@classmethod
def from_name(cls, name: str) -> Capabilities:
try:
return cls(name.lower())
except ValueError:
raise ValueError(name) from None
@enum.unique
class IsupportTokens(enum.Enum):
2021-07-01 13:34:26 +00:00
BOT = "BOT"
2022-03-20 13:07:46 +00:00
ELIST = "ELIST"
INVEX = "INVEX"
2022-03-09 19:01:34 +00:00
PREFIX = "PREFIX"
MONITOR = "MONITOR"
STATUSMSG = "STATUSMSG"
2021-08-13 20:48:11 +00:00
TARGMAX = "TARGMAX"
UTF8ONLY = "UTF8ONLY"
2022-02-21 20:43:22 +00:00
WHOX = "WHOX"
@classmethod
def from_name(cls, name: str) -> IsupportTokens:
try:
return cls(name.upper())
except ValueError:
raise ValueError(name) from None