From c4a6c84cecceb04ece261fdf0553204a37c6529b Mon Sep 17 00:00:00 2001 From: Nyo Date: Sat, 10 Dec 2016 19:31:12 +0100 Subject: [PATCH] .BANCHO. .HIDE. General refactoring --- events/logoutEvent.py | 4 ++-- irc/ircserver.py | 4 ++-- pep.py | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/events/logoutEvent.py b/events/logoutEvent.py index b4ac4e6..3a8d55e 100644 --- a/events/logoutEvent.py +++ b/events/logoutEvent.py @@ -17,7 +17,7 @@ def handle(userToken, _=None, deleteToken=True): # the old logout packet will still be in the queue and will be sent to # the server, so we accept logout packets sent at least 5 seconds after login # if the user logs out before 5 seconds, he will be disconnected later with timeout check - if (int(time.time()-userToken.loginTime) >= 5 or userToken.irc): + if int(time.time() - userToken.loginTime) >= 5 or userToken.irc: # Stop spectating userToken.stopSpectating() @@ -35,7 +35,7 @@ def handle(userToken, _=None, deleteToken=True): glob.streams.broadcast("main", serverPackets.userLogout(userID)) # Disconnect from IRC if needed - if userToken.irc == True and glob.irc == True: + if userToken.irc and glob.irc: glob.ircServer.forceDisconnection(userToken.username) # Delete token diff --git a/irc/ircserver.py b/irc/ircserver.py index d086605..c353f89 100644 --- a/irc/ircserver.py +++ b/irc/ircserver.py @@ -136,7 +136,7 @@ class Client: self.server.removeClient(self, quitmsg) # Bancho logout - if callLogout: + if callLogout and self.banchoUsername != "": chat.IRCDisconnect(self.IRCUsername) @@ -669,7 +669,7 @@ class Server: try: self.clients[conn] = Client(self, conn) log.info("[IRC] Accepted connection from {}:{}".format(addr[0], addr[1])) - except socket.error as e: + except socket.error: try: conn.close() except: diff --git a/pep.py b/pep.py index a3c5aff..006548a 100644 --- a/pep.py +++ b/pep.py @@ -1,9 +1,7 @@ -"""Hello, pep.py here, ex-owner of ripple and prime minister of Ripwot.""" import os import sys import threading from multiprocessing.pool import ThreadPool - import tornado.gen import tornado.httpserver import tornado.ioloop @@ -41,7 +39,6 @@ from pubSubHandlers import banHandler from pubSubHandlers import updateSilenceHandler from pubSubHandlers import updateStatsHandler - def make_app(): return tornado.web.Application([ (r"/", mainHandler.handler),