Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • api-redesign
  • main
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.7.0
  • 0.8.0
  • 0.8.1
  • 0.9.0
  • 0.9.1
  • 0.9.2
11 results

Target

Select target project
  • justJanne/libquassel
1 result
Select Git revision
  • api-redesign
  • main
  • 0.10.0
  • 0.10.1
  • 0.10.2
  • 0.7.0
  • 0.8.0
  • 0.8.1
  • 0.9.0
  • 0.9.1
  • 0.9.2
11 results
Show changes
Showing
with 107 additions and 147 deletions
...@@ -65,6 +65,7 @@ enum class LegacyFeature( ...@@ -65,6 +65,7 @@ enum class LegacyFeature(
* Support for custom rate limits for connections to IRC servers * Support for custom rate limits for connections to IRC servers
*/ */
CustomRateLimits(0x0080u, QuasselFeature.CustomRateLimits), CustomRateLimits(0x0080u, QuasselFeature.CustomRateLimits),
/** /**
* Experimental support for (X)DCC transfers * Experimental support for (X)DCC transfers
*/ */
...@@ -107,7 +108,8 @@ enum class LegacyFeature( ...@@ -107,7 +108,8 @@ enum class LegacyFeature(
/** /**
* Support for feature negotiation via a list of strings * Support for feature negotiation via a list of strings
*/ */
ExtendedFeatures(0x8000u, QuasselFeature.ExtendedFeatures); ExtendedFeatures(0x8000u, QuasselFeature.ExtendedFeatures),
;
companion object : Flags<UInt, LegacyFeature> { companion object : Flags<UInt, LegacyFeature> {
private val features = values().associateBy(LegacyFeature::feature) private val features = values().associateBy(LegacyFeature::feature)
......
...@@ -140,7 +140,9 @@ enum class QuasselFeature { ...@@ -140,7 +140,9 @@ enum class QuasselFeature {
/** /**
* Support for controlling what IRCv3 capabilities are skipped during negotiation * Support for controlling what IRCv3 capabilities are skipped during negotiation
*/ */
SkipIrcCaps; SkipIrcCaps,
;
/** /**
* Get the standardized feature name * Get the standardized feature name
......
...@@ -9,12 +9,9 @@ ...@@ -9,12 +9,9 @@
package de.justjanne.libquassel.protocol.features package de.justjanne.libquassel.protocol.features
import de.justjanne.libquassel.annotations.Generated
/** /**
* Inline class encapsulating a quassel feature name * Inline class encapsulating a quassel feature name
*/ */
@Generated
@JvmInline @JvmInline
value class QuasselFeatureName( value class QuasselFeatureName(
/** /**
......
...@@ -22,7 +22,11 @@ import java.nio.ByteBuffer ...@@ -22,7 +22,11 @@ import java.nio.ByteBuffer
* @param to target buffer to copy to * @param to target buffer to copy to
* @param desiredAmount maximum amount to copy * @param desiredAmount maximum amount to copy
*/ */
fun copyData(from: ByteBuffer, to: ByteBuffer, desiredAmount: Int) { fun copyData(
from: ByteBuffer,
to: ByteBuffer,
desiredAmount: Int,
) {
val limit = from.limit() val limit = from.limit()
val availableAmount = minOf(from.remaining(), to.remaining()) val availableAmount = minOf(from.remaining(), to.remaining())
val amount = minOf(availableAmount, desiredAmount) val amount = minOf(availableAmount, desiredAmount)
...@@ -41,7 +45,10 @@ fun copyData(from: ByteBuffer, to: ByteBuffer, desiredAmount: Int) { ...@@ -41,7 +45,10 @@ fun copyData(from: ByteBuffer, to: ByteBuffer, desiredAmount: Int) {
* @param desiredAmount maximum amount to copy * @param desiredAmount maximum amount to copy
* @return buffer of the copied data * @return buffer of the copied data
*/ */
fun copyData(from: ByteBuffer, desiredAmount: Int): ByteBuffer { fun copyData(
from: ByteBuffer,
desiredAmount: Int,
): ByteBuffer {
val to = ByteBuffer.allocate(minOf(from.remaining(), desiredAmount)) val to = ByteBuffer.allocate(minOf(from.remaining(), desiredAmount))
copyData(from, to, desiredAmount) copyData(from, to, desiredAmount)
return to.withFlip() return to.withFlip()
...@@ -52,9 +59,10 @@ fun copyData(from: ByteBuffer, desiredAmount: Int): ByteBuffer { ...@@ -52,9 +59,10 @@ fun copyData(from: ByteBuffer, desiredAmount: Int): ByteBuffer {
*/ */
fun ByteBuffer?.isEmpty() = this == null || !this.hasRemaining() fun ByteBuffer?.isEmpty() = this == null || !this.hasRemaining()
private val alphabet = charArrayOf( private val alphabet =
charArrayOf(
'0', '1', '2', '3', '4', '5', '6', '7', '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
) )
/** /**
......
...@@ -36,8 +36,11 @@ class ChainedByteBuffer( ...@@ -36,8 +36,11 @@ class ChainedByteBuffer(
require(limit <= 0 || size + amount <= limit) { require(limit <= 0 || size + amount <= limit) {
"Can not allocate $amount bytes, currently at $size, limit is $limit" "Can not allocate $amount bytes, currently at $size, limit is $limit"
} }
return if (direct) ByteBuffer.allocateDirect(amount) return if (direct) {
else ByteBuffer.allocate(amount) ByteBuffer.allocateDirect(amount)
} else {
ByteBuffer.allocate(amount)
}
} }
private fun ensureSpace(requested: Int) { private fun ensureSpace(requested: Int) {
...@@ -168,8 +171,7 @@ class ChainedByteBuffer( ...@@ -168,8 +171,7 @@ class ChainedByteBuffer(
size = 0 size = 0
} }
override fun iterator(): Iterator<ByteBuffer> = override fun iterator(): Iterator<ByteBuffer> = ChainedByteBufferIterator(this)
ChainedByteBufferIterator(this)
/** /**
* Convert this buffer into a bytebuffer of the same capacity and content. * Convert this buffer into a bytebuffer of the same capacity and content.
...@@ -184,14 +186,12 @@ class ChainedByteBuffer( ...@@ -184,14 +186,12 @@ class ChainedByteBuffer(
} }
private class ChainedByteBufferIterator( private class ChainedByteBufferIterator(
private val buffer: ChainedByteBuffer private val buffer: ChainedByteBuffer,
) : Iterator<ByteBuffer> { ) : Iterator<ByteBuffer> {
private var index = 0 private var index = 0
override fun hasNext() = override fun hasNext() = index < buffer.bufferList.size
index < buffer.bufferList.size
override fun next(): ByteBuffer = override fun next(): ByteBuffer = buffer.bufferList[index++].duplicate().withFlip()
buffer.bufferList[index++].duplicate().withFlip()
} }
} }
...@@ -10,11 +10,11 @@ ...@@ -10,11 +10,11 @@
package de.justjanne.libquassel.protocol.io package de.justjanne.libquassel.protocol.io
import de.justjanne.libquassel.protocol.util.StateHolder import de.justjanne.libquassel.protocol.util.StateHolder
import de.justjanne.libquassel.protocol.util.update
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.runInterruptible import kotlinx.coroutines.runInterruptible
import java.io.Closeable import java.io.Closeable
import java.net.InetSocketAddress import java.net.InetSocketAddress
...@@ -38,31 +38,34 @@ class CoroutineChannel : StateHolder<CoroutineChannelState>, Closeable { ...@@ -38,31 +38,34 @@ class CoroutineChannel : StateHolder<CoroutineChannelState>, Closeable {
socket.connect(address, timeout) socket.connect(address, timeout)
this.channel = StreamChannel(socket) this.channel = StreamChannel(socket)
state.update { state.update {
copy(connected = true) it.copy(connected = true)
} }
} }
fun enableCompression() { fun enableCompression() {
channel = channel.withCompression() channel = channel.withCompression()
state.update { state.update {
copy(compression = true) it.copy(compression = true)
} }
} }
suspend fun enableTLS(context: SSLContext) { suspend fun enableTLS(context: SSLContext) {
channel = runInterruptible(writeContext) { channel =
runInterruptible(writeContext) {
channel.withTLS(context) channel.withTLS(context)
} }
state.update { state.update {
copy(tlsInfo = channel.tlsInfo()) it.copy(tlsInfo = channel.tlsInfo())
} }
} }
suspend fun read(buffer: ByteBuffer): Int = runInterruptible(readContext) { suspend fun read(buffer: ByteBuffer): Int =
runInterruptible(readContext) {
channel.read(buffer) channel.read(buffer)
} }
suspend fun write(buffer: ByteBuffer): Int = runInterruptible(writeContext) { suspend fun write(buffer: ByteBuffer): Int =
runInterruptible(writeContext) {
channel.write(buffer) channel.write(buffer)
} }
...@@ -72,18 +75,21 @@ class CoroutineChannel : StateHolder<CoroutineChannelState>, Closeable { ...@@ -72,18 +75,21 @@ class CoroutineChannel : StateHolder<CoroutineChannelState>, Closeable {
} }
} }
suspend fun flush() = runInterruptible(writeContext) { suspend fun flush() =
runInterruptible(writeContext) {
channel.flush() channel.flush()
} }
override fun close() { override fun close() {
channel.close() channel.close()
state.update { state.update {
copy(connected = false) it.copy(connected = false)
} }
} }
override fun state(): CoroutineChannelState = state.value override fun state(): CoroutineChannelState = state.value
override fun flow(): Flow<CoroutineChannelState> = state override fun flow(): Flow<CoroutineChannelState> = state
private val state = MutableStateFlow(CoroutineChannelState()) private val state = MutableStateFlow(CoroutineChannelState())
} }
...@@ -18,7 +18,7 @@ import java.util.zip.DeflaterOutputStream ...@@ -18,7 +18,7 @@ import java.util.zip.DeflaterOutputStream
* the current stream * the current stream
*/ */
class FixedDeflaterOutputStream( class FixedDeflaterOutputStream(
stream: OutputStream stream: OutputStream,
) : DeflaterOutputStream(stream, true) { ) : DeflaterOutputStream(stream, true) {
/** /**
* Close the underlying stream and deflater * Close the underlying stream and deflater
......
...@@ -18,7 +18,7 @@ import java.nio.channels.spi.AbstractInterruptibleChannel ...@@ -18,7 +18,7 @@ import java.nio.channels.spi.AbstractInterruptibleChannel
* Utility function to wrap an input stream into a readable channel * Utility function to wrap an input stream into a readable channel
*/ */
class ReadableWrappedChannel( class ReadableWrappedChannel(
private var backingStream: InputStream private var backingStream: InputStream,
) : AbstractInterruptibleChannel(), ReadableByteChannel { ) : AbstractInterruptibleChannel(), ReadableByteChannel {
private val buffer = ByteBuffer.allocate(PAGE_SIZE) private val buffer = ByteBuffer.allocate(PAGE_SIZE)
private val lock = Any() private val lock = Any()
...@@ -61,8 +61,9 @@ class ReadableWrappedChannel( ...@@ -61,8 +61,9 @@ class ReadableWrappedChannel(
} }
// read is negative if no data was read, in that case, terminate // read is negative if no data was read, in that case, terminate
if (readData < 0) if (readData < 0) {
break break
}
// add read amount to total // add read amount to total
remainingData -= readData remainingData -= readData
......
...@@ -54,14 +54,13 @@ class StreamChannel constructor( ...@@ -54,14 +54,13 @@ class StreamChannel constructor(
/** /**
* Return a copy of the current channel with TLS * Return a copy of the current channel with TLS
*/ */
fun withTLS( fun withTLS(context: SSLContext): StreamChannel {
context: SSLContext, val sslSocket =
): StreamChannel { context.socketFactory.createSocket(
val sslSocket = context.socketFactory.createSocket(
this.socket, this.socket,
this.socket.inetAddress.hostAddress, this.socket.inetAddress.hostAddress,
this.socket.port, this.socket.port,
true true,
) as SSLSocket ) as SSLSocket
sslSocket.useClientMode = true sslSocket.useClientMode = true
sslSocket.startHandshake() sslSocket.startHandshake()
......
...@@ -72,7 +72,10 @@ class StringEncoder(charset: Charset) { ...@@ -72,7 +72,10 @@ class StringEncoder(charset: Charset) {
return encodeInternal(charBuffer) return encodeInternal(charBuffer)
} }
private fun decodeInternal(source: ByteBuffer, length: Int): CharBuffer { private fun decodeInternal(
source: ByteBuffer,
length: Int,
): CharBuffer {
val charBuffer = charBuffer(length) val charBuffer = charBuffer(length)
val oldlimit = source.limit() val oldlimit = source.limit()
source.limit(source.position() + length) source.limit(source.position() + length)
...@@ -90,7 +93,10 @@ class StringEncoder(charset: Charset) { ...@@ -90,7 +93,10 @@ class StringEncoder(charset: Charset) {
/** /**
* Decode a string with known length from a bytebuffer * Decode a string with known length from a bytebuffer
*/ */
fun decode(source: ByteBuffer, length: Int): String { fun decode(
source: ByteBuffer,
length: Int,
): String {
return decodeInternal(source, length).toString() return decodeInternal(source, length).toString()
} }
......
...@@ -14,9 +14,7 @@ import java.nio.ByteBuffer ...@@ -14,9 +14,7 @@ import java.nio.ByteBuffer
/** /**
* Utility function to apply a closure to a chained byte buffer and return its data * Utility function to apply a closure to a chained byte buffer and return its data
*/ */
inline fun useChainedByteBuffer( inline fun useChainedByteBuffer(function: (ChainedByteBuffer) -> Unit): ByteBuffer {
function: (ChainedByteBuffer) -> Unit
): ByteBuffer {
val buffer = ChainedByteBuffer() val buffer = ChainedByteBuffer()
function(buffer) function(buffer)
return buffer.toBuffer() return buffer.toBuffer()
......
...@@ -18,7 +18,7 @@ import java.nio.channels.spi.AbstractInterruptibleChannel ...@@ -18,7 +18,7 @@ import java.nio.channels.spi.AbstractInterruptibleChannel
* Utility function to wrap an output stream into a writable channel * Utility function to wrap an output stream into a writable channel
*/ */
class WritableWrappedChannel( class WritableWrappedChannel(
private var backingStream: OutputStream private var backingStream: OutputStream,
) : AbstractInterruptibleChannel(), WritableByteChannel { ) : AbstractInterruptibleChannel(), WritableByteChannel {
private val buffer = ByteBuffer.allocate(PAGE_SIZE) private val buffer = ByteBuffer.allocate(PAGE_SIZE)
private val lock = Any() private val lock = Any()
......
...@@ -24,17 +24,19 @@ enum class BufferActivity( ...@@ -24,17 +24,19 @@ enum class BufferActivity(
OtherActivity(1), OtherActivity(1),
/** /**
* A new unread mesage is available on this buffer * A new unread message is available on this buffer
*/ */
NewMessage(2), NewMessage(2),
/** /**
* A highlight for the current user is available on this buffer * A highlight for the current user is available on this buffer
*/ */
Highlight(4); Highlight(4),
;
companion object { companion object {
private val map = enumValues<BufferActivity>() private val map =
enumValues<BufferActivity>()
.associateBy(BufferActivity::value) .associateBy(BufferActivity::value)
/** /**
......
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.libquassel.protocol.models
import de.justjanne.bitflags.of
import de.justjanne.bitflags.toBits
import de.justjanne.libquassel.protocol.features.FeatureSet
import de.justjanne.libquassel.protocol.features.LegacyFeature
import de.justjanne.libquassel.protocol.features.QuasselFeatureName
import de.justjanne.libquassel.protocol.models.types.QtType
import de.justjanne.libquassel.protocol.variant.QVariantMap
import de.justjanne.libquassel.protocol.variant.into
import de.justjanne.libquassel.protocol.variant.qVariant
import org.threeten.bp.Instant
import org.threeten.bp.ZoneOffset
data class ConnectedClient(
val id: Int,
val remoteAddress: String,
val location: String,
val version: String,
val versionDate: Instant?,
val connectedSince: Instant,
val secure: Boolean,
val features: FeatureSet
) {
fun toVariantMap() = mapOf(
"id" to qVariant(id, QtType.Int),
"remoteAddress" to qVariant(remoteAddress, QtType.QString),
"location" to qVariant(location, QtType.QString),
"clientVersion" to qVariant(version, QtType.QString),
"clientVersionDate" to qVariant(versionDate?.epochSecond?.toString(), QtType.QString),
"connectedSince" to qVariant(connectedSince.atOffset(ZoneOffset.UTC), QtType.QDateTime),
"secure" to qVariant(secure, QtType.Bool),
"features" to qVariant(features.legacyFeatures().toBits(), QtType.UInt),
"featureList" to qVariant(features.featureList().map(QuasselFeatureName::name), QtType.QStringList)
)
companion object {
fun fromVariantMap(properties: QVariantMap) = ConnectedClient(
id = properties["id"].into(-1),
remoteAddress = properties["remoteAddress"].into(""),
location = properties["location"].into(""),
version = properties["clientVersion"].into(""),
versionDate = properties["clientVersionDate"].into("")
.toLongOrNull()
?.let(Instant::ofEpochSecond),
connectedSince = properties["connectedSince"].into(Instant.EPOCH.atOffset(ZoneOffset.UTC)).toInstant(),
secure = properties["secure"].into(false),
features = FeatureSet.build(
LegacyFeature.of(properties["features"].into()),
properties["featureList"].into<QStringList>()
?.filterNotNull()
?.map(::QuasselFeatureName)
.orEmpty()
)
)
}
}
...@@ -11,6 +11,7 @@ package de.justjanne.libquassel.protocol.models ...@@ -11,6 +11,7 @@ package de.justjanne.libquassel.protocol.models
import de.justjanne.libquassel.protocol.features.FeatureSet import de.justjanne.libquassel.protocol.features.FeatureSet
import de.justjanne.libquassel.protocol.models.ids.NetworkId import de.justjanne.libquassel.protocol.models.ids.NetworkId
import de.justjanne.libquassel.protocol.models.network.IdentityDto
import de.justjanne.libquassel.protocol.models.setup.BackendInfo import de.justjanne.libquassel.protocol.models.setup.BackendInfo
import de.justjanne.libquassel.protocol.variant.QVariantMap import de.justjanne.libquassel.protocol.variant.QVariantMap
...@@ -75,7 +76,7 @@ sealed class HandshakeMessage { ...@@ -75,7 +76,7 @@ sealed class HandshakeMessage {
/** /**
* HTML-formatted error message * HTML-formatted error message
*/ */
val errorString: String? val errorString: String?,
) : HandshakeMessage() ) : HandshakeMessage()
/** /**
...@@ -91,7 +92,7 @@ sealed class HandshakeMessage { ...@@ -91,7 +92,7 @@ sealed class HandshakeMessage {
/** /**
* Password of the core account * Password of the core account
*/ */
val password: String? val password: String?,
) : HandshakeMessage() ) : HandshakeMessage()
/** /**
...@@ -114,7 +115,7 @@ sealed class HandshakeMessage { ...@@ -114,7 +115,7 @@ sealed class HandshakeMessage {
/** /**
* HTML-formatted error message * HTML-formatted error message
*/ */
val errorString: String? val errorString: String?,
) : HandshakeMessage() ) : HandshakeMessage()
/** /**
...@@ -158,7 +159,7 @@ sealed class HandshakeMessage { ...@@ -158,7 +159,7 @@ sealed class HandshakeMessage {
/** /**
* Authenticator backend configuration data * Authenticator backend configuration data
*/ */
val authSetupData: QVariantMap val authSetupData: QVariantMap,
) : HandshakeMessage() ) : HandshakeMessage()
/** /**
...@@ -170,7 +171,7 @@ sealed class HandshakeMessage { ...@@ -170,7 +171,7 @@ sealed class HandshakeMessage {
/** /**
* HTML-formatted error message * HTML-formatted error message
*/ */
val errorString: String? val errorString: String?,
) : HandshakeMessage() ) : HandshakeMessage()
/** /**
...@@ -183,7 +184,7 @@ sealed class HandshakeMessage { ...@@ -183,7 +184,7 @@ sealed class HandshakeMessage {
* Identity objects created or modified after [SessionInit] will be defined * Identity objects created or modified after [SessionInit] will be defined
* via sync updates and RPC identity creation messages. * via sync updates and RPC identity creation messages.
*/ */
val identities: List<QVariantMap>, val identities: List<IdentityDto>,
/** /**
* List of existing buffers at the current time. * List of existing buffers at the current time.
* *
...@@ -197,6 +198,6 @@ sealed class HandshakeMessage { ...@@ -197,6 +198,6 @@ sealed class HandshakeMessage {
* Network objects created or modified after [SessionInit] will be defined * Network objects created or modified after [SessionInit] will be defined
* via sync updates and RPC identity creation messages. * via sync updates and RPC identity creation messages.
*/ */
val networkIds: List<NetworkId> val networkIds: List<NetworkId>,
) : HandshakeMessage() ) : HandshakeMessage()
} }
...@@ -57,7 +57,7 @@ data class Message( ...@@ -57,7 +57,7 @@ data class Message(
/** /**
* Message content * Message content
*/ */
val content: String val content: String,
) { ) {
override fun toString(): String { override fun toString(): String {
return "Message(" + return "Message(" +
......
...@@ -36,7 +36,7 @@ sealed class SignalProxyMessage { ...@@ -36,7 +36,7 @@ sealed class SignalProxyMessage {
/** /**
* Parameters to the function call * Parameters to the function call
*/ */
val params: QVariantList val params: QVariantList,
) : SignalProxyMessage() { ) : SignalProxyMessage() {
override fun toString(): String { override fun toString(): String {
return "SyncMessage::$className($objectName):$slotName(${params.size})" return "SyncMessage::$className($objectName):$slotName(${params.size})"
...@@ -54,7 +54,7 @@ sealed class SignalProxyMessage { ...@@ -54,7 +54,7 @@ sealed class SignalProxyMessage {
/** /**
* Parameters to the function call * Parameters to the function call
*/ */
val params: QVariantList val params: QVariantList,
) : SignalProxyMessage() { ) : SignalProxyMessage() {
override fun toString(): String { override fun toString(): String {
return "RpcCall::$slotName(${params.size})" return "RpcCall::$slotName(${params.size})"
...@@ -73,7 +73,7 @@ sealed class SignalProxyMessage { ...@@ -73,7 +73,7 @@ sealed class SignalProxyMessage {
/** /**
* Name/ID of the specified object * Name/ID of the specified object
*/ */
val objectName: String val objectName: String,
) : SignalProxyMessage() { ) : SignalProxyMessage() {
override fun toString(): String { override fun toString(): String {
return "InitRequest::$className($objectName)" return "InitRequest::$className($objectName)"
...@@ -96,7 +96,7 @@ sealed class SignalProxyMessage { ...@@ -96,7 +96,7 @@ sealed class SignalProxyMessage {
/** /**
* Current state of the specified object * Current state of the specified object
*/ */
val initData: QVariantMap val initData: QVariantMap,
) : SignalProxyMessage() { ) : SignalProxyMessage() {
override fun toString(): String { override fun toString(): String {
return "InitData::$className($objectName)" return "InitData::$className($objectName)"
...@@ -110,7 +110,7 @@ sealed class SignalProxyMessage { ...@@ -110,7 +110,7 @@ sealed class SignalProxyMessage {
/** /**
* Local timestamp of the moment the message was sent * Local timestamp of the moment the message was sent
*/ */
val timestamp: Instant val timestamp: Instant,
) : SignalProxyMessage() { ) : SignalProxyMessage() {
override fun toString(): String { override fun toString(): String {
return "HeartBeat::$timestamp" return "HeartBeat::$timestamp"
...@@ -124,7 +124,7 @@ sealed class SignalProxyMessage { ...@@ -124,7 +124,7 @@ sealed class SignalProxyMessage {
/** /**
* Local timestamp of the moment the original heartbeat was sent * Local timestamp of the moment the original heartbeat was sent
*/ */
val timestamp: Instant val timestamp: Instant,
) : SignalProxyMessage() { ) : SignalProxyMessage() {
override fun toString(): String { override fun toString(): String {
return "HeartBeatReply::$timestamp" return "HeartBeatReply::$timestamp"
......
...@@ -11,5 +11,5 @@ package de.justjanne.libquassel.protocol.models ...@@ -11,5 +11,5 @@ package de.justjanne.libquassel.protocol.models
data class StatusMessage( data class StatusMessage(
val network: String?, val network: String?,
val message: String val message: String,
) )
...@@ -16,7 +16,7 @@ enum class TimeSpec( ...@@ -16,7 +16,7 @@ enum class TimeSpec(
/** /**
* Underlying representation * Underlying representation
*/ */
val value: Byte val value: Byte,
) { ) {
/** /**
* Unknown zone data * Unknown zone data
...@@ -45,10 +45,12 @@ enum class TimeSpec( ...@@ -45,10 +45,12 @@ enum class TimeSpec(
/** /**
* Time with specified offset in seconds * Time with specified offset in seconds
*/ */
OffsetFromUTC(3); OffsetFromUTC(3),
;
companion object { companion object {
private val map = enumValues<TimeSpec>() private val map =
enumValues<TimeSpec>()
.associateBy(TimeSpec::value) .associateBy(TimeSpec::value)
/** /**
......
...@@ -26,10 +26,12 @@ enum class DccIpDetectionMode( ...@@ -26,10 +26,12 @@ enum class DccIpDetectionMode(
/** /**
* Manually specified * Manually specified
*/ */
Manual(0x01u); Manual(0x01u),
;
companion object { companion object {
private val values = enumValues<DccIpDetectionMode>() private val values =
enumValues<DccIpDetectionMode>()
.associateBy(DccIpDetectionMode::value) .associateBy(DccIpDetectionMode::value)
/** /**
......