Add support for latest Twisted and Python 3.9
This commit is contained in:
parent
63009a2a65
commit
a4f5ae2c96
12 changed files with 85 additions and 82 deletions
|
|
@ -15,10 +15,9 @@ This protocol is implemented by the telnet protocol importing
|
|||
mccp_compress and calling it from its write methods.
|
||||
"""
|
||||
import zlib
|
||||
from twisted.python.compat import _bytesChr as chr
|
||||
|
||||
# negotiations for v1 and v2 of the protocol
|
||||
MCCP = chr(86) # b"\x56"
|
||||
MCCP = bytes([86]) # b"\x56"
|
||||
FLUSH = zlib.Z_SYNC_FLUSH
|
||||
|
||||
|
||||
|
|
@ -38,7 +37,7 @@ def mccp_compress(protocol, data):
|
|||
return data
|
||||
|
||||
|
||||
class Mccp(object):
|
||||
class Mccp:
|
||||
"""
|
||||
Implements the MCCP protocol. Add this to a
|
||||
variable on the telnet protocol to set it up.
|
||||
|
|
|
|||
|
|
@ -12,17 +12,16 @@ active players and so on.
|
|||
"""
|
||||
from django.conf import settings
|
||||
from evennia.utils import utils
|
||||
from twisted.python.compat import _bytesChr as bchr
|
||||
|
||||
MSSP = bchr(70) # b"\x46"
|
||||
MSSP_VAR = bchr(1) # b"\x01"
|
||||
MSSP_VAL = bchr(2) # b"\x02"
|
||||
MSSP = bytes([70]) # b"\x46"
|
||||
MSSP_VAR = bytes([1]) # b"\x01"
|
||||
MSSP_VAL = bytes([2]) # b"\x02"
|
||||
|
||||
# try to get the customized mssp info, if it exists.
|
||||
MSSPTable_CUSTOM = utils.variable_from_module(settings.MSSP_META_MODULE, "MSSPTable", default={})
|
||||
|
||||
|
||||
class Mssp(object):
|
||||
class Mssp:
|
||||
"""
|
||||
Implements the MSSP protocol. Add this to a variable on the telnet
|
||||
protocol to set it up.
|
||||
|
|
|
|||
|
|
@ -14,12 +14,11 @@ http://www.gammon.com.au/mushclient/addingservermxp.htm
|
|||
|
||||
"""
|
||||
import re
|
||||
from twisted.python.compat import _bytesChr as bchr
|
||||
|
||||
LINKS_SUB = re.compile(r"\|lc(.*?)\|lt(.*?)\|le", re.DOTALL)
|
||||
|
||||
# MXP Telnet option
|
||||
MXP = bchr(91) # b"\x5b"
|
||||
MXP = bytes([91]) # b"\x5b"
|
||||
|
||||
MXP_TEMPSECURE = "\x1B[4z"
|
||||
MXP_SEND = MXP_TEMPSECURE + '<SEND HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</SEND>"
|
||||
|
|
@ -42,7 +41,7 @@ def mxp_parse(text):
|
|||
return text
|
||||
|
||||
|
||||
class Mxp(object):
|
||||
class Mxp:
|
||||
"""
|
||||
Implements the MXP protocol.
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ client and update it when the size changes
|
|||
"""
|
||||
from codecs import encode as codecs_encode
|
||||
from django.conf import settings
|
||||
from twisted.python.compat import _bytesChr as bchr
|
||||
|
||||
NAWS = bchr(31) # b"\x1f"
|
||||
IS = bchr(0) # b"\x00"
|
||||
NAWS = bytes([31]) # b"\x1f"
|
||||
IS = bytes([0]) # b"\x00"
|
||||
|
||||
# default taken from telnet specification
|
||||
DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||
DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
|
||||
|
|
@ -22,7 +22,7 @@ DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
|
|||
# try to get the customized mssp info, if it exists.
|
||||
|
||||
|
||||
class Naws(object):
|
||||
class Naws:
|
||||
"""
|
||||
Implements the NAWS protocol. Add this to a variable on the telnet
|
||||
protocol to set it up.
|
||||
|
|
|
|||
|
|
@ -13,16 +13,15 @@ It is set as the NOGOAHEAD protocol_flag option.
|
|||
http://www.faqs.org/rfcs/rfc858.html
|
||||
|
||||
"""
|
||||
from twisted.python.compat import _bytesChr as bchr
|
||||
|
||||
SUPPRESS_GA = bchr(3) # b"\x03"
|
||||
SUPPRESS_GA = bytes([3]) # b"\x03"
|
||||
|
||||
# default taken from telnet specification
|
||||
|
||||
# try to get the customized mssp info, if it exists.
|
||||
|
||||
|
||||
class SuppressGA(object):
|
||||
class SuppressGA:
|
||||
"""
|
||||
Implements the SUPRESS-GO-AHEAD protocol. Add this to a variable on the telnet
|
||||
protocol to set it up.
|
||||
|
|
|
|||
|
|
@ -26,23 +26,22 @@ This implements the following telnet OOB communication protocols:
|
|||
import re
|
||||
import json
|
||||
from evennia.utils.utils import is_iter
|
||||
from twisted.python.compat import _bytesChr as bchr
|
||||
|
||||
# General Telnet
|
||||
from twisted.conch.telnet import IAC, SB, SE
|
||||
|
||||
# MSDP-relevant telnet cmd/opt-codes
|
||||
MSDP = bchr(69)
|
||||
MSDP_VAR = bchr(1)
|
||||
MSDP_VAL = bchr(2)
|
||||
MSDP_TABLE_OPEN = bchr(3)
|
||||
MSDP_TABLE_CLOSE = bchr(4)
|
||||
MSDP = bytes([69])
|
||||
MSDP_VAR = bytes([1])
|
||||
MSDP_VAL = bytes([2])
|
||||
MSDP_TABLE_OPEN = bytes([3])
|
||||
MSDP_TABLE_CLOSE = bytes([4])
|
||||
|
||||
MSDP_ARRAY_OPEN = bchr(5)
|
||||
MSDP_ARRAY_CLOSE = bchr(6)
|
||||
MSDP_ARRAY_OPEN = bytes([5])
|
||||
MSDP_ARRAY_CLOSE = bytes([6])
|
||||
|
||||
# GMCP
|
||||
GMCP = bchr(201)
|
||||
GMCP = bytes([201])
|
||||
|
||||
|
||||
# pre-compiled regexes
|
||||
|
|
@ -69,7 +68,7 @@ EVENNIA_TO_GMCP = {
|
|||
# MSDP/GMCP communication handler
|
||||
|
||||
|
||||
class TelnetOOB(object):
|
||||
class TelnetOOB:
|
||||
"""
|
||||
Implements the MSDP and GMCP protocols.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ etc. If the client does not support TTYPE, this will be ignored.
|
|||
|
||||
All data will be stored on the protocol's protocol_flags dictionary,
|
||||
under the 'TTYPE' key.
|
||||
|
||||
"""
|
||||
from twisted.python.compat import _bytesChr as bchr
|
||||
|
||||
# telnet option codes
|
||||
TTYPE = bchr(24) # b"\x18"
|
||||
IS = bchr(0) # b"\x00"
|
||||
SEND = bchr(1) # b"\x01"
|
||||
TTYPE = bytes([24]) # b"\x18"
|
||||
IS = bytes([0]) # b"\x00"
|
||||
SEND = bytes([1]) # b"\x01"
|
||||
|
||||
# terminal capabilities and their codes
|
||||
MTTS = [
|
||||
|
|
@ -30,7 +30,7 @@ MTTS = [
|
|||
]
|
||||
|
||||
|
||||
class Ttype(object):
|
||||
class Ttype:
|
||||
"""
|
||||
Handles ttype negotiations. Called and initiated by the
|
||||
telnet protocol.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue