ULTIMATE SERVER DE LA MUERTE V2.0
This commit is contained in:
parent
4836141b2d
commit
f0f3dbcfed
@ -20,16 +20,18 @@ def handleConnection(connection, client_address):
|
||||
|
||||
|
||||
def handleRequest(connection, data):
|
||||
#try:
|
||||
try:
|
||||
arrayData = data.split(" ")
|
||||
|
||||
### Command for user with nickname ###
|
||||
if usersConnected[connection][1] is not None:
|
||||
### No command -> new message ###
|
||||
if not arrayData[0][0] == "/" and usersConnected[connection][2]:
|
||||
connection.sendall("SUCC_MESSAGE_SENDED".encode())
|
||||
broadcastMsg(connection, "NEW_MSG {} {} ".format(usersConnected[connection][1], data))
|
||||
return
|
||||
else:
|
||||
### Command for user enable & disable ###
|
||||
if arrayData[0] == "/name":
|
||||
changeName(connection, arrayData[1])
|
||||
return
|
||||
@ -77,7 +79,7 @@ def handleRequest(connection, data):
|
||||
return
|
||||
connection.sendall("ERR_COMMAND_NOT_FOUND".encode())
|
||||
else:
|
||||
### Command for user without nickname
|
||||
### Command for user without nickname ###
|
||||
if arrayData[0] == "/newname":
|
||||
newName(connection, arrayData[1])
|
||||
return
|
||||
@ -85,12 +87,12 @@ def handleRequest(connection, data):
|
||||
connection.shutdown(socket.SHUT_RD)
|
||||
return
|
||||
connection.sendall("ERR_NO_NICKNAME".encode())
|
||||
"""except IndexError:
|
||||
except IndexError:
|
||||
log.printL("Parameter missing in the request", Log.lvl.WARNING)
|
||||
connection.sendall("ERR_PARAMETER_MISSING".encode())
|
||||
except Exception as e :
|
||||
log.printL("Handle request fail : {}".format(str(e)), Log.lvl.FAIL)
|
||||
connection.sendall("ERR_INTERNAL_SERVER_ERROR".encode())"""
|
||||
connection.sendall("ERR_INTERNAL_SERVER_ERROR".encode())
|
||||
|
||||
|
||||
def broadcastMsg(connection, message):
|
||||
|
Reference in New Issue
Block a user