/me now works in all chatabs

fixes #2302
This commit is contained in:
Florent Le Coz 2011-11-25 11:21:20 +01:00
parent 72c634aaea
commit bb22b39d55
2 changed files with 3 additions and 7 deletions

View file

@ -1298,10 +1298,6 @@ class MucTab(ChatTab):
in the room anymore
"""
self.log_message(txt, time, nickname)
special_message = False
if txt.startswith('/me '):
txt = "\x192}* \x195}" + nickname + ' ' + txt[4:]
special_message = True
user = self.get_user_by_name(nickname) if nickname is not None else None
if user:
user.set_last_talked(datetime.now())
@ -1319,9 +1315,6 @@ class MucTab(ChatTab):
highlight = self.do_highlight(txt, time, nickname)
if highlight:
nick_color = highlight
if special_message:
txt = '\x195}%s' % (txt,)
nickname = None
time = time or datetime.now()
self._text_buffer.add_message(txt, time, nickname, nick_color, history, user)

View file

@ -36,6 +36,9 @@ class TextBuffer(object):
def add_message(self, txt, time=None, nickname=None, nick_color=None, history=None, user=None):
time = time or datetime.now()
if txt.startswith('/me '):
txt = "\x192}* \x195}" + nickname + ' ' + txt[4:]
nickname = None
msg = Message(txt='%s\x19o'%(txt.replace('\t', ' '),), nick_color=nick_color,
time=time, str_time=time.strftime("%Y-%m-%d %H:%M:%S")\
if history else time.strftime("%H:%M:%S"),\