From: Marcus Eggenberger Date: Sun, 12 Oct 2008 16:47:06 +0000 (+0200) Subject: properly fixing dupes X-Git-Tag: 0.3.1~186 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=722557f44cb857b9467b84c87f742dce8e98a500;ds=sidebyside properly fixing dupes --- 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; }