A few typo fixes and NAWS update detection and handling.

This commit is contained in:
mike 2024-04-09 00:12:42 -07:00
parent a1023ebc7e
commit 68a3feb2fe
3 changed files with 8 additions and 4 deletions

View file

@ -468,7 +468,7 @@ class PortalSessionHandler(SessionHandler):
kwargs (any): Each key is a command instruction to the
protocol on the form key = [[args],{kwargs}]. This will
call a method send_<key> on the protocol. If no such
method exixts, it sends the data to a method send_default.
method exits, it sends the data to a method send_default.
"""
# from evennia.server.profiling.timetrace import timetrace # DEBUG

View file

@ -31,6 +31,7 @@ from twisted.internet.task import LoopingCall
from evennia.server.portal import mssp, naws, suppress_ga, telnet_oob, ttype
from evennia.server.portal.mccp import MCCP, Mccp, mccp_compress
from evennia.server.portal.mxp import Mxp, mxp_parse
from evennia.server.portal.naws import NAWS
from evennia.utils import ansi
from evennia.utils.utils import class_from_module, to_bytes
@ -91,9 +92,12 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
of incoming data.
"""
# print(f"telnet dataReceived: {data}")
try:
super().dataReceived(data)
# Do we have a NAWS update?
if NAWS in data and len([data[i:i+1] for i in range(0, len(data))]) == 9:
self.sessionhandler.sync(self.sessionhandler.get(self.sessid))
else:
super().dataReceived(data)
except ValueError as err:
from evennia.utils import logger

View file

@ -268,7 +268,7 @@ class ServerSession(_BASE_SESSION_CLASS):
Notes:
Since protocols can vary, no checking is done
as to the existene of the flag or not. The input
as to the existence of the flag or not. The input
data should have been validated before this call.
"""