Escaped the IRC username to avoid it being parsed for ANSI colors (keeping ansi parsing in normal text for now). Resolves #935."

This commit is contained in:
Griatch 2016-04-11 23:30:46 +02:00
parent 86b6261b02
commit 3c1245b1a6

View file

@ -11,7 +11,7 @@ from twisted.application import internet
from twisted.words.protocols import irc from twisted.words.protocols import irc
from twisted.internet import protocol, reactor from twisted.internet import protocol, reactor
from evennia.server.session import Session from evennia.server.session import Session
from evennia.utils import logger, utils from evennia.utils import logger, utils, ansi
# IRC colors # IRC colors
@ -177,6 +177,7 @@ class IRCBot(irc.IRCClient, Session):
""" """
if not msg.startswith('***'): if not msg.startswith('***'):
user = user.split('!', 1)[0] user = user.split('!', 1)[0]
user = ansi.raw(user)
self.data_in("bot_data_in %s@%s: %s" % (user, channel, msg)) self.data_in("bot_data_in %s@%s: %s" % (user, channel, msg))
def action(self, user, channel, msg): def action(self, user, channel, msg):
@ -202,6 +203,7 @@ class IRCBot(irc.IRCClient, Session):
kwargs (any): Other data from protocol. kwargs (any): Other data from protocol.
""" """
self.sessionhandler.data_in(self, text=text, **kwargs) self.sessionhandler.data_in(self, text=text, **kwargs)
def send_text(self, *args, **kwargs): def send_text(self, *args, **kwargs):