X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientbacklogmanager.cpp;h=742d30535127cd73277467685c07d117611e4bbe;hp=8ccaa4b0cea4fb96b9d4dbc8c401433d6c842855;hb=674ad8ee4369cbc9516eb6d6629a616e9310c71f;hpb=26b9300ccab24e526a9f43bef95a2a70f59161df diff --git a/src/client/clientbacklogmanager.cpp b/src/client/clientbacklogmanager.cpp index 8ccaa4b0..742d3053 100644 --- a/src/client/clientbacklogmanager.cpp +++ b/src/client/clientbacklogmanager.cpp @@ -35,12 +35,8 @@ ClientBacklogManager::ClientBacklogManager(QObject *parent) { } -void ClientBacklogManager::receiveBacklog(BufferId bufferId, int limit, int offset, QVariantList msgs) { - Q_UNUSED(limit) - Q_UNUSED(offset) - - if(msgs.isEmpty()) - return; +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) emit messagesReceived(bufferId, msgs.count()); @@ -55,12 +51,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 +81,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 +98,6 @@ void ClientBacklogManager::stopBuffering() { Q_ASSERT(_requester); dispatchMessages(_requester->bufferedMessages(), true); - reset(); } bool ClientBacklogManager::isBuffering() {