From 5808377085c37b32c95279c607dd9ffce11c2316 Mon Sep 17 00:00:00 2001 From: Rachel Blackman Date: Sun, 4 Jun 2017 18:46:31 -0700 Subject: [PATCH] Change IAC + GA to key off of MUDPROMPT @option Several clients interpret IAC + GA as a linefeed, in order to support MUDs that always end a line with them. This causes Evennia to spew empty lines everywhere if IAC + GA is always on. --- evennia/server/inputfuncs.py | 3 ++- evennia/server/portal/telnet.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/evennia/server/inputfuncs.py b/evennia/server/inputfuncs.py index 17442ba6e..509d84be4 100644 --- a/evennia/server/inputfuncs.py +++ b/evennia/server/inputfuncs.py @@ -193,7 +193,8 @@ def client_options(session, *args, **kwargs): "UTF-8", "SCREENREADER", "ENCODING", "MCCP", "SCREENHEIGHT", "SCREENWIDTH", "INPUTDEBUG", - "RAW", "NOCOLOR")) + "RAW", "NOCOLOR", + "MUDPROMPT")) session.msg(client_options=options) return diff --git a/evennia/server/portal/telnet.py b/evennia/server/portal/telnet.py index dbccf5e5b..e9f43443d 100644 --- a/evennia/server/portal/telnet.py +++ b/evennia/server/portal/telnet.py @@ -221,7 +221,9 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): # escape IAC in line mode, and correctly add \r\n line += self.delimiter line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n') - return self.transport.write(mccp_compress(self, line + IAC + GA)) + if self.protocol_flags.get("MUDPROMPT", False): + line = line + IAC + GA + return self.transport.write(mccp_compress(self, line)) # Session hooks