From 41ad2aed5d5aa9fa2fb3de845281d5cbd7856c9a Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 18 Apr 2016 22:25:24 +0200 Subject: [PATCH] Fixed the telnet WILL/WONT ECHO (the echo protocol option) to work as expected from the server side - by telling the client that the server WON'T echo, we are implicitly telling the client that IT should then do the echoing. This is a bit unintuitive and was defined in the wrong order. Fixed now. --- evennia/server/portal/telnet.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/evennia/server/portal/telnet.py b/evennia/server/portal/telnet.py index 630910036f..d41ea5c2ff 100644 --- a/evennia/server/portal/telnet.py +++ b/evennia/server/portal/telnet.py @@ -328,11 +328,18 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): self.transport.write(mccp_compress(self, prompt)) else: if echo is not None: - # turn on/off echo + # turn on/off echo. Note that this is a bit turned around since we use + # echo as if we are "turning off the client's echo" when telnet really + # handles it the other way around. if echo: - self.transport.write(mccp_compress(self, IAC+WILL+ECHO)) - else: + # by telling the client that WE WON'T echo, the client knows + # that IT should echo. This is the expected behavior from + # our perspective. self.transport.write(mccp_compress(self, IAC+WONT+ECHO)) + else: + # by telling the client that WE WILL echo, the client can + # safely turn OFF its OWN echo. + self.transport.write(mccp_compress(self, IAC+WILL+ECHO)) if raw: # no processing self.sendLine(text)