From bd5f83e890a25c81eba161166c5e5d9709e8109f Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Thu, 12 Feb 2026 15:03:45 -0500 Subject: [PATCH] Skip empty lines during name prompt and fix tintin send syntax The server now skips spurious empty lines from client negotiation bytes during the name prompt, only closing on actual connection loss. This makes the login flow robust against clients that send IAC bytes with trailing CRLF during negotiation. Also fixed tintin++ CATCH handlers to use proper \} syntax matching the documented examples. --- mud.tin | 6 +++--- src/mudlib/server.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mud.tin b/mud.tin index 2bf5fa6..b0fa21d 100644 --- a/mud.tin +++ b/mud.tin @@ -10,9 +10,9 @@ #NOP protocol negotiation: tintin++ does NOT auto-negotiate MSDP or #NOP GMCP. CATCH intercepts before the default DONT response, and -#NOP #line raw bypasses IAC escaping so the DO bytes arrive intact. -#EVENT {CATCH IAC WILL GMCP} {#line raw #send {\xFF\xFD\xC9}} -#EVENT {CATCH IAC WILL MSDP} {#line raw #send {\xFF\xFD\x45}} +#NOP #send handles hex escapes natively (no raw option needed). +#EVENT {CATCH IAC WILL GMCP} {#send {\xFF\xFD\xC9\}} +#EVENT {CATCH IAC WILL MSDP} {#send {\xFF\xFD\x45\}} #NOP store incoming MSDP variables and refresh status bar #EVENT {IAC SB MSDP} { diff --git a/src/mudlib/server.py b/src/mudlib/server.py index 16ed9d9..a4bad4e 100644 --- a/src/mudlib/server.py +++ b/src/mudlib/server.py @@ -256,10 +256,14 @@ async def shell( _writer.write("What is your name? ") await _writer.drain() - name_input = await readline2(_reader, _writer) - if name_input is None or not name_input.strip(): - _writer.close() - return + # Skip empty lines from client negotiation bytes, only close on actual disconnect + while True: + name_input = await readline2(_reader, _writer) + if name_input is None: + _writer.close() + return + if name_input.strip(): + break player_name = name_input.strip()