Reformat and fix circular import
This commit is contained in:
@@ -35,13 +35,7 @@ from utils.parsing import parsen
|
||||
from twisted.internet.ssl import DefaultOpenSSLContextFactory
|
||||
|
||||
|
||||
def deliverRelayCommands(num, relayCommands, user=None, stage2=None):
|
||||
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(net=None, num=num, relayCommands=relayCommands, user=user, stage2=stage2)
|
||||
host, port = getRelay(num)
|
||||
rct = reactor.connectSSL(host, port, bot, contextFactory)
|
||||
from utils.deliver_relay_commands import deliverRelayCommands
|
||||
|
||||
|
||||
# Copied from the Twisted source so we can fix a bug
|
||||
|
||||
@@ -114,7 +114,10 @@ class Relay(Protocol):
|
||||
|
||||
def handleHello(self, parsed):
|
||||
if parsed["key"] in main.tokens.keys():
|
||||
if parsed["hello"] == main.tokens[parsed["key"]]["hello"] and main.tokens[parsed["key"]]["usage"] == "relay":
|
||||
if (
|
||||
parsed["hello"] == main.tokens[parsed["key"]]["hello"]
|
||||
and main.tokens[parsed["key"]]["usage"] == "relay"
|
||||
):
|
||||
self.sendMsg({"type": "hello", "hello": main.tokens[parsed["key"]]["counter"]})
|
||||
self.authed = True
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user