X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fmessagemodel.cpp;h=818c254e8d7dba52ebfcb5d6f8778acf2d71c173;hp=868082cea12e5af4157546c7bc48e0ee531af26b;hb=8f88a7c2bccdca34b61e046160cd83ada7a16a7f;hpb=b433321cc124a1a34f5f7f53acc699f5afd1ba04 diff --git a/src/client/messagemodel.cpp b/src/client/messagemodel.cpp index 868082ce..818c254e 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,8 +277,8 @@ int MessageModel::insertMessagesGracefully(const QList &msglist) { } } - Q_ASSERT(idx == indexForId(grouplist.first().msgId()) && idx == indexForId(grouplist.last().msgId())); - insertMessageGroup(grouplist); + if(!grouplist.isEmpty()) + insertMessageGroup(grouplist); return processedMsgs; }