comparison frontends/primitivus/chat.py @ 126:1b33b681ebd8

Primitivus: sexy nick in chat window
author Goffi <goffi@goffi.org>
date Mon, 12 Jul 2010 18:54:55 +0800
parents 8d611eb9ae48
children 5a88ad24ccc0
comparison
equal deleted inserted replaced
125:8d611eb9ae48 126:1b33b681ebd8
64 time_format = "%c" if self.timestamp < self.parent.day_change else "%H:%M" #if the message was sent before today, we print the full date 64 time_format = "%c" if self.timestamp < self.parent.day_change else "%H:%M" #if the message was sent before today, we print the full date
65 render_txt.append(('date',"[%s]" % time.strftime(time_format, self.timestamp))) 65 render_txt.append(('date',"[%s]" % time.strftime(time_format, self.timestamp)))
66 if self.parent.show_short_nick: 66 if self.parent.show_short_nick:
67 render_txt.append(('my_nick' if my_mess else 'other_nick',"**" if my_mess else "*")) 67 render_txt.append(('my_nick' if my_mess else 'other_nick',"**" if my_mess else "*"))
68 else: 68 else:
69 render_txt.append(('my_nick' if my_mess else 'other_nick',"[%s] " % self.from_jid)) 69 nick = self.from_jid.resource if self.parent.type == "group" else (self.parent.host.CM.getAttr(self.from_jid,'nick') or self.parent.host.CM.getAttr(self.from_jid,'name') or self.from_jid.node)
70 render_txt.append(('my_nick' if my_mess else 'other_nick',"[%s] " % nick))
70 render_txt.append(self.message) 71 render_txt.append(self.message)
71 return urwid.Text(render_txt, align=self.align) 72 return urwid.Text(render_txt, align=self.align)
72 73
73 class Chat(urwid.WidgetWrap, QuickChat): 74 class Chat(urwid.WidgetWrap, QuickChat):
74 75