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

Implement some first syncables

parent fb0ce71a
Branches
Tags
No related merge requests found
Showing
with 1732 additions and 340 deletions
...@@ -22,7 +22,7 @@ buildscript { ...@@ -22,7 +22,7 @@ buildscript {
} }
dependencies { dependencies {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20") classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20")
classpath("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.4.30") classpath("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.4.31")
} }
} }
......
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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
enum class ChannelModeType(
/**
* Underlying representation
*/
val value: UInt,
) {
// NOT_A_CHANMODE(0x00u),
A_CHANMODE(0x01u),
B_CHANMODE(0x02u),
C_CHANMODE(0x04u),
D_CHANMODE(0x08u);
companion object {
private val values = enumValues<ChannelModeType>()
.associateBy(ChannelModeType::value)
/**
* Obtain from underlying representation
*/
fun of(value: UInt): ChannelModeType? = values[value]
}
}
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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.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
data class ChannelModes(
val a: Map<Char, Set<String>> = emptyMap(),
val b: Map<Char, String> = emptyMap(),
val c: Map<Char, String> = emptyMap(),
val d: Set<Char> = emptySet()
) {
fun modeString(): String {
if (b.isEmpty() && c.isEmpty() && d.isEmpty()) {
return ""
}
val buffer = StringBuilder("+")
val params = mutableListOf<String>()
d.joinTo(buffer)
for ((mode, param) in c) {
buffer.append(mode)
params.add(param)
}
for ((mode, param) in b) {
buffer.append(mode)
params.add(param)
}
buffer.append(' ')
params.joinTo(buffer, " ")
return buffer.toString()
}
fun toVariantMap(): QVariantMap {
return mapOf(
"A" to qVariant(
a.map { (key, value) ->
key.toString() to qVariant(value.toList(), QtType.QStringList)
}.toMap(),
QtType.QVariantMap
),
"B" to qVariant(
b.map { (key, value) ->
key.toString() to qVariant(value, QtType.QString)
}.toMap(),
QtType.QVariantMap
),
"C" to qVariant(
c.map { (key, value) ->
key.toString() to qVariant(value, QtType.QString)
}.toMap(),
QtType.QVariantMap
),
"D" to qVariant(d.joinToString(), QtType.QString),
)
}
companion object {
fun fromVariantMap(properties: QVariantMap) = ChannelModes(
a = properties["A"].into<QVariantMap>()?.map { (key, value) ->
key.first() to value.into<QStringList>()
?.filterNotNull()
?.toSet()
.orEmpty()
}?.toMap().orEmpty(),
b = properties["B"].into<QVariantMap>()?.map { (key, value) ->
key.first() to value.into<String>().orEmpty()
}?.toMap().orEmpty(),
c = properties["C"].into<QVariantMap>()?.map { (key, value) ->
key.first() to value.into<String>().orEmpty()
}?.toMap().orEmpty(),
d = properties["D"].into<String>()?.toSet().orEmpty()
)
}
}
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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
enum class ConnectionState(
/**
* Underlying representation
*/
val value: Int,
) {
Disconnected(0),
Connecting(1),
Initializing(2),
Initialized(3),
Reconnecting(4),
Disconnecting(5);
companion object {
private val values = enumValues<ConnectionState>()
.associateBy(ConnectionState::value)
/**
* Obtain from underlying representation
*/
fun of(value: Int): ConnectionState? = values[value]
}
}
...@@ -15,10 +15,14 @@ import de.justjanne.libquassel.protocol.models.BufferInfo ...@@ -15,10 +15,14 @@ import de.justjanne.libquassel.protocol.models.BufferInfo
import de.justjanne.libquassel.protocol.models.Command import de.justjanne.libquassel.protocol.models.Command
import de.justjanne.libquassel.protocol.models.QStringList import de.justjanne.libquassel.protocol.models.QStringList
import de.justjanne.libquassel.protocol.models.types.QtType import de.justjanne.libquassel.protocol.models.types.QtType
import de.justjanne.libquassel.protocol.syncables.state.AliasManagerState
import de.justjanne.libquassel.protocol.syncables.stubs.AliasManagerStub import de.justjanne.libquassel.protocol.syncables.stubs.AliasManagerStub
import de.justjanne.libquassel.protocol.util.expansion.Expansion
import de.justjanne.libquassel.protocol.util.update
import de.justjanne.libquassel.protocol.variant.QVariantMap import de.justjanne.libquassel.protocol.variant.QVariantMap
import de.justjanne.libquassel.protocol.variant.into import de.justjanne.libquassel.protocol.variant.into
import de.justjanne.libquassel.protocol.variant.qVariant import de.justjanne.libquassel.protocol.variant.qVariant
import kotlinx.coroutines.flow.MutableStateFlow
class AliasManager constructor( class AliasManager constructor(
session: Session session: Session
...@@ -32,8 +36,8 @@ class AliasManager constructor( ...@@ -32,8 +36,8 @@ class AliasManager constructor(
} }
private fun initAliases(): QVariantMap = mapOf( private fun initAliases(): QVariantMap = mapOf(
"names" to qVariant(aliases.map(Alias::name), QtType.QStringList), "names" to qVariant(aliases().map(Alias::name), QtType.QStringList),
"expansions" to qVariant(aliases.map(Alias::expansion), QtType.QStringList) "expansions" to qVariant(aliases().map(Alias::expansion), QtType.QStringList)
) )
private fun initSetAliases(aliases: QVariantMap) { private fun initSetAliases(aliases: QVariantMap) {
...@@ -44,7 +48,9 @@ class AliasManager constructor( ...@@ -44,7 +48,9 @@ class AliasManager constructor(
"Sizes do not match: names=${names.size}, expansions=${expansions.size}" "Sizes do not match: names=${names.size}, expansions=${expansions.size}"
} }
this.aliases = names.zip(expansions, ::Alias) state.update {
copy(aliases = names.zip(expansions, ::Alias))
}
} }
override fun addAlias(name: String, expansion: String) { override fun addAlias(name: String, expansion: String) {
...@@ -52,13 +58,17 @@ class AliasManager constructor( ...@@ -52,13 +58,17 @@ class AliasManager constructor(
return return
} }
aliases += Alias(name, expansion) state.update {
copy(aliases = aliases + Alias(name, expansion))
}
super.addAlias(name, expansion) super.addAlias(name, expansion)
} }
fun indexOf(name: String?) = aliases.map(Alias::name).indexOf(name) fun aliases() = state.value.aliases
fun contains(name: String?) = aliases.map(Alias::name).contains(name) fun indexOf(name: String?) = aliases().map(Alias::name).indexOf(name)
fun contains(name: String?) = aliases().map(Alias::name).contains(name)
fun processInput( fun processInput(
info: BufferInfo, info: BufferInfo,
...@@ -78,7 +88,7 @@ class AliasManager constructor( ...@@ -78,7 +88,7 @@ class AliasManager constructor(
// pure text. To ensure this won’t be unescaped twice it’s sent with /SAY. // pure text. To ensure this won’t be unescaped twice it’s sent with /SAY.
previousCommands.add(Command(info, "/SAY $arguments")) previousCommands.add(Command(info, "/SAY $arguments"))
} else { } else {
val found = aliases.firstOrNull { it.name.equals(command, true) } val found = aliases().firstOrNull { it.name.equals(command, true) }
if (found != null) { if (found != null) {
expand(found.expansion ?: "", info, arguments, previousCommands) expand(found.expansion ?: "", info, arguments, previousCommands)
} else { } else {
...@@ -93,32 +103,57 @@ class AliasManager constructor( ...@@ -93,32 +103,57 @@ class AliasManager constructor(
arguments: String, arguments: String,
previousCommands: MutableList<Command> previousCommands: MutableList<Command>
) { ) {
/* val network = session.network(bufferInfo.networkId)
val params = arguments.split(' ') val params = arguments.split(' ')
previousCommands.add(
Command(
bufferInfo,
expansion.split(';') expansion.split(';')
.map(String::trimStart) .map(String::trimStart)
.map(Expansion.Companion::parse) .map(Expansion.Companion::parse)
.map { .map {
it.map { it.map {
when (it) { when (it) {
is Expansion.Constant -> TODO() is Expansion.Constant -> when (it.field) {
is Expansion.Parameter -> TODO() Expansion.ConstantField.CHANNEL ->
bufferInfo.bufferName
Expansion.ConstantField.NICK ->
network?.myNick()
Expansion.ConstantField.NETWORK ->
network?.networkName()
}
is Expansion.Parameter -> when (it.field) {
Expansion.ParameterField.HOSTNAME ->
network?.ircUser(params[it.index])?.host() ?: "*"
Expansion.ParameterField.VERIFIED_IDENT ->
params.getOrNull(it.index)?.let { param ->
network?.ircUser(param)?.verifiedUser() ?: "*"
}
Expansion.ParameterField.IDENT ->
params.getOrNull(it.index)?.let { param ->
network?.ircUser(param)?.user() ?: "*"
}
Expansion.ParameterField.ACCOUNT ->
params.getOrNull(it.index)?.let { param ->
network?.ircUser(param)?.account() ?: "*"
}
null -> params.getOrNull(it.index) ?: it.source
}
is Expansion.ParameterRange -> is Expansion.ParameterRange ->
params.subList(it.from, it.to ?: params.size) params.subList(it.from, it.to ?: params.size)
.joinToString(" ") .joinToString(" ")
is Expansion.Text -> is Expansion.Text ->
it.value it.source
} } ?: it.source
}
} }
*/ }.joinToString(";")
} )
)
fun copy() = AliasManager(session).also {
it.fromVariantMap(toVariantMap())
} }
var aliases = listOf<Alias>() private val state = MutableStateFlow(
AliasManagerState()
)
companion object { companion object {
private fun determineMessageCommand(message: String) = when { private fun determineMessageCommand(message: String) = when {
......
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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.syncables
import de.justjanne.libquassel.protocol.models.ChannelModeType
import de.justjanne.libquassel.protocol.models.ChannelModes
import de.justjanne.libquassel.protocol.models.QStringList
import de.justjanne.libquassel.protocol.models.ids.NetworkId
import de.justjanne.libquassel.protocol.models.types.QtType
import de.justjanne.libquassel.protocol.syncables.state.IrcChannelState
import de.justjanne.libquassel.protocol.syncables.stubs.IrcChannelStub
import de.justjanne.libquassel.protocol.util.update
import de.justjanne.libquassel.protocol.variant.QVariantMap
import de.justjanne.libquassel.protocol.variant.indexed
import de.justjanne.libquassel.protocol.variant.into
import de.justjanne.libquassel.protocol.variant.qVariant
import kotlinx.coroutines.flow.MutableStateFlow
class IrcChannel(
name: String,
network: NetworkId,
session: Session
) : SyncableObject(session, "IrcChannel"), IrcChannelStub {
override fun init() {
require(name().isNotEmpty()) {
"IrcChannel: channelName is empty"
}
renameObject("${network().id}/${name()}")
}
override fun fromVariantMap(properties: QVariantMap) =
fromVariantMap(properties, null)
fun fromVariantMap(properties: QVariantMap, index: Int?) {
state.update {
copy(
name = properties["name"].indexed(index).into(name),
topic = properties["topic"].indexed(index).into(topic),
password = properties["password"].indexed(index).into(password),
encrypted = properties["encrypted"].indexed(index).into(encrypted),
channelModes = properties["ChanModes"].indexed(index).into<QVariantMap>()
?.let(ChannelModes.Companion::fromVariantMap) ?: channelModes,
userModes = properties["UserModes"].into<QVariantMap>()
?.mapValues { (_, value) -> value.into<String>()?.toSet().orEmpty() }
.orEmpty()
)
}
}
override fun toVariantMap(): QVariantMap {
return mapOf(
"name" to qVariant(name(), QtType.QString),
"topic" to qVariant(topic(), QtType.QString),
"password" to qVariant(password(), QtType.QString),
"encrypted" to qVariant(isEncrypted(), QtType.Bool),
"ChanModes" to qVariant(state.value.channelModes.toVariantMap(), QtType.QVariantMap),
"UserModes" to qVariant(
state.value.userModes.mapValues { (_, value) ->
qVariant(value.joinToString(), QtType.QString)
},
QtType.QVariantMap
)
)
}
fun network() = state.value.network
fun name() = state.value.name
fun topic() = state.value.topic
fun password() = state.value.password
fun isEncrypted() = state.value.encrypted
fun ircUsers() = session.network(network())?.let { network ->
state.value.userModes.keys.mapNotNull(network::ircUser)
}.orEmpty()
fun userCount() = state.value.userModes.size
fun userModes(nick: String) = state.value.userModes[nick]
fun hasMode(mode: Char) = when (session.network(network())?.channelModeType(mode)) {
ChannelModeType.A_CHANMODE ->
state.value.channelModes.a.contains(mode)
ChannelModeType.B_CHANMODE ->
state.value.channelModes.b.contains(mode)
ChannelModeType.C_CHANMODE ->
state.value.channelModes.c.contains(mode)
ChannelModeType.D_CHANMODE ->
state.value.channelModes.d.contains(mode)
else ->
false
}
fun modeValue(mode: Char) = when (session.network(network())?.channelModeType(mode)) {
ChannelModeType.B_CHANMODE ->
state.value.channelModes.b[mode] ?: ""
ChannelModeType.C_CHANMODE ->
state.value.channelModes.c[mode] ?: ""
else ->
""
}
fun modeValues(mode: Char) = when (session.network(network())?.channelModeType(mode)) {
ChannelModeType.A_CHANMODE ->
state.value.channelModes.a[mode].orEmpty()
else ->
emptySet()
}
fun channelModeString() = state.value.channelModes.modeString()
override fun setTopic(topic: String) {
state.update {
copy(topic = topic)
}
super.setTopic(topic)
}
override fun setPassword(password: String) {
state.update {
copy(password = password)
}
super.setPassword(password)
}
override fun setEncrypted(encrypted: Boolean) {
state.update {
copy(encrypted = encrypted)
}
super.setEncrypted(encrypted)
}
override fun joinIrcUsers(nicks: QStringList, modes: QStringList) {
joinIrcUsers(
nicks.filterNotNull().zip(modes).map { (nick, mode) ->
Pair(nick, mode?.toSet().orEmpty())
}.toMap()
)
super.joinIrcUsers(nicks, modes)
}
private fun joinIrcUsers(map: Map<String, Set<Char>>) {
val network = session.network(network())
val newNicks = map.keys - state.value.userModes.keys
state.update {
copy(
userModes = userModes + map.mapValues { (key, value) ->
value + userModes[key].orEmpty()
}
)
}
for (newNick in newNicks) {
network
?.ircUser(newNick)
?.joinChannel(this, skipChannelJoin = true)
}
}
fun joinIrcUser(user: IrcUser) = joinIrcUsers(
mapOf(
user.nick() to emptySet()
)
)
override fun part(nick: String) {
val network = session.network(network())
val partingUser = network?.ircUser(nick)
if (partingUser != null) {
partingUser.partChannel(name())
if (network.isMe(partingUser) || state.value.userModes.isEmpty()) {
for (nickname in state.value.userModes.keys.toList()) {
network.ircUser(nickname)?.partChannel(this)
}
state.update {
copy(channelModes = ChannelModes())
}
network.removeIrcChannel(this)
session.stopSynchronize(this)
}
}
super.part(nick)
}
override fun setUserModes(nick: String, modes: String?) {
state.update {
copy(
userModes = userModes + Pair(
nick,
modes?.toSet().orEmpty()
)
)
}
super.setUserModes(nick, modes)
}
override fun addUserMode(nick: String, mode: String?) {
state.update {
copy(
userModes = userModes + Pair(
nick,
userModes[nick].orEmpty() + mode?.toSet().orEmpty()
)
)
}
super.addUserMode(nick, mode)
}
override fun removeUserMode(nick: String, mode: String?) {
state.update {
copy(
userModes = userModes + Pair(
nick,
userModes[nick].orEmpty() - mode?.toSet().orEmpty()
)
)
}
super.addUserMode(nick, mode)
}
override fun addChannelMode(mode: Char, value: String?) {
val network = session.network(network())
state.update {
copy(
channelModes = channelModes.run {
when (network?.channelModeType(mode)) {
ChannelModeType.A_CHANMODE -> {
requireNotNull(value) {
"Mode $mode of ChannelModeType A must have a value"
}
copy(a = a + Pair(mode, a[mode].orEmpty() + value))
}
ChannelModeType.B_CHANMODE -> {
requireNotNull(value) {
"Mode $mode of ChannelModeType B must have a value"
}
copy(b = b + Pair(mode, value))
}
ChannelModeType.C_CHANMODE -> {
requireNotNull(value) {
"Mode $mode of ChannelModeType C must have a value"
}
copy(c = c + Pair(mode, value))
}
ChannelModeType.D_CHANMODE ->
copy(d = d + mode)
else -> channelModes
}
}
)
}
super.addChannelMode(mode, value)
}
override fun removeChannelMode(mode: Char, value: String?) {
val network = session.network(network())
state.update {
copy(
channelModes = channelModes.run {
when (network?.channelModeType(mode)) {
ChannelModeType.A_CHANMODE -> {
requireNotNull(value) {
"Mode $mode of ChannelModeType A must have a value"
}
copy(a = a + Pair(mode, a[mode].orEmpty() - value))
}
ChannelModeType.B_CHANMODE -> {
copy(b = b - mode)
}
ChannelModeType.C_CHANMODE -> {
copy(b = c - mode)
}
ChannelModeType.D_CHANMODE ->
copy(d = d - mode)
else -> channelModes
}
}
)
}
super.removeChannelMode(mode, value)
}
private val state = MutableStateFlow(
IrcChannelState(
network = network,
name = name
)
)
}
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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.syncables
import de.justjanne.libquassel.protocol.models.ids.NetworkId
import de.justjanne.libquassel.protocol.models.types.QtType
import de.justjanne.libquassel.protocol.syncables.state.IrcUserState
import de.justjanne.libquassel.protocol.syncables.stubs.IrcUserStub
import de.justjanne.libquassel.protocol.util.irc.HostmaskHelper
import de.justjanne.libquassel.protocol.util.update
import de.justjanne.libquassel.protocol.variant.QVariantMap
import de.justjanne.libquassel.protocol.variant.indexed
import de.justjanne.libquassel.protocol.variant.into
import de.justjanne.libquassel.protocol.variant.qVariant
import kotlinx.coroutines.flow.MutableStateFlow
import org.threeten.bp.Instant
import org.threeten.bp.temporal.Temporal
class IrcUser(
hostmask: String,
network: NetworkId,
session: Session
) : SyncableObject(session, "IrcUser"), IrcUserStub {
override fun init() {
updateObjectName()
}
private fun updateObjectName() {
renameObject("${network().id}/${nick()}")
}
override fun fromVariantMap(properties: QVariantMap) =
fromVariantMap(properties, null)
fun fromVariantMap(properties: QVariantMap, index: Int?) {
state.update {
copy(
nick = properties["nick"].indexed(index).into(nick),
user = properties["user"].indexed(index).into(user),
host = properties["host"].indexed(index).into(host),
realName = properties["realName"].indexed(index).into(realName),
account = properties["account"].indexed(index).into(account),
away = properties["away"].indexed(index).into(away),
awayMessage = properties["user"].indexed(index).into(awayMessage),
idleTime = properties["idleTime"].indexed(index).into(idleTime),
loginTime = properties["loginTime"].indexed(index).into(loginTime),
server = properties["server"].indexed(index).into(server),
ircOperator = properties["ircOperator"].indexed(index).into(ircOperator),
lastAwayMessageTime = properties["lastAwayMessageTime"].indexed(index).into()
?: properties["lastAwayMessage"].indexed(index).into<Int>()?.toLong()
?.let(Instant::ofEpochSecond)
?: lastAwayMessageTime,
whoisServiceReply = properties["whoisServiceReply"].indexed(index).into(whoisServiceReply),
suserHost = properties["suserHost"].indexed(index).into(suserHost),
encrypted = properties["encrypted"].indexed(index).into(encrypted),
channels = properties["channels"].indexed(index).into(channels),
userModes = properties["userModes"].indexed(index).into(userModes),
)
}
}
override fun toVariantMap() = mapOf(
"nick" to qVariant(nick(), QtType.QString),
"user" to qVariant(user(), QtType.QString),
"host" to qVariant(host(), QtType.QString),
"realName" to qVariant(realName(), QtType.QString),
"account" to qVariant(account(), QtType.QString),
"away" to qVariant(isAway(), QtType.Bool),
"awayMessage" to qVariant(awayMessage(), QtType.QString),
"idleTime" to qVariant(idleTime(), QtType.QDateTime),
"loginTime" to qVariant(loginTime(), QtType.QDateTime),
"server" to qVariant(server(), QtType.QString),
"ircOperator" to qVariant(ircOperator(), QtType.QString),
"lastAwayMessage" to qVariant(lastAwayMessageTime().epochSecond.toInt(), QtType.Int),
"lastAwayMessageTime" to qVariant(lastAwayMessageTime(), QtType.QDateTime),
"whoisServiceReply" to qVariant(whoisServiceReply(), QtType.QString),
"suserHost" to qVariant(suserHost(), QtType.QString),
"encrypted" to qVariant(encrypted(), QtType.Bool),
"channels" to qVariant(channels(), QtType.QStringList),
"userModes" to qVariant(userModes(), QtType.QString)
)
override fun updateHostmask(mask: String) {
state.update {
val (_, user, host) = HostmaskHelper.split(mask)
copy(user = user, host = host)
}
super.updateHostmask(mask)
}
override fun addUserModes(modes: String) {
state.update {
copy(userModes = userModes + modes.toSet())
}
super.addUserModes(modes)
}
override fun removeUserModes(modes: String) {
state.update {
copy(userModes = userModes - modes.toSet())
}
super.removeUserModes(modes)
}
override fun setUser(user: String) {
state.update {
copy(user = user)
}
super.setUser(user)
}
override fun setHost(host: String) {
state.update {
copy(host = host)
}
super.setHost(host)
}
override fun setNick(nick: String) {
val network = session.network(network())
network?.ircUserNickChanged(nick(), nick)
state.update {
copy(nick = nick)
}
updateObjectName()
super.setNick(nick)
}
override fun setRealName(realName: String) {
state.update {
copy(realName = realName)
}
super.setRealName(realName)
}
override fun setAccount(account: String) {
state.update {
copy(account = account)
}
super.setAccount(account)
}
override fun setAway(away: Boolean) {
state.update {
copy(away = away)
}
super.setAway(away)
}
override fun setAwayMessage(awayMessage: String) {
state.update {
copy(awayMessage = awayMessage)
}
super.setAwayMessage(awayMessage)
}
override fun setIdleTime(idleTime: Temporal) {
state.update {
copy(idleTime = Instant.from(idleTime))
}
super.setIdleTime(idleTime)
}
override fun setLoginTime(loginTime: Temporal) {
state.update {
copy(loginTime = Instant.from(loginTime))
}
super.setLoginTime(loginTime)
}
override fun setIrcOperator(ircOperator: String) {
state.update {
copy(ircOperator = ircOperator)
}
super.setIrcOperator(ircOperator)
}
override fun setLastAwayMessage(lastAwayMessage: Int) {
state.update {
copy(lastAwayMessageTime = Instant.ofEpochSecond(lastAwayMessage.toLong()))
}
super.setLastAwayMessage(lastAwayMessage)
}
override fun setLastAwayMessageTime(lastAwayMessageTime: Temporal) {
state.update {
copy(lastAwayMessageTime = Instant.from(lastAwayMessageTime))
}
super.setLastAwayMessageTime(lastAwayMessageTime)
}
override fun setWhoisServiceReply(whoisServiceReply: String) {
state.update {
copy(whoisServiceReply = whoisServiceReply)
}
super.setWhoisServiceReply(whoisServiceReply)
}
override fun setSuserHost(suserHost: String) {
state.update {
copy(suserHost = suserHost)
}
super.setSuserHost(suserHost)
}
override fun setEncrypted(encrypted: Boolean) {
state.update {
copy(encrypted = encrypted)
}
super.setEncrypted(encrypted)
}
override fun setServer(server: String) {
state.update {
copy(server = server)
}
super.setServer(server)
}
override fun setUserModes(modes: String) {
state.update {
copy(userModes = userModes.toSet())
}
super.setUserModes(modes)
}
fun joinChannel(channel: IrcChannel, skipChannelJoin: Boolean = false) {
if (state.value.channels.contains(channel.name())) {
return
}
state.update {
copy(channels = channels + channel.name())
}
if (!skipChannelJoin) {
channel.joinIrcUser(this)
}
super.joinChannel(channel.name())
}
override fun joinChannel(channelname: String) {
val network = session.network(network()) ?: return
val channel = network.newIrcChannel(channelname)
joinChannel(channel)
}
fun partChannel(channel: IrcChannel) {
val network = session.network(network())
state.update {
copy(channels = channels - channel.name())
}
channel.part(nick())
super.partChannel(channel.name())
if (channels().isEmpty() && network?.isMe(this) != true) {
quit()
}
}
override fun quit() {
val network = session.network(network())
for (channel in channels()) {
network?.ircChannel(channel)
?.part(nick())
}
state.update {
copy(channels = emptySet())
}
network?.removeIrcUser(this)
session.stopSynchronize(this)
super.quit()
}
fun network() = state.value.network
fun nick() = state.value.nick
fun user() = state.value.user
fun verifiedUser() = user().let {
if (it.startsWith("~")) null
else it
}
fun host() = state.value.host
fun realName() = state.value.realName
fun account() = state.value.account
fun hostMask() = "${nick()}!${user()}@${host()}"
fun isAway() = state.value.away
fun awayMessage() = state.value.awayMessage
fun server() = state.value.server
fun idleTime() = state.value.idleTime
fun loginTime() = state.value.loginTime
fun ircOperator() = state.value.ircOperator
fun lastAwayMessageTime() = state.value.lastAwayMessageTime
fun whoisServiceReply() = state.value.whoisServiceReply
fun suserHost() = state.value.suserHost
fun encrypted() = state.value.encrypted
fun userModes() = state.value.userModes
fun channels() = state.value.channels
private val state = MutableStateFlow(
IrcUserState(
network = network,
nick = HostmaskHelper.nick(hostmask),
user = HostmaskHelper.user(hostmask),
host = HostmaskHelper.host(hostmask)
)
)
}
...@@ -15,7 +15,6 @@ import de.justjanne.libquassel.protocol.models.SignalProxyMessage ...@@ -15,7 +15,6 @@ import de.justjanne.libquassel.protocol.models.SignalProxyMessage
import de.justjanne.libquassel.protocol.models.ids.IdentityId import de.justjanne.libquassel.protocol.models.ids.IdentityId
import de.justjanne.libquassel.protocol.models.ids.NetworkId import de.justjanne.libquassel.protocol.models.ids.NetworkId
import de.justjanne.libquassel.protocol.syncables.stubs.IdentityStub import de.justjanne.libquassel.protocol.syncables.stubs.IdentityStub
import de.justjanne.libquassel.protocol.syncables.stubs.NetworkStub
import de.justjanne.libquassel.protocol.syncables.stubs.RpcHandlerStub import de.justjanne.libquassel.protocol.syncables.stubs.RpcHandlerStub
import de.justjanne.libquassel.protocol.variant.QVariantList import de.justjanne.libquassel.protocol.variant.QVariantList
...@@ -24,9 +23,12 @@ interface Session : RpcHandlerStub { ...@@ -24,9 +23,12 @@ interface Session : RpcHandlerStub {
val objectRepository: ObjectRepository val objectRepository: ObjectRepository
fun network(id: NetworkId): NetworkStub fun network(id: NetworkId): Network?
fun identity(id: IdentityId): IdentityStub fun identity(id: IdentityId): IdentityStub
fun synchronize(it: SyncableObject)
fun stopSynchronize(it: SyncableObject)
fun sync( fun sync(
target: ProtocolSide, target: ProtocolSide,
className: String, className: String,
......
...@@ -38,11 +38,6 @@ abstract class SyncableObject( ...@@ -38,11 +38,6 @@ abstract class SyncableObject(
} }
} }
override fun init() { override fun init() = Unit
initialized = true override fun deinit() = Unit
}
override fun deinit() {
initialized = false
}
} }
...@@ -45,9 +45,6 @@ interface SyncableStub { ...@@ -45,9 +45,6 @@ interface SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"update", "update",
/**
* Construct a QVariant from a QVariantMap
*/
qVariant(properties, QtType.QVariantMap) qVariant(properties, QtType.QVariantMap)
) )
} }
...@@ -56,9 +53,6 @@ interface SyncableStub { ...@@ -56,9 +53,6 @@ interface SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestUpdate", "requestUpdate",
/**
* Construct a QVariant from a QVariantMap
*/
qVariant(properties, QtType.QVariantMap) qVariant(properties, QtType.QVariantMap)
) )
} }
......
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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.syncables.state
import de.justjanne.libquassel.protocol.models.Alias
data class AliasManagerState(
val aliases: List<Alias> = emptyList()
)
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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.syncables.state
import de.justjanne.libquassel.protocol.models.ChannelModes
import de.justjanne.libquassel.protocol.models.ids.NetworkId
data class IrcChannelState(
val network: NetworkId,
val name: String,
val topic: String = "",
val password: String = "",
val encrypted: Boolean = false,
val channelModes: ChannelModes = ChannelModes(),
val userModes: Map<String, Set<Char>> = emptyMap()
)
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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.syncables.state
import de.justjanne.libquassel.protocol.models.ids.NetworkId
import org.threeten.bp.Instant
data class IrcUserState(
val network: NetworkId,
val nick: String,
val user: String,
val host: String,
val realName: String = "",
val account: String = "",
val away: Boolean = false,
val awayMessage: String = "",
val idleTime: Instant = Instant.EPOCH,
val loginTime: Instant = Instant.EPOCH,
val server: String = "",
val ircOperator: String = "",
val lastAwayMessageTime: Instant = Instant.EPOCH,
val whoisServiceReply: String = "",
val suserHost: String = "",
val encrypted: Boolean = false,
val channels: Set<String> = emptySet(),
val userModes: Set<Char> = emptySet()
)
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2021 The Quassel Project
*
* 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.syncables.state
import de.justjanne.libquassel.protocol.models.ChannelModeType
import de.justjanne.libquassel.protocol.models.ConnectionState
import de.justjanne.libquassel.protocol.models.NetworkServer
import de.justjanne.libquassel.protocol.models.ids.IdentityId
import de.justjanne.libquassel.protocol.models.ids.NetworkId
import de.justjanne.libquassel.protocol.syncables.IrcChannel
import de.justjanne.libquassel.protocol.syncables.IrcUser
data class NetworkState(
val id: NetworkId,
val identity: IdentityId = IdentityId(-1),
val myNick: String? = "",
val latency: Int = 0,
val networkName: String = "<not initialized>",
val currentServer: String = "",
val connected: Boolean = false,
val connectionState: ConnectionState = ConnectionState.Disconnected,
val prefixes: List<Char> = emptyList(),
val prefixModes: List<Char> = emptyList(),
val channelModes: Map<ChannelModeType, Set<Char>> = emptyMap(),
val ircUsers: Map<String, IrcUser> = emptyMap(),
val ircChannels: Map<String, IrcChannel> = emptyMap(),
val supports: Map<String, String?> = emptyMap(),
val caps: Map<String, String?> = emptyMap(),
val capsEnabled: Set<String> = emptySet(),
val skipCaps: Set<String> = emptySet(),
val serverList: List<NetworkServer> = emptyList(),
val useRandomServer: Boolean = false,
val perform: List<String> = emptyList(),
val useAutoIdentify: Boolean = false,
val autoIdentifyService: String = "",
val autoIdentifyPassword: String = "",
val useSasl: Boolean = false,
val saslAccount: String = "",
val saslPassword: String = "",
val useAutoReconnect: Boolean = false,
val autoReconnectInterval: UInt = 60u,
val autoReconnectRetries: UShort = 10u,
val unlimitedReconnectRetries: Boolean = false,
val rejoinChannels: Boolean = false,
val useCustomMessageRate: Boolean = false,
val messageRateBurstSize: UInt = 5u,
val messageRateDelay: UInt = 2200u,
val unlimitedMessageRate: Boolean = false,
val codecForServer: String = "UTF_8",
val codecForEncoding: String = "UTF_8",
val codecForDecoding: String = "UTF_8"
)
...@@ -25,13 +25,7 @@ interface AliasManagerStub : SyncableStub { ...@@ -25,13 +25,7 @@ interface AliasManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"addAlias", "addAlias",
/**
* Construct a QVariant from a String
*/
qVariant(name, QtType.QString), qVariant(name, QtType.QString),
/**
* Construct a QVariant from a String
*/
qVariant(expansion, QtType.QString) qVariant(expansion, QtType.QString)
) )
} }
......
...@@ -33,25 +33,10 @@ interface BacklogManagerStub : SyncableStub { ...@@ -33,25 +33,10 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestBacklog", "requestBacklog",
/**
* Construct a QVariant from a BufferId
*/
qVariant(bufferId, QuasselType.BufferId), qVariant(bufferId, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
) )
} }
...@@ -69,33 +54,12 @@ interface BacklogManagerStub : SyncableStub { ...@@ -69,33 +54,12 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestBacklogFiltered", "requestBacklogFiltered",
/**
* Construct a QVariant from a BufferId
*/
qVariant(bufferId, QuasselType.BufferId), qVariant(bufferId, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(type, QtType.Int), qVariant(type, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(flags, QtType.Int), qVariant(flags, QtType.Int),
) )
} }
...@@ -110,21 +74,9 @@ interface BacklogManagerStub : SyncableStub { ...@@ -110,21 +74,9 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestBacklogAll", "requestBacklogAll",
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
) )
} }
...@@ -141,29 +93,11 @@ interface BacklogManagerStub : SyncableStub { ...@@ -141,29 +93,11 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestBacklogAll", "requestBacklogAll",
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(type, QtType.Int), qVariant(type, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(flags, QtType.Int), qVariant(flags, QtType.Int),
) )
} }
...@@ -179,25 +113,10 @@ interface BacklogManagerStub : SyncableStub { ...@@ -179,25 +113,10 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"receiveBacklog", "receiveBacklog",
/**
* Construct a QVariant from a BufferId
*/
qVariant(bufferId, QuasselType.BufferId), qVariant(bufferId, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
) )
} }
...@@ -215,33 +134,12 @@ interface BacklogManagerStub : SyncableStub { ...@@ -215,33 +134,12 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"receiveBacklogFiltered", "receiveBacklogFiltered",
/**
* Construct a QVariant from a BufferId
*/
qVariant(bufferId, QuasselType.BufferId), qVariant(bufferId, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(type, QtType.Int), qVariant(type, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(flags, QtType.Int), qVariant(flags, QtType.Int),
) )
} }
...@@ -256,21 +154,9 @@ interface BacklogManagerStub : SyncableStub { ...@@ -256,21 +154,9 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"receiveBacklogAll", "receiveBacklogAll",
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
) )
} }
...@@ -287,29 +173,11 @@ interface BacklogManagerStub : SyncableStub { ...@@ -287,29 +173,11 @@ interface BacklogManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"receiveBacklogAllFiltered", "receiveBacklogAllFiltered",
/**
* Construct a QVariant from a MsgId
*/
qVariant(first, QuasselType.MsgId), qVariant(first, QuasselType.MsgId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(last, QuasselType.MsgId), qVariant(last, QuasselType.MsgId),
/**
* Construct a QVariant from a Int
*/
qVariant(limit, QtType.Int), qVariant(limit, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(additional, QtType.Int), qVariant(additional, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(type, QtType.Int), qVariant(type, QtType.Int),
/**
* Construct a QVariant from a Int
*/
qVariant(flags, QtType.Int), qVariant(flags, QtType.Int),
) )
} }
......
...@@ -28,9 +28,6 @@ interface BufferSyncerStub : SyncableStub { ...@@ -28,9 +28,6 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"markBufferAsRead", "markBufferAsRead",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -40,9 +37,6 @@ interface BufferSyncerStub : SyncableStub { ...@@ -40,9 +37,6 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestMarkBufferAsRead", "requestMarkBufferAsRead",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -52,13 +46,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -52,13 +46,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"mergeBuffersPermanently", "mergeBuffersPermanently",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer2, QuasselType.BufferId), qVariant(buffer2, QuasselType.BufferId),
) )
} }
...@@ -68,13 +56,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -68,13 +56,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestMergeBuffersPermanently", "requestMergeBuffersPermanently",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer2, QuasselType.BufferId), qVariant(buffer2, QuasselType.BufferId),
) )
} }
...@@ -84,9 +66,6 @@ interface BufferSyncerStub : SyncableStub { ...@@ -84,9 +66,6 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"removeBuffer", "removeBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -96,9 +75,6 @@ interface BufferSyncerStub : SyncableStub { ...@@ -96,9 +75,6 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestRemoveBuffer", "requestRemoveBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -108,13 +84,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -108,13 +84,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"renameBuffer", "renameBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a String
*/
qVariant(newName, QtType.QString), qVariant(newName, QtType.QString),
) )
} }
...@@ -124,13 +94,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -124,13 +94,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestRenameBuffer", "requestRenameBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a String
*/
qVariant(newName, QtType.QString), qVariant(newName, QtType.QString),
) )
} }
...@@ -140,13 +104,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -140,13 +104,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setMarkerLine", "setMarkerLine",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(msgId, QuasselType.MsgId), qVariant(msgId, QuasselType.MsgId),
) )
} }
...@@ -156,13 +114,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -156,13 +114,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestSetLastSeenMsg", "requestSetLastSeenMsg",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(msgId, QuasselType.MsgId), qVariant(msgId, QuasselType.MsgId),
) )
} }
...@@ -172,13 +124,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -172,13 +124,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setLastSeenMsg", "setLastSeenMsg",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(msgId, QuasselType.MsgId), qVariant(msgId, QuasselType.MsgId),
) )
} }
...@@ -188,13 +134,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -188,13 +134,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestSetMarkerLine", "requestSetMarkerLine",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a MsgId
*/
qVariant(msgId, QuasselType.MsgId), qVariant(msgId, QuasselType.MsgId),
) )
} }
...@@ -204,13 +144,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -204,13 +144,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setBufferActivity", "setBufferActivity",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a Int
*/
qVariant(count, QtType.Int), qVariant(count, QtType.Int),
) )
} }
...@@ -220,13 +154,7 @@ interface BufferSyncerStub : SyncableStub { ...@@ -220,13 +154,7 @@ interface BufferSyncerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setHighlightCount", "setHighlightCount",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a Int
*/
qVariant(count, QtType.Int), qVariant(count, QtType.Int),
) )
} }
......
...@@ -28,13 +28,7 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -28,13 +28,7 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"addBuffer", "addBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a Int
*/
qVariant(pos, QtType.Int), qVariant(pos, QtType.Int),
) )
} }
...@@ -44,13 +38,7 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -44,13 +38,7 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestAddBuffer", "requestAddBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a Int
*/
qVariant(pos, QtType.Int), qVariant(pos, QtType.Int),
) )
} }
...@@ -60,13 +48,7 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -60,13 +48,7 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"moveBuffer", "moveBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a Int
*/
qVariant(pos, QtType.Int), qVariant(pos, QtType.Int),
) )
} }
...@@ -76,13 +58,7 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -76,13 +58,7 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestMoveBuffer", "requestMoveBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
/**
* Construct a QVariant from a Int
*/
qVariant(pos, QtType.Int), qVariant(pos, QtType.Int),
) )
} }
...@@ -92,9 +68,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -92,9 +68,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"removeBuffer", "removeBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -104,9 +77,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -104,9 +77,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestRemoveBuffer", "requestRemoveBuffer",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -116,9 +86,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -116,9 +86,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"removeBufferPermanently", "removeBufferPermanently",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -128,9 +95,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -128,9 +95,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestRemoveBufferPermanently", "requestRemoveBufferPermanently",
/**
* Construct a QVariant from a BufferId
*/
qVariant(buffer, QuasselType.BufferId), qVariant(buffer, QuasselType.BufferId),
) )
} }
...@@ -140,9 +104,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -140,9 +104,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setBufferViewName", "setBufferViewName",
/**
* Construct a QVariant from a String
*/
qVariant(value, QtType.QString), qVariant(value, QtType.QString),
) )
} }
...@@ -152,9 +113,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -152,9 +113,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestSetBufferViewName", "requestSetBufferViewName",
/**
* Construct a QVariant from a String
*/
qVariant(value, QtType.QString), qVariant(value, QtType.QString),
) )
} }
...@@ -164,9 +122,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -164,9 +122,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setAddNewBuffersAutomatically", "setAddNewBuffersAutomatically",
/**
* Construct a QVariant from a Boolean
*/
qVariant(value, QtType.Bool), qVariant(value, QtType.Bool),
) )
} }
...@@ -176,9 +131,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -176,9 +131,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setAllowedBufferTypes", "setAllowedBufferTypes",
/**
* Construct a QVariant from a Int
*/
qVariant(value, QtType.Int), qVariant(value, QtType.Int),
) )
} }
...@@ -188,9 +140,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -188,9 +140,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setDisableDecoration", "setDisableDecoration",
/**
* Construct a QVariant from a Boolean
*/
qVariant(value, QtType.Bool), qVariant(value, QtType.Bool),
) )
} }
...@@ -200,9 +149,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -200,9 +149,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setHideInactiveBuffers", "setHideInactiveBuffers",
/**
* Construct a QVariant from a Boolean
*/
qVariant(value, QtType.Bool), qVariant(value, QtType.Bool),
) )
} }
...@@ -212,9 +158,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -212,9 +158,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setHideInactiveNetworks", "setHideInactiveNetworks",
/**
* Construct a QVariant from a Boolean
*/
qVariant(value, QtType.Bool), qVariant(value, QtType.Bool),
) )
} }
...@@ -224,9 +167,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -224,9 +167,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setMinimumActivity", "setMinimumActivity",
/**
* Construct a QVariant from a Int
*/
qVariant(value, QtType.Int), qVariant(value, QtType.Int),
) )
} }
...@@ -236,9 +176,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -236,9 +176,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setNetworkId", "setNetworkId",
/**
* Construct a QVariant from a Message
*/
qVariant(value, QuasselType.NetworkId), qVariant(value, QuasselType.NetworkId),
) )
} }
...@@ -248,9 +185,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -248,9 +185,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setShowSearch", "setShowSearch",
/**
* Construct a QVariant from a Boolean
*/
qVariant(value, QtType.Bool), qVariant(value, QtType.Bool),
) )
} }
...@@ -260,9 +194,6 @@ interface BufferViewConfigStub : SyncableStub { ...@@ -260,9 +194,6 @@ interface BufferViewConfigStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"setSortAlphabetically", "setSortAlphabetically",
/**
* Construct a QVariant from a Boolean
*/
qVariant(value, QtType.Bool), qVariant(value, QtType.Bool),
) )
} }
......
...@@ -26,9 +26,6 @@ interface BufferViewManagerStub : SyncableStub { ...@@ -26,9 +26,6 @@ interface BufferViewManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"addBufferViewConfig", "addBufferViewConfig",
/**
* Construct a QVariant from a Int
*/
qVariant(bufferViewConfigId, QtType.Int), qVariant(bufferViewConfigId, QtType.Int),
) )
} }
...@@ -43,9 +40,6 @@ interface BufferViewManagerStub : SyncableStub { ...@@ -43,9 +40,6 @@ interface BufferViewManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestCreateBufferView", "requestCreateBufferView",
/**
* Construct a QVariant from a QVariantMap
*/
qVariant(properties, QtType.QVariantMap), qVariant(properties, QtType.QVariantMap),
) )
} }
...@@ -55,9 +49,6 @@ interface BufferViewManagerStub : SyncableStub { ...@@ -55,9 +49,6 @@ interface BufferViewManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestCreateBufferViews", "requestCreateBufferViews",
/**
* Construct a QVariant from a QVariantList
*/
qVariant(properties, QtType.QVariantList), qVariant(properties, QtType.QVariantList),
) )
} }
...@@ -67,9 +58,6 @@ interface BufferViewManagerStub : SyncableStub { ...@@ -67,9 +58,6 @@ interface BufferViewManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CLIENT, target = ProtocolSide.CLIENT,
"deleteBufferViewConfig", "deleteBufferViewConfig",
/**
* Construct a QVariant from a Int
*/
qVariant(bufferViewConfigId, QtType.Int), qVariant(bufferViewConfigId, QtType.Int),
) )
} }
...@@ -79,9 +67,6 @@ interface BufferViewManagerStub : SyncableStub { ...@@ -79,9 +67,6 @@ interface BufferViewManagerStub : SyncableStub {
sync( sync(
target = ProtocolSide.CORE, target = ProtocolSide.CORE,
"requestDeleteBufferView", "requestDeleteBufferView",
/**
* Construct a QVariant from a Int
*/
qVariant(bufferViewConfigId, QtType.Int), qVariant(bufferViewConfigId, QtType.Int),
) )
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment