From 722557f44cb857b9467b84c87f742dce8e98a500 Mon Sep 17 00:00:00 2001 From: Marcus Eggenberger Date: Sun, 12 Oct 2008 18:47:06 +0200 Subject: [PATCH] properly fixing dupes --- src/client/messagemodel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/messagemodel.cpp b/src/client/messagemodel.cpp index 868082ce..09d8ddc8 100644 --- a/src/client/messagemodel.cpp +++ b/src/client/messagemodel.cpp @@ -218,6 +218,11 @@ int MessageModel::insertMessagesGracefully(const QList &msglist) { break; processedMsgs++; + if(grouplist.isEmpty()) { // as long as we don't have a starting point, we have to update the dupeId + idx = indexForId((*iter).msgId()); + if(idx >= 0 && !_messageList.isEmpty()) + dupeId = _messageList[idx]->msgId(); + } if((*iter).msgId() != dupeId) { if(!grouplist.isEmpty()) { QDateTime nextTs = grouplist.value(0).timestamp(); @@ -244,6 +249,11 @@ int MessageModel::insertMessagesGracefully(const QList &msglist) { break; processedMsgs++; + if(grouplist.isEmpty()) { // as long as we don't have a starting point, we have to update the dupeId + idx = indexForId((*iter).msgId()); + if(idx >= 0 && !_messageList.isEmpty()) + dupeId = _messageList[idx]->msgId(); + } if((*iter).msgId() != dupeId) { if(!grouplist.isEmpty()) { QDateTime nextTs = grouplist.value(0).timestamp(); @@ -267,7 +277,6 @@ int MessageModel::insertMessagesGracefully(const QList &msglist) { } } - Q_ASSERT(idx == indexForId(grouplist.first().msgId()) && idx == indexForId(grouplist.last().msgId())); insertMessageGroup(grouplist); return processedMsgs; } -- 2.20.1