diff 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
line wrap: on
line diff
--- a/frontends/primitivus/chat.py	Mon Jul 12 17:50:00 2010 +0800
+++ b/frontends/primitivus/chat.py	Mon Jul 12 18:54:55 2010 +0800
@@ -66,7 +66,8 @@
         if self.parent.show_short_nick:
             render_txt.append(('my_nick' if my_mess else 'other_nick',"**" if my_mess else "*"))
         else:
-            render_txt.append(('my_nick' if my_mess else 'other_nick',"[%s] " % self.from_jid))
+            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)
+            render_txt.append(('my_nick' if my_mess else 'other_nick',"[%s] " % nick))
         render_txt.append(self.message)
         return urwid.Text(render_txt, align=self.align)