primitivus (chat): mention is now visible by date in red instead of body (or a "[*]" if date is hidden)

This commit is contained in:
Goffi 2016-06-28 18:31:08 +02:00
commit a16d8bfc01

View file

@ -117,12 +117,17 @@ class MessageWidget(urwid.WidgetWrap):
"""Generate text markup according to message data and Widget options"""
markup = []
d = self.mess_data
mention = d.mention
# timestamp
if self.parent.show_timestamp:
# if the message was sent before today, we print the full date
time_format = u"%c" if self.timestamp < self.parent.day_change else u"%H:%M"
markup.append(('date', u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1]))))
attr = 'msg_mention' if mention else 'date'
markup.append((attr, u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1]))))
else:
if mention:
markup.append(('msg_mention', '[*]'))
# nickname
if self.parent.show_short_nick:
@ -136,10 +141,7 @@ class MessageWidget(urwid.WidgetWrap):
markup.append(("msg_lang", u"[{}] ".format(self.selected_lang)))
# message body
if d.mention:
markup.append(("msg_mention", msg))
else:
markup.append(msg)
markup.append(msg)
return markup