Added a new flag in the options/protocol_flags to ignore or follow NAWS updates.

This commit is contained in:
mike 2024-04-09 12:20:52 -07:00
parent 8011750931
commit c94b7f47c1
4 changed files with 17 additions and 1 deletions

View file

@ -57,6 +57,7 @@ class Naws:
option (Option): Not used.
"""
self.protocol.protocol_flags["AUTORESIZE"] = False
self.protocol.handshake_done()
def do_naws(self, option):
@ -67,6 +68,7 @@ class Naws:
option (Option): Not used.
"""
self.protocol.protocol_flags["AUTORESIZE"] = True
self.protocol.handshake_done()
def negotiate_sizes(self, options):

View file

@ -94,8 +94,12 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
"""
try:
# Do we have a NAWS update?
if NAWS in data and len([data[i:i+1] for i in range(0, len(data))]) == 9:
if (NAWS in data and
len([data[i:i+1] for i in range(0, len(data))]) == 9 and
# Is auto resizing on?
self.protocol_flags.get('AUTORESIZE')):
self.sessionhandler.sync(self.sessionhandler.get(self.sessid))
super().dataReceived(data)
except ValueError as err:
from evennia.utils import logger