mirror of
https://github.com/tcsenpai/telnet_retro_chat.git
synced 2025-06-06 03:05:35 +00:00
fixed numbers and quit problems
This commit is contained in:
parent
dffadb65da
commit
d9f464257d
10
main.py
10
main.py
@ -42,9 +42,10 @@ def process_input_byte(byte, display_buffer, conn):
|
|||||||
if byte in (127, 8): # Backspace/delete
|
if byte in (127, 8): # Backspace/delete
|
||||||
return handle_backspace(display_buffer, conn)
|
return handle_backspace(display_buffer, conn)
|
||||||
|
|
||||||
# Add character to display buffer and echo back
|
# Only accept printable ASCII characters (32-126)
|
||||||
display_buffer += bytes([byte])
|
if 32 <= byte <= 126:
|
||||||
conn.sendall(bytes([byte]))
|
display_buffer += bytes([byte])
|
||||||
|
conn.sendall(bytes([byte]))
|
||||||
return display_buffer
|
return display_buffer
|
||||||
|
|
||||||
|
|
||||||
@ -59,7 +60,8 @@ def process_complete_line(line, addr, active_connections, conn):
|
|||||||
if message.startswith("/"):
|
if message.startswith("/"):
|
||||||
response = command_processor.process_command(message[1:], addr)
|
response = command_processor.process_command(message[1:], addr)
|
||||||
if response.startswith("@QUIT@"):
|
if response.startswith("@QUIT@"):
|
||||||
if conn: # Only for real connections
|
if conn:
|
||||||
|
cleanup_client_connection(addr) # Clean up first
|
||||||
conn.sendall(b"\r\nGoodbye!\r\n")
|
conn.sendall(b"\r\nGoodbye!\r\n")
|
||||||
conn.close()
|
conn.close()
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user