Primitivus: avoid double messages in case of backlog/history conflict

This commit is contained in:
Goffi 2012-10-20 17:24:30 +02:00
commit 920931ce8b

View file

@ -241,6 +241,12 @@ class Chat(urwid.WidgetWrap, QuickChat):
jid,nick,mymess = QuickChat.printMessage(self, from_jid, msg, profile, timestamp)
except TypeError:
return
if timestamp:
for _chat_text in self.content:
if (msg == _chat_text.message and
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 self.text_list.get_focus()[1] == len(self.content)-2: