diff options
| author | 2018-11-05 18:30:14 +0000 | |
|---|---|---|
| committer | 2018-11-05 18:30:39 +0000 | |
| commit | d63115440dbf426063e0f5d813255295dc910837 (patch) | |
| tree | 309f51ae7b1e920a30149150ee96ab4297847cb0 /src | |
| parent | Pass connection parameters around in their own object (IRCConnectionParameters) (diff) | |
| signature | ||
Fix the order of some connection params, add `alias` as a seperate argument to
IRCServer.Server
Diffstat (limited to 'src')
| -rw-r--r-- | src/IRCBot.py | 2 | ||||
| -rw-r--r-- | src/IRCServer.py | 6 | ||||
| -rw-r--r-- | src/utils/irc.py | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/IRCBot.py b/src/IRCBot.py index 69bb3abb..10197509 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -44,7 +44,7 @@ class Bot(object): *self.database.servers.get(server_id)) new_server = IRCServer.Server(self, self._events, - connection_params.id, connection_params) + connection_params.id, connection_params.alias, connection_params) self._events.on("new.server").call(server=new_server) if not connect or not new_server.get_setting("connect", True): diff --git a/src/IRCServer.py b/src/IRCServer.py index b2e1607f..62efbc8f 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -11,11 +11,13 @@ class Server(IRCObject.Object): bot: "IRCBot.Bot", events: EventManager.EventHook, id: int, + alias: typing.Optional[str], connection_params: utils.irc.IRCConnectionParameters): self.connected = False self.bot = bot self.events = events self.id = id + self.alias = alias self.connection_params = connection_params self.name = None # type: typing.Optional[str] @@ -87,7 +89,7 @@ class Server(IRCObject.Object): self.socket.settimeout(5.0) if self.connection_params.bindhost: - self.socket.bind((self.bindhost, 0)) + self.socket.bind((self.connection_params.bindhost, 0)) if self.connection_params.tls: self.tls_wrap() @@ -95,7 +97,7 @@ class Server(IRCObject.Object): self.connection_params.port)) self.send_capibility_ls() - if self.password: + if self.connection_params.password: self.send_pass(self.connection_params.password) self.send_user(self.connection_params.username, diff --git a/src/utils/irc.py b/src/utils/irc.py index c78dd179..a7604b4b 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -145,7 +145,7 @@ def strip_font(s: str) -> str: OPT_STR = typing.Optional[str] class IRCConnectionParameters(object): def __init__(self, id: int, alias: OPT_STR, hostname: str, port: int, - tls: bool, ipv4: bool, password: OPT_STR, bindhost: OPT_STR, + password: OPT_STR, tls: bool, ipv4: bool, bindhost: OPT_STR, nickname: str, username: OPT_STR, realname: OPT_STR): self.id = id self.alias = alias |
