diff --git a/build.gradle.kts b/build.gradle.kts index fe4a4e5c0934ad94d3deb2cfb6ba395ff74e1c1f..c6142b29c5e56e53b7a1115b4cea5e93b4e53534 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,4 +15,4 @@ plugins { } group = "de.justjanne.libquassel" -version = "0.9.1" +version = "0.9.2" diff --git a/libquassel-client/src/main/kotlin/de/justjanne/libquassel/client/syncables/ClientBacklogManager.kt b/libquassel-client/src/main/kotlin/de/justjanne/libquassel/client/syncables/ClientBacklogManager.kt index 31f88e4fbbff357eae03a60998693cddc62f0c7d..7d19179a823353801e92611ed66f6a9d759c8fc2 100644 --- a/libquassel-client/src/main/kotlin/de/justjanne/libquassel/client/syncables/ClientBacklogManager.kt +++ b/libquassel-client/src/main/kotlin/de/justjanne/libquassel/client/syncables/ClientBacklogManager.kt @@ -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()) diff --git a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/StatefulSyncableStub.kt b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/StatefulSyncableStub.kt index 7ce9faca19b4e9711428ed70a396f901053f3ecd..db413bf3e8a94df0a74fecb07c1afc57cce9ae9a 100644 --- a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/StatefulSyncableStub.kt +++ b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/StatefulSyncableStub.kt @@ -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, diff --git a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/stubs/BacklogManagerStub.kt b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/stubs/BacklogManagerStub.kt index 694ebd574247e0d56e39ed566f1a5b09a2db21f2..707a9b6d470840627b4d2b6bd875b3a23e9453e1 100644 --- a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/stubs/BacklogManagerStub.kt +++ b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/stubs/BacklogManagerStub.kt @@ -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),