diff frontends/src/primitivus/chat.py @ 1389:eb907923dce9

quick_frontend, primivitus: revert changes made in rev 1386 (1f3513cfb246) concerning ChatText.nick: was mixing MUC occupant nick and roster contact nick/node
author souliane <souliane@mailoo.org>
date Wed, 25 Mar 2015 09:42:05 +0100
parents a025242bebe7
children 337be5318177
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Tue Mar 24 17:31:08 2015 +0100
+++ b/frontends/src/primitivus/chat.py	Wed Mar 25 09:42:05 2015 +0100
@@ -37,9 +37,10 @@
 class ChatText(urwid.FlowWidget):
     """Manage the printing of chat message"""
 
-    def __init__(self, parent, timestamp, my_mess, message, align='left', is_info=False):
+    def __init__(self, parent, timestamp, nick, my_mess, message, align='left', is_info=False):
         self.parent = parent
         self.timestamp = time.localtime(timestamp)
+        self.nick = nick
         self.my_mess = my_mess
         self.message = unicode(message)
         self.align = align
@@ -72,7 +73,7 @@
             if self.parent.show_short_nick:
                 render_txt.append(('my_nick' if self.my_mess else 'other_nick', "**" if self.my_mess else "*"))
             else:
-                render_txt.append(('my_nick' if self.my_mess else 'other_nick', "[%s] " % self.parent.nick))
+                render_txt.append(('my_nick' if self.my_mess else 'other_nick', "[%s] " % self.nick))
         render_txt.append(self.message)
         txt_widget = urwid.Text(render_txt, align=self.align)
         if self.is_info:
@@ -299,7 +300,7 @@
         except TypeError:
             # None is returned, the message is managed
             return
-        new_text = ChatText(self, timestamp, mymess, msg)
+        new_text = ChatText(self, timestamp, nick, mymess, msg)
 
         if timestamp and self.content:
             for idx in range(len(self.content) - 1, -1, -1):
@@ -339,7 +340,7 @@
             timestamp = float(extra['timestamp'])
         except KeyError:
             timestamp = None
-        _widget = ChatText(self, timestamp, False, msg, is_info=True)
+        _widget = ChatText(self, timestamp, None, False, msg, is_info=True)
         self.content.append(_widget)
         self._notify(msg=msg)