From 38bd58f7ffd018f53fb97837943ded70f090b913 Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 2 Jun 2015 16:55:04 -0700 Subject: [PATCH] Actually check recvpass field (Closes #9) --- main.py | 2 +- proto.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index db94430..ca32435 100755 --- a/main.py +++ b/main.py @@ -33,9 +33,9 @@ class Irc(): self.socket = socket.socket() self.socket.connect((ip, port)) proto.connect(self) - self.connected = True self.loaded = [] self.load_plugins() + self.connected = True self.run() def run(self): diff --git a/proto.py b/proto.py index 8bf4dec..5a7a47a 100644 --- a/proto.py +++ b/proto.py @@ -191,8 +191,16 @@ def handle_events(irc, data): # Each server message looks something like this: # :70M FJOIN #chat 1423790411 +AFPfjnt 6:5 7:5 9:5 :v,1SRAAESWE # : ... :final multi word argument + args = data.split() + if args and args[0] == 'SERVER': + # SERVER whatever.net abcdefgh 0 10X :something + servername = args[1] + if args[2] != irc.serverdata['recvpass']: + # Check if recvpass is correct + print('Error: recvpass from uplink server %s does not match configuration!' % servername) + sys.exit(1) + return try: - args = data.split() real_args = [] for arg in args: real_args.append(arg)