- msgList = Core::requestMsgs(coreSession()->user(), bufferId, -1, last, additional);
- msgIter = msgList.constBegin();
- msgListEnd = msgList.constEnd();
- while(msgIter != msgListEnd) {
- backlog << qVariantFromValue(*msgIter);
- msgIter++;
+
+ // only fetch additional messages if they they continue seemlessly
+ // that is, if the list of messages is not truncated by the limit
+ if(last.isValid() && last == oldestMessage) {
+ msgList = Core::requestMsgs(coreSession()->user(), bufferId, -1, last, additional);
+ msgIter = msgList.constBegin();
+ msgListEnd = msgList.constEnd();
+ while(msgIter != msgListEnd) {
+ backlog << qVariantFromValue(*msgIter);
+ msgIter++;
+ }