diff --git a/evennia/commands/default/account.py b/evennia/commands/default/account.py index e45e2a9347..9a4d2d330c 100644 --- a/evennia/commands/default/account.py +++ b/evennia/commands/default/account.py @@ -549,8 +549,11 @@ class CmdOption(COMMAND_DEFAULT_CLASS): try: old_val = flags.get(new_name, False) new_val = validator(new_val) - flags[new_name] = new_val - self.msg("Option |w%s|n was changed from '|w%s|n' to '|w%s|n'." % (new_name, old_val, new_val)) + if old_val == new_val: + self.msg("Option |w%s|n was kept as '|w%s|n'." % (new_name, old_val)) + else: + flags[new_name] = new_val + self.msg("Option |w%s|n was changed from '|w%s|n' to '|w%s|n'." % (new_name, old_val, new_val)) return {new_name: new_val} except Exception as err: self.msg("|rCould not set option |w%s|r:|n %s" % (new_name, err)) @@ -572,7 +575,8 @@ class CmdOption(COMMAND_DEFAULT_CLASS): "TERM": utils.to_str, "UTF-8": validate_bool, "XTERM256": validate_bool, - "INPUTDEBUG": validate_bool} + "INPUTDEBUG": validate_bool, + "FORCEDENDLINE": validate_bool} name = self.lhs.upper() val = self.rhs.strip() diff --git a/evennia/server/portal/suppress_ga.py b/evennia/server/portal/suppress_ga.py index c13fea62ba..bff47e6b2b 100644 --- a/evennia/server/portal/suppress_ga.py +++ b/evennia/server/portal/suppress_ga.py @@ -40,11 +40,9 @@ class SuppressGA(object): self.protocol.protocol_flags["NOGOAHEAD"] = True # tell the client that we prefer to suppress GA ... - self.protocol.will(SUPPRESS_GA).addCallbacks(self.do_suppress_ga, self.dont_suppress_ga) - # ... but also accept if the client really wants not to. - self.protocol.do(SUPPRESS_GA).addCallbacks(self.do_suppress_ga, self.dont_suppress_ga) + self.protocol.will(SUPPRESS_GA).addCallbacks(self.will_suppress_ga, self.wont_suppress_ga) - def dont_suppress_ga(self, option): + def wont_suppress_ga(self, option): """ Called when client requests to not suppress GA. @@ -55,9 +53,9 @@ class SuppressGA(object): self.protocol.protocol_flags["NOGOAHEAD"] = False self.protocol.handshake_done() - def do_suppress_ga(self, option): + def will_suppress_ga(self, option): """ - Client wants to suppress GA + Client will suppress GA Args: option (Option): Not used. diff --git a/evennia/server/portal/telnet.py b/evennia/server/portal/telnet.py index aef96b6f38..17044ae110 100644 --- a/evennia/server/portal/telnet.py +++ b/evennia/server/portal/telnet.py @@ -231,11 +231,15 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): line (str): Line to send. """ - # escape IAC in line mode, and correctly add \r\n - line += self.delimiter - line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n') + # escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line) + line = line.replace(IAC, IAC + IAC) + line = line.replace('\n', '\r\n') if not self.protocol_flags.get("NOGOAHEAD", True): + if self.protocol_flags.get("FORCEDENDLINE", False): + line += "\r\n" line += IAC + GA + elif not line.endswith("\r\n"): + line += "\r\n" return self.transport.write(mccp_compress(self, line)) # Session hooks diff --git a/evennia/server/portal/ttype.py b/evennia/server/portal/ttype.py index b9c3e8b239..4279c52dd6 100644 --- a/evennia/server/portal/ttype.py +++ b/evennia/server/portal/ttype.py @@ -50,6 +50,8 @@ class Ttype(object): """ self.ttype_step = 0 self.protocol = protocol + # we set FORCEDENDLINE for clients not supporting ttype + self.protocol.protocol_flags["FORCEDENDLINE"] = True self.protocol.protocol_flags['TTYPE'] = False # is it a safe bet to assume ANSI is always supported? self.protocol.protocol_flags['ANSI'] = True @@ -98,6 +100,10 @@ class Ttype(object): # just start the request chain self.protocol.requestNegotiation(TTYPE, SEND) + # for clients that support TTYPE we assume this is not needed + # (they can set it manually if so) + self.protocol.protocol_flags["FORCEDENDLINE"] = False + elif self.ttype_step == 1: # this is supposed to be the name of the client/terminal. # For clients not supporting the extended TTYPE