Fix the order of some connection params, add alias as a seperate argument to

IRCServer.Server
This commit is contained in:
jesopo 2018-11-05 18:30:14 +00:00
parent 6b8593a09b
commit d63115440d
4 changed files with 7 additions and 5 deletions

View file

@ -8,6 +8,6 @@ class Module(ModuleManager.BaseModule):
command = command.split("%%")
for j, part in enumerate(command[:]):
command[j] = part.replace("%nick%", event["server"
].original_nickname)
].nickname)
command = "%".join(command)
event["server"].send(command)

View file

@ -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):

View file

@ -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,

View file

@ -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