X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclientbacklogmanager.cpp;h=b698f4f9137ea552ba1d0f1504f384faed6142f1;hb=7897b8623a42967511e31c68d5c102033a1dcdb9;hp=518ac243b5b64358eb585627b40758dd28915d89;hpb=bcd6ecbc69fba90189c16e84e74488b2817d0700;p=quassel.git diff --git a/src/client/clientbacklogmanager.cpp b/src/client/clientbacklogmanager.cpp index 518ac243..b698f4f9 100644 --- a/src/client/clientbacklogmanager.cpp +++ b/src/client/clientbacklogmanager.cpp @@ -35,9 +35,8 @@ ClientBacklogManager::ClientBacklogManager(QObject *parent) { } -void ClientBacklogManager::receiveBacklog(BufferId bufferId, int lastMsgs, int offset, QVariantList msgs) { - Q_UNUSED(lastMsgs) - Q_UNUSED(offset) +void ClientBacklogManager::receiveBacklog(BufferId bufferId, MsgId first, MsgId last, int limit, int additional, QVariantList msgs) { + Q_UNUSED(first) Q_UNUSED(last) Q_UNUSED(limit) Q_UNUSED(additional) if(msgs.isEmpty()) return; @@ -55,12 +54,27 @@ void ClientBacklogManager::receiveBacklog(BufferId bufferId, int lastMsgs, int o if(!_requester->buffer(bufferId, msglist)) { // this was the last part to buffer stopBuffering(); + reset(); } } else { dispatchMessages(msglist); } } +void ClientBacklogManager::receiveBacklogAll(MsgId first, MsgId last, int limit, int additional, QVariantList msgs) { + Q_UNUSED(first) Q_UNUSED(last) Q_UNUSED(limit) Q_UNUSED(additional) + + MessageList msglist; + foreach(QVariant v, msgs) { + Message msg = v.value(); + msg.setFlags(msg.flags() | Message::Backlog); + msglist << msg; + } + + dispatchMessages(msglist); + reset(); +} + void ClientBacklogManager::requestInitialBacklog() { if(_requester) { qWarning() << "ClientBacklogManager::requestInitialBacklog() called twice in the same session! (Backlog has already been requested)"; @@ -70,7 +84,11 @@ void ClientBacklogManager::requestInitialBacklog() { BacklogSettings settings; switch(settings.requesterType()) { case BacklogRequester::GlobalUnread: + _requester = new GlobalUnreadBacklogRequester(this); + break; case BacklogRequester::PerBufferUnread: + _requester = new PerBufferUnreadBacklogRequester(this); + break; case BacklogRequester::PerBufferFixed: default: _requester = new FixedBacklogRequester(this); @@ -83,7 +101,6 @@ void ClientBacklogManager::stopBuffering() { Q_ASSERT(_requester); dispatchMessages(_requester->bufferedMessages(), true); - reset(); } bool ClientBacklogManager::isBuffering() {