Fix legacy bytes conversion for older twisted
This commit is contained in:
parent
41986e1288
commit
9df1f9f25f
7 changed files with 19 additions and 28 deletions
|
|
@ -15,10 +15,9 @@ This protocol is implemented by the telnet protocol importing
|
||||||
mccp_compress and calling it from its write methods.
|
mccp_compress and calling it from its write methods.
|
||||||
"""
|
"""
|
||||||
import zlib
|
import zlib
|
||||||
from twisted.python.compat import _bytesChr as chr
|
|
||||||
|
|
||||||
# negotiations for v1 and v2 of the protocol
|
# negotiations for v1 and v2 of the protocol
|
||||||
MCCP = chr(86) # b"\x56"
|
MCCP = bytes([86]) # b"\x56"
|
||||||
FLUSH = zlib.Z_SYNC_FLUSH
|
FLUSH = zlib.Z_SYNC_FLUSH
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,10 @@ active players and so on.
|
||||||
"""
|
"""
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.utils import utils
|
from evennia.utils import utils
|
||||||
from twisted.python.compat import _bytesChr as bchr
|
|
||||||
|
|
||||||
MSSP = bchr(70) # b"\x46"
|
MSSP = bytes([70]) # b"\x46"
|
||||||
MSSP_VAR = bchr(1) # b"\x01"
|
MSSP_VAR = bytes([1]) # b"\x01"
|
||||||
MSSP_VAL = bchr(2) # b"\x02"
|
MSSP_VAL = bytes([2]) # b"\x02"
|
||||||
|
|
||||||
# try to get the customized mssp info, if it exists.
|
# try to get the customized mssp info, if it exists.
|
||||||
MSSPTable_CUSTOM = utils.variable_from_module(settings.MSSP_META_MODULE, "MSSPTable", default={})
|
MSSPTable_CUSTOM = utils.variable_from_module(settings.MSSP_META_MODULE, "MSSPTable", default={})
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,11 @@ http://www.gammon.com.au/mushclient/addingservermxp.htm
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from twisted.python.compat import _bytesChr as bchr
|
|
||||||
|
|
||||||
LINKS_SUB = re.compile(r"\|lc(.*?)\|lt(.*?)\|le", re.DOTALL)
|
LINKS_SUB = re.compile(r"\|lc(.*?)\|lt(.*?)\|le", re.DOTALL)
|
||||||
|
|
||||||
# MXP Telnet option
|
# MXP Telnet option
|
||||||
MXP = bchr(91) # b"\x5b"
|
MXP = bytes([91]) # b"\x5b"
|
||||||
|
|
||||||
MXP_TEMPSECURE = "\x1B[4z"
|
MXP_TEMPSECURE = "\x1B[4z"
|
||||||
MXP_SEND = MXP_TEMPSECURE + '<SEND HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</SEND>"
|
MXP_SEND = MXP_TEMPSECURE + '<SEND HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</SEND>"
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,9 @@ client and update it when the size changes
|
||||||
"""
|
"""
|
||||||
from codecs import encode as codecs_encode
|
from codecs import encode as codecs_encode
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from twisted.python.compat import _bytesChr as bchr
|
|
||||||
|
|
||||||
NAWS = bchr(31) # b"\x1f"
|
NAWS = bytes([31]) # b"\x1f"
|
||||||
IS = bchr(0) # b"\x00"
|
IS = bytes([0]) # b"\x00"
|
||||||
# default taken from telnet specification
|
# default taken from telnet specification
|
||||||
DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||||
DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
|
DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@ It is set as the NOGOAHEAD protocol_flag option.
|
||||||
http://www.faqs.org/rfcs/rfc858.html
|
http://www.faqs.org/rfcs/rfc858.html
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from twisted.python.compat import _bytesChr as bchr
|
SUPPRESS_GA = bytes([3]) # b"\x03"
|
||||||
|
|
||||||
SUPPRESS_GA = bchr(3) # b"\x03"
|
|
||||||
|
|
||||||
# default taken from telnet specification
|
# default taken from telnet specification
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,23 +31,22 @@ applicable.
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
from evennia.utils.utils import is_iter
|
from evennia.utils.utils import is_iter
|
||||||
from twisted.python.compat import _bytesChr as bchr
|
|
||||||
|
|
||||||
# General Telnet
|
# General Telnet
|
||||||
from twisted.conch.telnet import IAC, SB, SE
|
from twisted.conch.telnet import IAC, SB, SE
|
||||||
|
|
||||||
# MSDP-relevant telnet cmd/opt-codes
|
# MSDP-relevant telnet cmd/opt-codes
|
||||||
MSDP = bchr(69)
|
MSDP = bytes([69])
|
||||||
MSDP_VAR = bchr(1)
|
MSDP_VAR = bytes([1])
|
||||||
MSDP_VAL = bchr(2)
|
MSDP_VAL = bytes([2])
|
||||||
MSDP_TABLE_OPEN = bchr(3)
|
MSDP_TABLE_OPEN = bytes([3])
|
||||||
MSDP_TABLE_CLOSE = bchr(4)
|
MSDP_TABLE_CLOSE = bytes([4])
|
||||||
|
|
||||||
MSDP_ARRAY_OPEN = bchr(5)
|
MSDP_ARRAY_OPEN = bytes([5])
|
||||||
MSDP_ARRAY_CLOSE = bchr(6)
|
MSDP_ARRAY_CLOSE = bytes([6])
|
||||||
|
|
||||||
# GMCP
|
# GMCP
|
||||||
GMCP = bchr(201)
|
GMCP = bytes([201])
|
||||||
|
|
||||||
|
|
||||||
# pre-compiled regexes
|
# pre-compiled regexes
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,10 @@ etc. If the client does not support TTYPE, this will be ignored.
|
||||||
All data will be stored on the protocol's protocol_flags dictionary,
|
All data will be stored on the protocol's protocol_flags dictionary,
|
||||||
under the 'TTYPE' key.
|
under the 'TTYPE' key.
|
||||||
"""
|
"""
|
||||||
from twisted.python.compat import _bytesChr as bchr
|
|
||||||
|
|
||||||
# telnet option codes
|
# telnet option codes
|
||||||
TTYPE = bchr(24) # b"\x18"
|
TTYPE = bytes([24]) # b"\x18"
|
||||||
IS = bchr(0) # b"\x00"
|
IS = bytes([0]) # b"\x00"
|
||||||
SEND = bchr(1) # b"\x01"
|
SEND = bytes([1]) # b"\x01"
|
||||||
|
|
||||||
# terminal capabilities and their codes
|
# terminal capabilities and their codes
|
||||||
MTTS = [
|
MTTS = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue