Merge branch 'master' into develop
This commit is contained in:
commit
64712f704d
4 changed files with 14 additions and 7 deletions
|
|
@ -40,6 +40,9 @@ class SuppressGA(object):
|
||||||
self.protocol = protocol
|
self.protocol = protocol
|
||||||
|
|
||||||
self.protocol.protocol_flags["NOGOAHEAD"] = True
|
self.protocol.protocol_flags["NOGOAHEAD"] = True
|
||||||
|
self.protocol.protocol_flags[
|
||||||
|
"NOPROMPTGOAHEAD"
|
||||||
|
] = True # Used to send a GA after a prompt line only, set in TTYPE (per client)
|
||||||
# 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.will_suppress_ga, self.wont_suppress_ga)
|
self.protocol.will(SUPPRESS_GA).addCallbacks(self.will_suppress_ga, self.wont_suppress_ga)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,9 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
|
||||||
prompt = mxp_parse(prompt)
|
prompt = mxp_parse(prompt)
|
||||||
prompt = to_bytes(prompt, self)
|
prompt = to_bytes(prompt, self)
|
||||||
prompt = prompt.replace(IAC, IAC + IAC).replace(b"\n", b"\r\n")
|
prompt = prompt.replace(IAC, IAC + IAC).replace(b"\n", b"\r\n")
|
||||||
prompt += IAC + GA
|
if not self.protocol_flags.get("NOPROMPTGOAHEAD",
|
||||||
|
self.protocol_flags.get("NOGOAHEAD", True)):
|
||||||
|
prompt += IAC + GA
|
||||||
self.transport.write(mccp_compress(self, prompt))
|
self.transport.write(mccp_compress(self, prompt))
|
||||||
else:
|
else:
|
||||||
if echo is not None:
|
if echo is not None:
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,6 @@ class TestTelnet(TwistedTestCase):
|
||||||
self.transport.client = ["localhost"]
|
self.transport.client = ["localhost"]
|
||||||
self.transport.setTcpKeepAlive = Mock()
|
self.transport.setTcpKeepAlive = Mock()
|
||||||
d = self.proto.makeConnection(self.transport)
|
d = self.proto.makeConnection(self.transport)
|
||||||
|
|
||||||
# test suppress_ga
|
# test suppress_ga
|
||||||
self.assertTrue(self.proto.protocol_flags["NOGOAHEAD"])
|
self.assertTrue(self.proto.protocol_flags["NOGOAHEAD"])
|
||||||
self.proto.dataReceived(IAC + DONT + SUPPRESS_GA)
|
self.proto.dataReceived(IAC + DONT + SUPPRESS_GA)
|
||||||
|
|
@ -246,13 +245,15 @@ class TestTelnet(TwistedTestCase):
|
||||||
self.assertEqual(self.proto.protocol_flags["SCREENHEIGHT"][0], 45)
|
self.assertEqual(self.proto.protocol_flags["SCREENHEIGHT"][0], 45)
|
||||||
self.assertEqual(self.proto.handshakes, 6)
|
self.assertEqual(self.proto.handshakes, 6)
|
||||||
# test ttype
|
# test ttype
|
||||||
self.assertTrue(self.proto.protocol_flags["FORCEDENDLINE"])
|
|
||||||
self.assertFalse(self.proto.protocol_flags["TTYPE"])
|
self.assertFalse(self.proto.protocol_flags["TTYPE"])
|
||||||
self.assertTrue(self.proto.protocol_flags["ANSI"])
|
self.assertTrue(self.proto.protocol_flags["ANSI"])
|
||||||
self.proto.dataReceived(IAC + WILL + TTYPE)
|
self.proto.dataReceived(IAC + WILL + TTYPE)
|
||||||
self.proto.dataReceived(b"".join([IAC, SB, TTYPE, IS, b"MUDLET", IAC, SE]))
|
self.proto.dataReceived(b"".join([IAC, SB, TTYPE, IS, b"MUDLET", IAC, SE]))
|
||||||
self.assertTrue(self.proto.protocol_flags["XTERM256"])
|
self.assertTrue(self.proto.protocol_flags["XTERM256"])
|
||||||
self.assertEqual(self.proto.protocol_flags["CLIENTNAME"], "MUDLET")
|
self.assertEqual(self.proto.protocol_flags["CLIENTNAME"], "MUDLET")
|
||||||
|
self.assertTrue(self.proto.protocol_flags["FORCEDENDLINE"])
|
||||||
|
self.assertTrue(self.proto.protocol_flags["NOGOAHEAD"])
|
||||||
|
self.assertFalse(self.proto.protocol_flags["NOPROMPTGOAHEAD"])
|
||||||
self.proto.dataReceived(b"".join([IAC, SB, TTYPE, IS, b"XTERM", IAC, SE]))
|
self.proto.dataReceived(b"".join([IAC, SB, TTYPE, IS, b"XTERM", IAC, SE]))
|
||||||
self.proto.dataReceived(b"".join([IAC, SB, TTYPE, IS, b"MTTS 137", IAC, SE]))
|
self.proto.dataReceived(b"".join([IAC, SB, TTYPE, IS, b"MTTS 137", IAC, SE]))
|
||||||
self.assertEqual(self.proto.handshakes, 5)
|
self.assertEqual(self.proto.handshakes, 5)
|
||||||
|
|
|
||||||
|
|
@ -119,10 +119,11 @@ class Ttype(object):
|
||||||
if clientname.startswith("MUDLET"):
|
if clientname.startswith("MUDLET"):
|
||||||
# supports xterm256 stably since 1.1 (2010?)
|
# supports xterm256 stably since 1.1 (2010?)
|
||||||
xterm256 = clientname.split("MUDLET", 1)[1].strip() >= "1.1"
|
xterm256 = clientname.split("MUDLET", 1)[1].strip() >= "1.1"
|
||||||
self.protocol.protocol_flags["FORCEDENDLINE"] = False
|
# Mudlet likes GA's on a prompt line for the prompt trigger to
|
||||||
|
# match, if it's not wanting NOGOAHEAD.
|
||||||
if clientname.startswith("TINTIN++"):
|
if not self.protocol.protocol_flags["NOGOAHEAD"]:
|
||||||
self.protocol.protocol_flags["FORCEDENDLINE"] = True
|
self.protocol.protocol_flags["NOGOAHEAD"] = True
|
||||||
|
self.protocol.protocol_flags["NOPROMPTGOAHEAD"] = False
|
||||||
|
|
||||||
if (
|
if (
|
||||||
clientname.startswith("XTERM")
|
clientname.startswith("XTERM")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue