primitivus (chat): duplicate message check is actually not needed when retrieving local MUC history is disabled

This commit is contained in:
souliane 2015-12-16 13:29:24 +01:00
commit 8aec15cecf

View file

@ -306,24 +306,7 @@ class Chat(PrimitivusWidget, QuickChat):
@param extra (dict): extra data
"""
new_text = ChatText(self, timestamp, nick, my_message, message)
if timestamp and self.content:
for idx in range(len(self.content) - 1, -1, -1):
current_text = self.content[idx]
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
# FIXME: messages that have been sent several times will be displayed only once
if ((idx and self.content[idx - 1].message == message) or
(self.content[idx].message == message) or
(idx < len(self.content) - 2 and self.content[idx + 1].message)):
return
self.content.insert(0 if older else idx + 1, new_text)
break
else:
self.content.append(new_text)
self.content.append(new_text)
if not timestamp:
# XXX: do not send notifications for each line of the history being displayed
# FIXME: this must be changed in the future if the timestamp is passed with