# HG changeset patch # User souliane # Date 1408898372 -7200 # Node ID 8870417c8e8cd360a8045cde5dd6e4477ce52c77 # Parent d6c3fea5ecfe94692f67028e9fa61164a02ca21a primitivus (chat): fixes the messages display when opening a new chat window diff -r d6c3fea5ecfe -r 8870417c8e8c frontends/src/primitivus/chat.py --- a/frontends/src/primitivus/chat.py Sat Aug 23 20:26:04 2014 +0200 +++ b/frontends/src/primitivus/chat.py Sun Aug 24 18:39:32 2014 +0200 @@ -297,7 +297,8 @@ if timestamp and self.content: for idx in range(len(self.content) - 1, -1, -1): current_text = self.content[idx] - if new_text.timestamp < current_text.timestamp and idx > 0: + older = new_text.timestamp < current_text.timestamp + if older and idx > 0: continue # the new message is older, we need to insert it upper #we discard double messages, to avoid backlog / history conflict @@ -306,7 +307,7 @@ (idx < len(self.content) - 2 and self.content[idx + 1].message)): return - self.content.insert(idx + 1, new_text) + self.content.insert(0 if older else idx + 1, new_text) break else: self.content.append(new_text)