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

@ -93,8 +93,8 @@ Up requirements to Django 3.2+, Twisted 21+
- Split `return_appearance` hook with helper methods and have it use a template
string in order to make it easier to override.
- Add validation question to default account creation.
- Add `LOCALECHO` client option to add server-side echo for clients that does
not support this (useful for getting a complete log).
### Evennia 0.9.5 (2019-2020)

View file

@ -696,6 +696,7 @@ class CmdOption(COMMAND_DEFAULT_CLASS):
"XTERM256": validate_bool,
"INPUTDEBUG": validate_bool,
"FORCEDENDLINE": validate_bool,
"LOCALECHO": validate_bool,
}
name = self.lhs.upper()

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 = {}