mirror of
https://github.com/evennia/evennia.git
synced 2026-03-21 23:36:30 +01:00
Fixed a bug in telnet protocol that stripped wrong characters at the end. Resolves Issue 318.
This commit is contained in:
parent
58533165eb
commit
ee7a175bf4
2 changed files with 14 additions and 4 deletions
|
|
@ -202,10 +202,17 @@ class CmdSet(object):
|
|||
Returns a new cmdset with the same settings as this one
|
||||
(no actual commands are copied over)
|
||||
"""
|
||||
cmdset = self.__class__()
|
||||
cmdset.__dict__.update(dict((key, val) for key, val in self.__dict__.items() if key in self.to_duplicate))
|
||||
cmdset.key_mergetypes = self.key_mergetypes.copy() #copy.deepcopy(self.key_mergetypes)
|
||||
cmdset = CmdSet()
|
||||
for key, val in ((key, getattr(self, key)) for key in self.to_duplicate):
|
||||
if val != getattr(cmdset, key):
|
||||
# only copy if different from default; avoid turning class-vars into instance vars
|
||||
setattr(cmdset, key, val)
|
||||
cmdset.key_mergetypes = self.key_mergetypes.copy()
|
||||
return cmdset
|
||||
#cmdset = self.__class__()
|
||||
#cmdset.__dict__.update(dict((key, val) for key, val in self.__dict__.items() if key in self.to_duplicate))
|
||||
#cmdset.key_mergetypes = self.key_mergetypes.copy() #copy.deepcopy(self.key_mergetypes)
|
||||
#return cmdset
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@ sessions etc.
|
|||
|
||||
"""
|
||||
|
||||
import re
|
||||
from twisted.conch.telnet import Telnet, StatefulTelnetProtocol, IAC, LINEMODE
|
||||
from src.server.session import Session
|
||||
from src.server import ttype, mssp
|
||||
from src.server.mccp import Mccp, mccp_compress, MCCP
|
||||
from src.utils import utils, ansi, logger
|
||||
|
||||
_RE_N = re.compile(r"\{n$")
|
||||
|
||||
class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||
"""
|
||||
Each player connecting over telnet (ie using most traditional mud
|
||||
|
|
@ -163,4 +166,4 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
self.sendLine(string)
|
||||
else:
|
||||
# we need to make sure to kill the color at the end in order to match the webclient output.
|
||||
self.sendLine(ansi.parse_ansi(string.rstrip("{n") + "{n", strip_ansi=nomarkup, xterm256=ttype.get('256 COLORS')))
|
||||
self.sendLine(ansi.parse_ansi(_RE_N.sub("", string) + "{n", strip_ansi=nomarkup, xterm256=ttype.get('256 COLORS')))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue