Fixed a bug in telnet protocol that stripped wrong characters at the end. Resolves Issue 318.

This commit is contained in:
Griatch 2012-10-28 10:37:14 +01:00
parent 58533165eb
commit ee7a175bf4
2 changed files with 14 additions and 4 deletions

View file

@ -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')))