add objects needed to denote SASL in ConnectionParams
This commit is contained in:
parent
1b9b12cb1e
commit
4f61b89012
3 changed files with 18 additions and 0 deletions
|
@ -6,6 +6,7 @@ from ircstates import Server
|
||||||
from irctokens import Line
|
from irctokens import Line
|
||||||
|
|
||||||
from .ircv3 import Capability
|
from .ircv3 import Capability
|
||||||
|
from .sasl import SASLParams
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ConnectionParams(object):
|
class ConnectionParams(object):
|
||||||
|
@ -18,6 +19,8 @@ class ConnectionParams(object):
|
||||||
realname: Optional[str] = None
|
realname: Optional[str] = None
|
||||||
bindhost: Optional[str] = None
|
bindhost: Optional[str] = None
|
||||||
|
|
||||||
|
sasl: Optional[SASLParams] = None
|
||||||
|
|
||||||
class SendPriority(IntEnum):
|
class SendPriority(IntEnum):
|
||||||
HIGH = 0
|
HIGH = 0
|
||||||
MEDIUM = 10
|
MEDIUM = 10
|
||||||
|
|
|
@ -29,6 +29,7 @@ class Capability(object):
|
||||||
alias=self.alias,
|
alias=self.alias,
|
||||||
depends_on=self.depends_on[:])
|
depends_on=self.depends_on[:])
|
||||||
|
|
||||||
|
CAP_SASL = Capability("sasl")
|
||||||
CAPS = [
|
CAPS = [
|
||||||
Capability("multi-prefix"),
|
Capability("multi-prefix"),
|
||||||
Capability("chghost"),
|
Capability("chghost"),
|
||||||
|
|
14
ircrobots/sasl.py
Normal file
14
ircrobots/sasl.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from typing import Optional
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SASLParams(object):
|
||||||
|
mechanism: str
|
||||||
|
username: Optional[str] = None
|
||||||
|
password: Optional[str] = None
|
||||||
|
class SASLUserPass(SASLParams):
|
||||||
|
def __init__(self, username: str, password: str):
|
||||||
|
super().__init__("USERPASS", username, password)
|
||||||
|
class SASLExternal(SASLParams):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("EXTERNAL")
|
Loading…
Reference in a new issue