Resolve merge conflicts

This commit is contained in:
Griatch 2018-01-29 00:16:30 +01:00
commit 0ae76233ee
5 changed files with 24 additions and 16 deletions

View file

@ -549,8 +549,11 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
try: try:
old_val = flags.get(new_name, False) old_val = flags.get(new_name, False)
new_val = validator(new_val) new_val = validator(new_val)
flags[new_name] = new_val if old_val == new_val:
self.msg("Option |w%s|n was changed from '|w%s|n' to '|w%s|n'." % (new_name, 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} return {new_name: new_val}
except Exception as err: except Exception as err:
self.msg("|rCould not set option |w%s|r:|n %s" % (new_name, 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, "TERM": utils.to_str,
"UTF-8": validate_bool, "UTF-8": validate_bool,
"XTERM256": validate_bool, "XTERM256": validate_bool,
"INPUTDEBUG": validate_bool} "INPUTDEBUG": validate_bool,
"FORCEDENDLINE": validate_bool}
name = self.lhs.upper() name = self.lhs.upper()
val = self.rhs.strip() val = self.rhs.strip()

View file

@ -40,11 +40,9 @@ class SuppressGA(object):
self.protocol.protocol_flags["NOGOAHEAD"] = True self.protocol.protocol_flags["NOGOAHEAD"] = True
# tell the client that we prefer to suppress GA ... # tell the client that we prefer to suppress GA ...
self.protocol.will(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)
# ... but also accept if the client really wants not to.
self.protocol.do(SUPPRESS_GA).addCallbacks(self.do_suppress_ga, self.dont_suppress_ga)
def dont_suppress_ga(self, option): def wont_suppress_ga(self, option):
""" """
Called when client requests to not suppress GA. Called when client requests to not suppress GA.
@ -55,9 +53,9 @@ class SuppressGA(object):
self.protocol.protocol_flags["NOGOAHEAD"] = False self.protocol.protocol_flags["NOGOAHEAD"] = False
self.protocol.handshake_done() 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: Args:
option (Option): Not used. option (Option): Not used.

View file

@ -243,11 +243,15 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
line (str): Line to send. line (str): Line to send.
""" """
# escape IAC in line mode, and correctly add \r\n # escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line)
line += self.delimiter line = line.replace(IAC, IAC + IAC)
line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n') line = line.replace('\n', '\r\n')
if not self.protocol_flags.get("NOGOAHEAD", True): if not self.protocol_flags.get("NOGOAHEAD", True):
if self.protocol_flags.get("FORCEDENDLINE", False):
line += "\r\n"
line += IAC + GA line += IAC + GA
elif not line.endswith("\r\n"):
line += "\r\n"
return self.transport.write(mccp_compress(self, line)) return self.transport.write(mccp_compress(self, line))
# Session hooks # Session hooks

View file

@ -50,6 +50,8 @@ class Ttype(object):
""" """
self.ttype_step = 0 self.ttype_step = 0
self.protocol = protocol self.protocol = protocol
# we set FORCEDENDLINE for clients not supporting ttype
self.protocol.protocol_flags["FORCEDENDLINE"] = True
self.protocol.protocol_flags['TTYPE'] = False self.protocol.protocol_flags['TTYPE'] = False
# is it a safe bet to assume ANSI is always supported? # is it a safe bet to assume ANSI is always supported?
self.protocol.protocol_flags['ANSI'] = True self.protocol.protocol_flags['ANSI'] = True
@ -98,6 +100,10 @@ class Ttype(object):
# just start the request chain # just start the request chain
self.protocol.requestNegotiation(TTYPE, SEND) 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: elif self.ttype_step == 1:
# this is supposed to be the name of the client/terminal. # this is supposed to be the name of the client/terminal.
# For clients not supporting the extended TTYPE # For clients not supporting the extended TTYPE

View file

@ -846,10 +846,6 @@ class EvMenu(object):
else: else:
self.caller.msg(_HELP_NO_OPTION_MATCH, session=self._session) self.caller.msg(_HELP_NO_OPTION_MATCH, session=self._session)
if not (self.options or self.default):
# no options - we are at the end of the menu.
self.close_menu()
def display_nodetext(self): def display_nodetext(self):
self.caller.msg(self.nodetext, session=self._session) self.caller.msg(self.nodetext, session=self._session)