reply to ping

This commit is contained in:
Nova Cat 2024-12-08 21:44:32 -08:00
parent 0756be099f
commit d09649a93d
2 changed files with 6 additions and 1 deletions

View file

@ -14,7 +14,7 @@ TODO:
- [ ] Channel invite system
- [ ] Wildcard logic (for +b and +q)
- [ ] Send PING and wait for PONG
- [ ] Reply PONG if received PING
- [x] Reply PONG if received PING
- [ ] Change of nicknames
- [ ] User Flags
- [ ] i (invisible)

View file

@ -69,6 +69,10 @@ def session(connection, client):
connection.sendall(bytes(f":{pending} MODE {pending} +iw\r\n","UTF-8"))
finished = True
elif text.split(" ")[0].upper() == "PING":
e = text.split(" ")[1]
print("Replied to PING.")
connection.sendall(bytes(f"PONG {e}\r\n","UTF-8"))
elif (ready and already_set) and finished:
if text.split(" ")[0].upper() == "JOIN":
channel = text.split(" ")[1]
@ -147,6 +151,7 @@ def session(connection, client):
connection.sendall(bytes(f"ERROR :Closing Link: {client[0]} ({msg})\r\n","UTF-8"))
connection.close()
break
except:
print(traceback.format_exc())