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
Showing
with 41 additions and 17 deletions
......@@ -8,6 +8,7 @@
*/
plugins {
id("justjanne.version")
id("justjanne.dokka")
id("justjanne.publish-maven-central")
idea
......@@ -15,4 +16,3 @@ plugins {
}
group = "de.justjanne.libquassel"
version = "0.10.1"
......@@ -6,7 +6,6 @@ plugins {
id("justjanne.ktlint")
id("com.google.devtools.ksp")
kotlin("jvm")
kotlin("kapt")
}
repositories {
......@@ -30,8 +29,7 @@ dependencies {
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xinline-classes",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes"
"-opt-in=kotlin.ExperimentalUnsignedTypes"
)
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()
fun KSType.asTypeName(): TypeName {
when (val decl = declaration) {
is KSTypeAlias -> return decl.type.resolve().asTypeName()
.copy(nullable = isMarkedNullable)
}
val baseType = asClassName()
if (arguments.isEmpty()) {
return baseType
.copy(nullable = isMarkedNullable)
}
val parameters = arguments.map {
......@@ -53,4 +55,5 @@ fun KSType.asTypeName(): TypeName {
}
return baseType.parameterizedBy(parameters)
.copy(nullable = isMarkedNullable)
}
......@@ -39,7 +39,7 @@ abstract class StatefulSyncableObject<T>(
return result
}
override fun state(): T = state.value
override fun flow(): Flow<T> = state
final override fun state(): T = state.value
final override fun flow(): Flow<T> = state
protected val state = MutableStateFlow(state)
}
......@@ -464,7 +464,7 @@ open class Network(
super.setIdentity(identityId)
}
override fun setMyNick(myNick: String) {
override fun setMyNick(myNick: String?) {
state.update {
copy(myNick = myNick)
}
......@@ -485,7 +485,7 @@ open class Network(
super.setNetworkName(networkName)
}
override fun setCurrentServer(currentServer: String) {
override fun setCurrentServer(currentServer: String?) {
state.update {
copy(currentServer = currentServer)
}
......@@ -502,7 +502,7 @@ open class Network(
ircUsers.values.forEach(it.proxy::stopSynchronize)
}
copy(
connected = isConnected,
connected = false,
myNick = "",
currentServer = "",
ircChannels = emptyMap(),
......
......@@ -27,7 +27,7 @@ data class NetworkState(
val myNick: String? = "",
val latency: Int = 0,
val networkName: String = "<not initialized>",
val currentServer: String = "",
val currentServer: String? = "",
val connected: Boolean = false,
val connectionState: ConnectionState = ConnectionState.Disconnected,
val ircUsers: Map<String, IrcUser> = emptyMap(),
......
......@@ -62,7 +62,7 @@ interface IgnoreListManagerStub : StatefulSyncableStub {
isActive: Boolean
) {
sync(
target = ProtocolSide.CLIENT,
target = ProtocolSide.CORE,
"requestAddIgnoreListItem",
qVariant(type, QtType.Int),
qVariant(ignoreRule, QtType.QString),
......
......@@ -35,7 +35,7 @@ interface NetworkStub : StatefulSyncableStub {
}
@SyncedCall(target = ProtocolSide.CLIENT)
fun setCurrentServer(currentServer: String) {
fun setCurrentServer(currentServer: String?) {
sync(
target = ProtocolSide.CLIENT,
"setCurrentServer",
......@@ -44,7 +44,7 @@ interface NetworkStub : StatefulSyncableStub {
}
@SyncedCall(target = ProtocolSide.CLIENT)
fun setMyNick(myNick: String) {
fun setMyNick(myNick: String?) {
sync(
target = ProtocolSide.CLIENT,
"setMyNick",
......@@ -361,7 +361,7 @@ interface NetworkStub : StatefulSyncableStub {
@SyncedCall(target = ProtocolSide.CORE)
fun requestConnect() {
sync(
target = ProtocolSide.CLIENT,
target = ProtocolSide.CORE,
"requestConnect",
)
}
......@@ -369,7 +369,7 @@ interface NetworkStub : StatefulSyncableStub {
@SyncedCall(target = ProtocolSide.CORE)
fun requestDisconnect() {
sync(
target = ProtocolSide.CLIENT,
target = ProtocolSide.CORE,
"requestDisconnect",
)
}
......@@ -377,7 +377,7 @@ interface NetworkStub : StatefulSyncableStub {
@SyncedCall(target = ProtocolSide.CORE)
fun requestSetNetworkInfo(info: NetworkInfo) {
sync(
target = ProtocolSide.CLIENT,
target = ProtocolSide.CORE,
"requestSetNetworkInfo",
qVariant(info, QuasselType.NetworkInfo),
)
......
......@@ -55,7 +55,7 @@ open class EmptySession : Session {
override fun removeIdentity(id: IdentityId) = Unit
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 rename(className: String, oldName: String, newName: String) = Unit
......