Add LOCALECHO client option for clients not supporting local echoing. Resolve #2258.

This commit is contained in:
Griatch 2021-10-09 00:36:17 +02:00
parent 49886dbff3
commit a7b99a605b
5 changed files with 12 additions and 2 deletions

View file

@ -156,6 +156,7 @@ _CLIENT_OPTIONS = (
"RAW",
"NOCOLOR",
"NOGOAHEAD",
"LOCALECHO",
)
@ -180,6 +181,7 @@ def client_options(session, *args, **kwargs):
inputdebug (bool): Debug input functions
nocolor (bool): Strip color
raw (bool): Turn off parsing
localecho (bool): Turn on server-side echo (for clients not supporting it)
"""
old_flags = session.protocol_flags
@ -239,6 +241,8 @@ def client_options(session, *args, **kwargs):
flags["RAW"] = validate_bool(value)
elif key == "nogoahead":
flags["NOGOAHEAD"] = validate_bool(value)
elif key == "localecho":
flags["LOCALECHO"] = validate_bool(value)
elif key in (
"Char 1",
"Char.Skills 1",

View file

@ -441,6 +441,10 @@ class PortalSessionHandler(SessionHandler):
session.cmd_last = now
self.portal.amp_protocol.send_MsgPortal2Server(session, **kwargs)
# eventual local echo (text input only)
if 'text' in kwargs and session.protocol_flags.get('LOCALECHO', False):
self.data_out(session, text=kwargs['text'])
def data_out(self, session, **kwargs):
"""
Called by server for having the portal relay messages and data

View file

@ -82,6 +82,7 @@ class Session:
"INPUTDEBUG": False,
"RAW": False,
"NOCOLOR": False,
"LOCALECHO": False,
}
self.server_data = {}