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

Target

Select target project
  • justJanne/libquassel
1 result
Show changes
Commits on Source (8)
Showing
with 41 additions and 17 deletions
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
plugins { plugins {
id("justjanne.version")
id("justjanne.dokka") id("justjanne.dokka")
id("justjanne.publish-maven-central") id("justjanne.publish-maven-central")
idea idea
...@@ -15,4 +16,3 @@ plugins { ...@@ -15,4 +16,3 @@ plugins {
} }
group = "de.justjanne.libquassel" group = "de.justjanne.libquassel"
version = "0.10.1"
...@@ -6,7 +6,6 @@ plugins { ...@@ -6,7 +6,6 @@ plugins {
id("justjanne.ktlint") id("justjanne.ktlint")
id("com.google.devtools.ksp") id("com.google.devtools.ksp")
kotlin("jvm") kotlin("jvm")
kotlin("kapt")
} }
repositories { repositories {
...@@ -30,8 +29,7 @@ dependencies { ...@@ -30,8 +29,7 @@ dependencies {
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
kotlinOptions { kotlinOptions {
freeCompilerArgs = listOf( freeCompilerArgs = listOf(
"-Xinline-classes", "-opt-in=kotlin.ExperimentalUnsignedTypes"
"-Xopt-in=kotlin.ExperimentalUnsignedTypes"
) )
jvmTarget = "1.8" jvmTarget = "1.8"
} }
......
import org.gradle.api.Project
/*
* libquassel
* Copyright (c) 2022 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/.
*/
version = cmd("git", "describe", "--always", "--tags", "HEAD") ?: "1.0.0"
fun Project.cmd(vararg command: String) = try {
val stdOut = java.io.ByteArrayOutputStream()
exec {
commandLine(*command)
standardOutput = stdOut
}
stdOut.toString(Charsets.UTF_8.name()).trim()
} catch (e: Throwable) {
null
}
...@@ -27,11 +27,13 @@ fun KSTypeReference.asTypeName(): TypeName = resolve().asTypeName() ...@@ -27,11 +27,13 @@ fun KSTypeReference.asTypeName(): TypeName = resolve().asTypeName()
fun KSType.asTypeName(): TypeName { fun KSType.asTypeName(): TypeName {
when (val decl = declaration) { when (val decl = declaration) {
is KSTypeAlias -> return decl.type.resolve().asTypeName() is KSTypeAlias -> return decl.type.resolve().asTypeName()
.copy(nullable = isMarkedNullable)
} }
val baseType = asClassName() val baseType = asClassName()
if (arguments.isEmpty()) { if (arguments.isEmpty()) {
return baseType return baseType
.copy(nullable = isMarkedNullable)
} }
val parameters = arguments.map { val parameters = arguments.map {
...@@ -53,4 +55,5 @@ fun KSType.asTypeName(): TypeName { ...@@ -53,4 +55,5 @@ fun KSType.asTypeName(): TypeName {
} }
return baseType.parameterizedBy(parameters) return baseType.parameterizedBy(parameters)
.copy(nullable = isMarkedNullable)
} }
...@@ -39,7 +39,7 @@ abstract class StatefulSyncableObject<T>( ...@@ -39,7 +39,7 @@ abstract class StatefulSyncableObject<T>(
return result return result
} }
override fun state(): T = state.value final override fun state(): T = state.value
override fun flow(): Flow<T> = state final override fun flow(): Flow<T> = state
protected val state = MutableStateFlow(state) protected val state = MutableStateFlow(state)
} }
...@@ -464,7 +464,7 @@ open class Network( ...@@ -464,7 +464,7 @@ open class Network(
super.setIdentity(identityId) super.setIdentity(identityId)
} }
override fun setMyNick(myNick: String) { override fun setMyNick(myNick: String?) {
state.update { state.update {
copy(myNick = myNick) copy(myNick = myNick)
} }
...@@ -485,7 +485,7 @@ open class Network( ...@@ -485,7 +485,7 @@ open class Network(
super.setNetworkName(networkName) super.setNetworkName(networkName)
} }
override fun setCurrentServer(currentServer: String) { override fun setCurrentServer(currentServer: String?) {
state.update { state.update {
copy(currentServer = currentServer) copy(currentServer = currentServer)
} }
...@@ -502,7 +502,7 @@ open class Network( ...@@ -502,7 +502,7 @@ open class Network(
ircUsers.values.forEach(it.proxy::stopSynchronize) ircUsers.values.forEach(it.proxy::stopSynchronize)
} }
copy( copy(
connected = isConnected, connected = false,
myNick = "", myNick = "",
currentServer = "", currentServer = "",
ircChannels = emptyMap(), ircChannels = emptyMap(),
......
...@@ -27,7 +27,7 @@ data class NetworkState( ...@@ -27,7 +27,7 @@ data class NetworkState(
val myNick: String? = "", val myNick: String? = "",
val latency: Int = 0, val latency: Int = 0,
val networkName: String = "<not initialized>", val networkName: String = "<not initialized>",
val currentServer: String = "", val currentServer: String? = "",
val connected: Boolean = false, val connected: Boolean = false,
val connectionState: ConnectionState = ConnectionState.Disconnected, val connectionState: ConnectionState = ConnectionState.Disconnected,
val ircUsers: Map<String, IrcUser> = emptyMap(), val ircUsers: Map<String, IrcUser> = emptyMap(),
......
...@@ -62,7 +62,7 @@ interface IgnoreListManagerStub : StatefulSyncableStub { ...@@ -62,7 +62,7 @@ interface IgnoreListManagerStub : StatefulSyncableStub {
isActive: Boolean isActive: Boolean
) { ) {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CORE,
"requestAddIgnoreListItem", "requestAddIgnoreListItem",
qVariant(type, QtType.Int), qVariant(type, QtType.Int),
qVariant(ignoreRule, QtType.QString), qVariant(ignoreRule, QtType.QString),
......
...@@ -35,7 +35,7 @@ interface NetworkStub : StatefulSyncableStub { ...@@ -35,7 +35,7 @@ interface NetworkStub : StatefulSyncableStub {
} }
@SyncedCall(target = ProtocolSide.CLIENT) @SyncedCall(target = ProtocolSide.CLIENT)
fun setCurrentServer(currentServer: String) { fun setCurrentServer(currentServer: String?) {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setCurrentServer", "setCurrentServer",
...@@ -44,7 +44,7 @@ interface NetworkStub : StatefulSyncableStub { ...@@ -44,7 +44,7 @@ interface NetworkStub : StatefulSyncableStub {
} }
@SyncedCall(target = ProtocolSide.CLIENT) @SyncedCall(target = ProtocolSide.CLIENT)
fun setMyNick(myNick: String) { fun setMyNick(myNick: String?) {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setMyNick", "setMyNick",
...@@ -361,7 +361,7 @@ interface NetworkStub : StatefulSyncableStub { ...@@ -361,7 +361,7 @@ interface NetworkStub : StatefulSyncableStub {
@SyncedCall(target = ProtocolSide.CORE) @SyncedCall(target = ProtocolSide.CORE)
fun requestConnect() { fun requestConnect() {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CORE,
"requestConnect", "requestConnect",
) )
} }
...@@ -369,7 +369,7 @@ interface NetworkStub : StatefulSyncableStub { ...@@ -369,7 +369,7 @@ interface NetworkStub : StatefulSyncableStub {
@SyncedCall(target = ProtocolSide.CORE) @SyncedCall(target = ProtocolSide.CORE)
fun requestDisconnect() { fun requestDisconnect() {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CORE,
"requestDisconnect", "requestDisconnect",
) )
} }
...@@ -377,7 +377,7 @@ interface NetworkStub : StatefulSyncableStub { ...@@ -377,7 +377,7 @@ interface NetworkStub : StatefulSyncableStub {
@SyncedCall(target = ProtocolSide.CORE) @SyncedCall(target = ProtocolSide.CORE)
fun requestSetNetworkInfo(info: NetworkInfo) { fun requestSetNetworkInfo(info: NetworkInfo) {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CORE,
"requestSetNetworkInfo", "requestSetNetworkInfo",
qVariant(info, QuasselType.NetworkInfo), qVariant(info, QuasselType.NetworkInfo),
) )
......
...@@ -55,7 +55,7 @@ open class EmptySession : Session { ...@@ -55,7 +55,7 @@ open class EmptySession : Session {
override fun removeIdentity(id: IdentityId) = Unit override fun removeIdentity(id: IdentityId) = Unit
override fun identities() = emptySet<Identity>() override fun identities() = emptySet<Identity>()
override fun certManager(id: IdentityId) = null override fun certManager(id: IdentityId): CertManager? = null
override fun certManagers() = emptySet<CertManager>() override fun certManagers() = emptySet<CertManager>()
override fun rename(className: String, oldName: String, newName: String) = Unit override fun rename(className: String, oldName: String, newName: String) = Unit
......