Skip to content
Snippets Groups Projects
Verified Commit e41dc33f authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

fix: correct issue with backlog loading

parent 4a620ce9
Branches
Tags 0.9.2
No related merge requests found
......@@ -15,4 +15,4 @@ plugins {
}
group = "de.justjanne.libquassel"
version = "0.9.1"
version = "0.9.2"
......@@ -9,6 +9,7 @@
package de.justjanne.libquassel.client.syncables
import de.justjanne.bitflags.none
import de.justjanne.bitflags.of
import de.justjanne.bitflags.toBits
import de.justjanne.libquassel.client.util.CoroutineKeyedQueue
......@@ -48,8 +49,8 @@ class ClientBacklogManager(
last: MsgId = MsgId(-1),
limit: Int = -1,
additional: Int = 0,
type: MessageTypes = MessageType.all,
flags: MessageFlags = MessageFlag.all
type: MessageTypes = MessageType.none(),
flags: MessageFlags = MessageFlag.none()
): QVariantList =
bufferFilteredQueue.wait(BacklogData.BufferFiltered(bufferId, first, last, limit, additional, type, flags)) {
requestBacklogFiltered(bufferId, first, last, limit, additional, type.toBits().toInt(), flags.toBits().toInt())
......@@ -60,8 +61,8 @@ class ClientBacklogManager(
first: MsgId = MsgId(-1),
last: MsgId = MsgId(-1),
limit: Int = -1,
type: MessageTypes = MessageType.all,
flags: MessageFlags = MessageFlag.all
type: MessageTypes = MessageType.none(),
flags: MessageFlags = MessageFlag.none()
): QVariantList =
bufferForwardQueue.wait(BacklogData.BufferForward(bufferId, first, last, limit, type, flags)) {
requestBacklogForward(bufferId, first, last, limit, type.toBits().toInt(), flags.toBits().toInt())
......@@ -82,8 +83,8 @@ class ClientBacklogManager(
last: MsgId = MsgId(-1),
limit: Int = -1,
additional: Int = 0,
type: MessageTypes = MessageType.all,
flags: MessageFlags = MessageFlag.all
type: MessageTypes = MessageType.none(),
flags: MessageFlags = MessageFlag.none()
): QVariantList =
allFilteredQueue.wait(BacklogData.AllFiltered(first, last, limit, additional, type, flags)) {
requestBacklogAllFiltered(first, last, limit, additional, type.toBits().toInt(), flags.toBits().toInt())
......
......@@ -18,6 +18,10 @@ interface StatefulSyncableStub : SyncableStub {
fun fromVariantMap(properties: QVariantMap)
fun toVariantMap(): QVariantMap
/**
* Replaces all properties of the object with the content of the
* "properties" parameter. This parameter is in network representation.
*/
fun update(properties: QVariantMap) {
fromVariantMap(properties)
sync(
......@@ -27,6 +31,10 @@ interface StatefulSyncableStub : SyncableStub {
)
}
/**
* Replaces all properties of the object with the content of the
* "properties" parameter. This parameter is in network representation.
*/
fun requestUpdate(properties: QVariantMap = toVariantMap()) {
sync(
target = ProtocolSide.CORE,
......
......@@ -22,6 +22,15 @@ import de.justjanne.libquassel.protocol.variant.qVariant
@SyncedObject("BacklogManager")
interface BacklogManagerStub : SyncableStub {
/**
* Loads backlog for [bufferId], where the message id is >= [first] and < [last].
* If [first] or [last] is unset, the list will be unbounded in that direction.
*
* If a [limit] is set, the list will be truncated to the newest N messages.
*
* If both [first] and [last] are set, and the list of messages is not truncated by [limit],
* [additional] messages will be loaded before [last].
*/
@SyncedCall(target = ProtocolSide.CORE)
fun requestBacklog(
bufferId: BufferId,
......@@ -41,6 +50,17 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Loads backlog for [bufferId], where the message id is >= [first] and < [last].
* If [first] or [last] is unset, the list will be unbounded in that direction.
*
* If a [limit] is set, the list will be truncated to the newest N messages.
*
* If both [first] and [last] are set, and the list of messages is not truncated by [limit],
* [additional] messages will be loaded before [last].
*
* Only messages matching [type] and [flags] will be returned and counted.
*/
@SyncedCall(target = ProtocolSide.CORE)
fun requestBacklogFiltered(
bufferId: BufferId,
......@@ -64,6 +84,14 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Loads backlog for [bufferId], where the message id is >= [first] and < [last].
* If [first] or [last] is unset, the list will be unbounded in that direction.
*
* If a [limit] is set, the list will be truncated to the oldest N messages.
*
* Only messages matching [type] and [flags] will be returned and counted.
*/
@SyncedCall(target = ProtocolSide.CORE)
fun requestBacklogForward(
bufferId: BufferId,
......@@ -85,6 +113,15 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Loads backlog for all buffers, where the message id is >= [first] and < [last].
* If [first] or [last] is unset, the list will be unbounded in that direction.
*
* If a [limit] is set, the list will be truncated to the newest N messages.
*
* If both [first] and [last] are set, and the list of messages is not truncated by [limit],
* [additional] messages will be loaded before [last].
*/
@SyncedCall(target = ProtocolSide.CORE)
fun requestBacklogAll(
first: MsgId = MsgId(-1),
......@@ -102,6 +139,17 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Loads backlog for all buffers, where the message id is >= [first] and < [last].
* If [first] or [last] is unset, the list will be unbounded in that direction.
*
* If a [limit] is set, the list will be truncated to the newest N messages.
*
* If both [first] and [last] are set, and the list of messages is not truncated by [limit],
* [additional] messages will be loaded before [last].
*
* Only messages matching [type] and [flags] will be returned and counted.
*/
@SyncedCall(target = ProtocolSide.CORE)
fun requestBacklogAllFiltered(
first: MsgId = MsgId(-1),
......@@ -123,6 +171,10 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Response to the corresponding [requestBacklog] call.
* [messages] contains the messages as `QVariant<Message>`
*/
@SyncedCall(target = ProtocolSide.CLIENT)
fun receiveBacklog(
bufferId: BufferId,
......@@ -144,6 +196,10 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Response to the corresponding [requestBacklogFiltered] call.
* [messages] contains the messages as `QVariant<Message>`
*/
@SyncedCall(target = ProtocolSide.CLIENT)
fun receiveBacklogFiltered(
bufferId: BufferId,
......@@ -169,6 +225,10 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Response to the corresponding [requestBacklogForward] call.
* [messages] contains the messages as `QVariant<Message>`
*/
@SyncedCall(target = ProtocolSide.CLIENT)
fun receiveBacklogForward(
bufferId: BufferId,
......@@ -192,6 +252,10 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Response to the corresponding [requestBacklogAll] call.
* [messages] contains the messages as `QVariant<Message>`
*/
@SyncedCall(target = ProtocolSide.CLIENT)
fun receiveBacklogAll(
first: MsgId = MsgId(-1),
......@@ -211,6 +275,10 @@ interface BacklogManagerStub : SyncableStub {
)
}
/**
* Response to the corresponding [requestBacklogAllFiltered] call.
* [messages] contains the messages as `QVariant<Message>`
*/
@SyncedCall(target = ProtocolSide.CLIENT)
fun receiveBacklogAllFiltered(
first: MsgId = MsgId(-1),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment