Only pass through args from connection params when reconnecting

This commit is contained in:
jesopo 2019-04-30 12:05:36 +01:00
parent 8a9fedb875
commit 280e647a84

View file

@ -59,11 +59,11 @@ class Bot(object):
return returned return returned
def add_server(self, server_id: int, connect: bool = True, def add_server(self, server_id: int, connect: bool = True,
connection_params: typing.Optional[ connection_param_args: typing.Dict[str, str]={}
utils.irc.IRCConnectionParameters]=None) -> IRCServer.Server: ) -> IRCServer.Server:
if not connection_params: connection_params = utils.irc.IRCConnectionParameters(
connection_params = utils.irc.IRCConnectionParameters( *self.database.servers.get(server_id))
*self.database.servers.get(server_id)) connection_params.args = connection_param_args
new_server = IRCServer.Server(self, self._events, new_server = IRCServer.Server(self, self._events,
connection_params.id, connection_params.alias, connection_params) connection_params.id, connection_params.alias, connection_params)
@ -164,7 +164,7 @@ class Bot(object):
event["timer"].redo() event["timer"].redo()
def reconnect(self, server_id: int, connection_params: typing.Optional[ def reconnect(self, server_id: int, connection_params: typing.Optional[
utils.irc.IRCConnectionParameters]=None) -> bool: utils.irc.IRCConnectionParameters]=None) -> bool:
server = self.add_server(server_id, False, connection_params) server = self.add_server(server_id, False, connection_params.args)
if self.connect(server): if self.connect(server):
self.servers[server.fileno()] = server self.servers[server.fileno()] = server
return True return True