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 .ircv3 import Capability
|
||||
from .sasl import SASLParams
|
||||
|
||||
@dataclass
|
||||
class ConnectionParams(object):
|
||||
|
@ -18,6 +19,8 @@ class ConnectionParams(object):
|
|||
realname: Optional[str] = None
|
||||
bindhost: Optional[str] = None
|
||||
|
||||
sasl: Optional[SASLParams] = None
|
||||
|
||||
class SendPriority(IntEnum):
|
||||
HIGH = 0
|
||||
MEDIUM = 10
|
||||
|
|
|
@ -29,6 +29,7 @@ class Capability(object):
|
|||
alias=self.alias,
|
||||
depends_on=self.depends_on[:])
|
||||
|
||||
CAP_SASL = Capability("sasl")
|
||||
CAPS = [
|
||||
Capability("multi-prefix"),
|
||||
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