primitivus (chat): duplicate message check is actually not needed when retrieving local MUC history is disabled
This commit is contained in:
parent
3cc6e41ad6
commit
8aec15cecf
1 changed files with 1 additions and 18 deletions
|
|
@ -306,24 +306,7 @@ class Chat(PrimitivusWidget, QuickChat):
|
||||||
@param extra (dict): extra data
|
@param extra (dict): extra data
|
||||||
"""
|
"""
|
||||||
new_text = ChatText(self, timestamp, nick, my_message, message)
|
new_text = ChatText(self, timestamp, nick, my_message, message)
|
||||||
if timestamp and self.content:
|
self.content.append(new_text)
|
||||||
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)
|
|
||||||
if not timestamp:
|
if not timestamp:
|
||||||
# XXX: do not send notifications for each line of the history being displayed
|
# 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
|
# FIXME: this must be changed in the future if the timestamp is passed with
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue