primitivus: fixed messages order in chat window

This commit is contained in:
Goffi 2012-10-21 12:03:29 +02:00
commit 031bd3134f

View file

@ -247,8 +247,9 @@ class Chat(urwid.WidgetWrap, QuickChat):
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