diff frontends/src/primitivus/chat.py @ 518:75216d94a89d

primitivus: fixed messages order in chat window
author Goffi <goffi@goffi.org>
date Sun, 21 Oct 2012 12:03:29 +0200
parents fe79a724e6fa
children 4d7248f4c577
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Sat Oct 20 19:22:51 2012 +0200
+++ b/frontends/src/primitivus/chat.py	Sun Oct 21 12:03:29 2012 +0200
@@ -247,8 +247,9 @@
                     timestamp - time.mktime(_chat_text.timestamp) < 5):
                     #we discard double messages, to avoid backlog / history conflict
                     return
-        my_jid = self.host.profiles[profile]['whoami']
         self.content.append(ChatText(self, timestamp or None, nick, mymess, msg))
+        if timestamp:
+            self.content.sort(key=lambda chat_text: chat_text.timestamp)
         if self.text_list.get_focus()[1] == len(self.content)-2:
             #we don't change focus if user is not at the bottom
             #as that mean that he is probably watching discussion history