Enforce LINEMODE state for vanilla telnet. Resolve #1942
This commit is contained in:
parent
dafec2e720
commit
bb370c89fe
2 changed files with 20 additions and 10 deletions
|
|
@ -298,8 +298,8 @@ class CmdPy(COMMAND_DEFAULT_CLASS):
|
||||||
being parsed as HTML in the webclient but not in telnet clients)
|
being parsed as HTML in the webclient but not in telnet clients)
|
||||||
|
|
||||||
Without argument, open a Python console in-game. This is a full console,
|
Without argument, open a Python console in-game. This is a full console,
|
||||||
accepting multi-line Python code for testing and debugging. Type `exit` to
|
accepting multi-line Python code for testing and debugging. Type `exit()` to
|
||||||
return to the game. If Evennia is reloaded, thek console will be closed.
|
return to the game. If Evennia is reloaded, the console will be closed.
|
||||||
|
|
||||||
Enter a line of instruction after the 'py' command to execute it
|
Enter a line of instruction after the 'py' command to execute it
|
||||||
immediately. Separate multiple commands by ';' or open the code editor
|
immediately. Separate multiple commands by ';' or open the code editor
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ import re
|
||||||
from twisted.internet import protocol
|
from twisted.internet import protocol
|
||||||
from twisted.internet.task import LoopingCall
|
from twisted.internet.task import LoopingCall
|
||||||
from twisted.conch.telnet import Telnet, StatefulTelnetProtocol
|
from twisted.conch.telnet import Telnet, StatefulTelnetProtocol
|
||||||
from twisted.conch.telnet import IAC, NOP, LINEMODE, GA, WILL, WONT, ECHO, NULL
|
from twisted.conch.telnet import (IAC, NOP, LINEMODE, GA, WILL, WONT, ECHO, NULL,
|
||||||
|
MODE, LINEMODE_EDIT, LINEMODE_TRAPSIG)
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.server.session import Session
|
from evennia.server.session import Session
|
||||||
from evennia.server.portal import ttype, mssp, telnet_oob, naws, suppress_ga
|
from evennia.server.portal import ttype, mssp, telnet_oob, naws, suppress_ga
|
||||||
|
|
@ -51,6 +52,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
This is called when the connection is first established.
|
This is called when the connection is first established.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
# important in order to work normally with standard telnet
|
||||||
|
self.do(LINEMODE)
|
||||||
# initialize the session
|
# initialize the session
|
||||||
self.line_buffer = b""
|
self.line_buffer = b""
|
||||||
client_address = self.transport.client
|
client_address = self.transport.client
|
||||||
|
|
@ -146,8 +149,14 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
enable (bool): If this option should be enabled.
|
enable (bool): If this option should be enabled.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return (option == LINEMODE or
|
if option == LINEMODE:
|
||||||
option == ttype.TTYPE or
|
# make sure to activate line mode with local editing for all clients
|
||||||
|
self.requestNegotiation(LINEMODE, MODE +
|
||||||
|
bytes(chr(ord(LINEMODE_EDIT) +
|
||||||
|
ord(LINEMODE_TRAPSIG)), 'ascii'))
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return (option == ttype.TTYPE or
|
||||||
option == naws.NAWS or
|
option == naws.NAWS or
|
||||||
option == MCCP or
|
option == MCCP or
|
||||||
option == mssp.MSSP or
|
option == mssp.MSSP or
|
||||||
|
|
@ -164,7 +173,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
enable (bool): If this option should be enabled.
|
enable (bool): If this option should be enabled.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return (option == MCCP or
|
return (option == LINEMODE or
|
||||||
|
option == MCCP or
|
||||||
option == ECHO or
|
option == ECHO or
|
||||||
option == suppress_ga.SUPPRESS_GA)
|
option == suppress_ga.SUPPRESS_GA)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue