move ConnectionParams (and SASLParams) out to params.py
This commit is contained in:
parent
971f49f4c7
commit
b46cecf420
2 changed files with 34 additions and 16 deletions
|
@ -1,25 +1,13 @@
|
|||
from typing import Optional
|
||||
from typing import Awaitable, Optional
|
||||
from enum import IntEnum
|
||||
from dataclasses import dataclass
|
||||
|
||||
from ircstates import Server
|
||||
from irctokens import Line
|
||||
|
||||
from .ircv3 import Capability
|
||||
from .sasl import SASLParams
|
||||
|
||||
@dataclass
|
||||
class ConnectionParams(object):
|
||||
nickname: str
|
||||
host: str
|
||||
port: int
|
||||
ssl: bool
|
||||
|
||||
username: Optional[str] = None
|
||||
realname: Optional[str] = None
|
||||
bindhost: Optional[str] = None
|
||||
|
||||
sasl: Optional[SASLParams] = None
|
||||
from .ircv3 import Capability
|
||||
from .matching import BaseResponse
|
||||
from .params import ConnectionParams
|
||||
|
||||
class SendPriority(IntEnum):
|
||||
HIGH = 0
|
||||
|
@ -42,6 +30,9 @@ class IServer(Server):
|
|||
async def send(self, line: Line, priority=SendPriority.DEFAULT):
|
||||
pass
|
||||
|
||||
def wait_for(self, response: BaseResponse) -> Awaitable[Line]:
|
||||
pass
|
||||
|
||||
def set_throttle(self, rate: int, time: float):
|
||||
pass
|
||||
|
||||
|
|
27
ircrobots/params.py
Normal file
27
ircrobots/params.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
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")
|
||||
|
||||
@dataclass
|
||||
class ConnectionParams(object):
|
||||
nickname: str
|
||||
host: str
|
||||
port: int
|
||||
ssl: bool
|
||||
|
||||
username: Optional[str] = None
|
||||
realname: Optional[str] = None
|
||||
bindhost: Optional[str] = None
|
||||
|
||||
sasl: Optional[SASLParams] = None
|
Loading…
Reference in a new issue