X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclientbacklogmanager.cpp;h=b698f4f9137ea552ba1d0f1504f384faed6142f1;hb=311be396946aea8c8e5416f79ca3aebd537b93b0;hp=8ccaa4b0cea4fb96b9d4dbc8c401433d6c842855;hpb=26b9300ccab24e526a9f43bef95a2a70f59161df;p=quassel.git diff --git a/src/client/clientbacklogmanager.cpp b/src/client/clientbacklogmanager.cpp index 8ccaa4b0..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 limit, int offset, QVariantList msgs) { - Q_UNUSED(limit) - 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 limit, int offs 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() {