Added NAWS negotiation to telnet protocol, for negotiating the client width/height. Use session.get_client_size() to get a tuple of (width, height) for the current output window. Not currently supported by the webclient. Also added options settings.CLIENT_DEFAULT_WIDTH and -HEIGHT for having a fallback. Note that none of Evennia's default systems currently use this width information.

This commit is contained in:
Griatch 2014-08-20 10:21:11 +02:00
parent 699a6ded43
commit 9af3b44e1c
3 changed files with 25 additions and 2 deletions

View file

@ -162,6 +162,17 @@ class ServerSession(Session):
pass
logger.log_infomsg(message)
def get_client_size(self):
"""
Return eventual eventual width and height reported by the
client. Note that this currently only deals with a single
client window (windowID==0) as in traditional telnet session
"""
flags = self.protocol_flags
width = flags.get('SCREENWIDTH', {}).get(0, settings.CLIENT_DEFAULT_WIDTH)
height = flags.get('SCREENHEIGHT', {}).get(0, settings.CLIENT_DEFAULT_HEIGHT)
return width, height
def update_session_counters(self, idle=False):
"""
Hit this when the user enters a command in order to update idle timers