Reformat code with pre-commit
This commit is contained in:
@@ -10,6 +10,7 @@ import main
|
||||
from utils.logging.log import *
|
||||
from utils.get import getRelay
|
||||
|
||||
|
||||
class Network:
|
||||
def __init__(self, net, host, port, security, auth):
|
||||
self.net = net
|
||||
@@ -37,20 +38,20 @@ class Network:
|
||||
"enabled": main.config["ConnectOnCreate"],
|
||||
"net": self.net,
|
||||
"id": num,
|
||||
"registered": registered
|
||||
"registered": registered,
|
||||
}
|
||||
password = alias.generate_password()
|
||||
if not num in main.alias.keys():
|
||||
main.alias[num] = alias.generate_alias()
|
||||
main.saveConf("alias")
|
||||
self.aliases[num] = {"password": password}
|
||||
#if main.config["ConnectOnCreate"]: -- Done in provision
|
||||
# if main.config["ConnectOnCreate"]: -- Done in provision
|
||||
# self.start_bot(num)
|
||||
return num, main.alias[num]["nick"]
|
||||
|
||||
def killAliases(self, aliasList):
|
||||
for i in aliasList:
|
||||
name = self.net+str(i)
|
||||
name = self.net + str(i)
|
||||
if name in main.ReactorPool.keys():
|
||||
if name in main.FactoryPool.keys():
|
||||
main.FactoryPool[name].stopTrying()
|
||||
@@ -63,7 +64,7 @@ class Network:
|
||||
def delete_relay(self, id):
|
||||
del self.relays[id]
|
||||
del self.aliases[id]
|
||||
#del main.alias[id] - Aliases are global per num, so don't delete them!
|
||||
# del main.alias[id] - Aliases are global per num, so don't delete them!
|
||||
self.killAliases([id])
|
||||
|
||||
def seppuku(self):
|
||||
@@ -74,11 +75,11 @@ class Network:
|
||||
def start_bot(self, num):
|
||||
# a single name is given to relays in the backend
|
||||
# e.g. freenode1 for the first relay on freenode network
|
||||
keyFN = main.certPath+main.config["Key"]
|
||||
certFN = main.certPath+main.config["Certificate"]
|
||||
keyFN = main.certPath + main.config["Key"]
|
||||
certFN = main.certPath + main.config["Certificate"]
|
||||
contextFactory = DefaultOpenSSLContextFactory(keyFN.encode("utf-8", "replace"), certFN.encode("utf-8", "replace"))
|
||||
bot = IRCBotFactory(self.net, num)
|
||||
#host, port = self.relays[num]["host"], self.relays[num]["port"]
|
||||
# host, port = self.relays[num]["host"], self.relays[num]["port"]
|
||||
host, port = getRelay(num)
|
||||
rct = reactor.connectSSL(host, port, bot, contextFactory)
|
||||
name = self.net + str(num)
|
||||
|
||||
Reference in New Issue
Block a user