diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/IOFormat.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/IOFormat.kt index b9c4babcb..070d578fb 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/IOFormat.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/IOFormat.kt @@ -8,7 +8,7 @@ import kotlinx.serialization.SerializationStrategy interface IOFormat : SerialFormat { - fun dump(serializer: SerializationStrategy, output: Output): ByteArray + fun dumpTo(serializer: SerializationStrategy, ojb: T, output: Output) fun load(deserializer: DeserializationStrategy, input: Input): T } diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt index 6070f7ce7..9de7aaa05 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt @@ -21,7 +21,24 @@ import kotlinx.serialization.modules.SerialModule import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.ProtoBuf +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.BYTE +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.DOUBLE +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.FLOAT +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.INT +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.JCE_MAX_STRING_LENGTH +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.LIST +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.LONG +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.MAP +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.SHORT +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.SIMPLE_LIST +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.STRING1 +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.STRING4 +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.STRUCT_BEGIN +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.STRUCT_END +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.ZERO_TYPE import net.mamoe.mirai.qqandroid.io.serialization.jce.JceHead +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId import net.mamoe.mirai.utils.io.readString import net.mamoe.mirai.utils.io.toReadPacket @@ -36,14 +53,14 @@ enum class JceCharset(val kotlinCharset: Charset) { UTF8(Charset.forName("UTF8")) } -internal fun getSerialId(desc: SerialDescriptor, index: Int): Int? = desc.findAnnotation(index)?.id +internal fun getSerialId(desc: SerialDescriptor, index: Int): Int? = desc.findAnnotation(index)?.id /** * Jce 数据结构序列化和反序列化工具, 能将 kotlinx.serialization 通用的注解标记格式的 `class` 序列化为 [ByteArray] */ @Suppress("DEPRECATION_ERROR") @OptIn(InternalSerializationApi::class) -class Jce private constructor(private val charset: JceCharset, override val context: SerialModule = EmptyModule) : +class JceOld private constructor(private val charset: JceCharset, override val context: SerialModule = EmptyModule) : SerialFormat, BinaryFormat { private inner class ListWriter( @@ -101,7 +118,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont private open inner class JceEncoder( internal val output: BytePacketBuilder ) : TaggedEncoder() { - override val context get() = this@Jce.context + override val context get() = this@JceOld.context override fun SerialDescriptor.getTag(index: Int): Int { return getSerialId(this, index) ?: error("cannot find @SerialId") @@ -753,10 +770,10 @@ class Jce private constructor(private val charset: JceCharset, override val cont @Suppress("MemberVisibilityCanBePrivate") companion object { - val UTF8 = Jce(JceCharset.UTF8) - val GBK = Jce(JceCharset.GBK) + val UTF8 = JceOld(JceCharset.UTF8) + val GBK = JceOld(JceCharset.GBK) - fun byCharSet(c: JceCharset): Jce { + fun byCharSet(c: JceCharset): JceOld { return if (c == JceCharset.UTF8) { UTF8 } else { @@ -764,22 +781,6 @@ class Jce private constructor(private val charset: JceCharset, override val cont } } - internal const val BYTE: Byte = 0 - internal const val DOUBLE: Byte = 5 - internal const val FLOAT: Byte = 4 - internal const val INT: Byte = 2 - internal const val JCE_MAX_STRING_LENGTH = 104857600 - internal const val LIST: Byte = 9 - internal const val LONG: Byte = 3 - internal const val MAP: Byte = 8 - internal const val SHORT: Byte = 1 - internal const val SIMPLE_LIST: Byte = 13 - internal const val STRING1: Byte = 6 - internal const val STRING4: Byte = 7 - internal const val STRUCT_BEGIN: Byte = 10 - internal const val STRUCT_END: Byte = 11 - internal const val ZERO_TYPE: Byte = 12 - private fun Any?.getClassName(): String = (if (this == null) Unit::class else this::class).qualifiedName?.split(".")?.takeLast(2)?.joinToString(".") ?: "" @@ -815,7 +816,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont } } -internal inline fun Jce.JceInput.skipToTagOrNull(tag: Int, block: (JceHead) -> R): R? { +internal inline fun JceOld.JceInput.skipToTagOrNull(tag: Int, block: (JceHead) -> R): R? { // println("skipping to $tag start") while (true) { if (isEndOfInput) { // 读不了了 diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt index 8c1441b9c..37f968d97 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt @@ -10,7 +10,6 @@ package net.mamoe.mirai.qqandroid.io.serialization.jce import kotlinx.io.core.* -import net.mamoe.mirai.qqandroid.io.serialization.Jce import net.mamoe.mirai.qqandroid.io.serialization.JceCharset import net.mamoe.mirai.utils.io.readString diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceNew.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceNew.kt index 2dd55063b..070f3f61f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceNew.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceNew.kt @@ -9,8 +9,8 @@ package net.mamoe.mirai.qqandroid.io.serialization.jce -import kotlinx.io.core.Input -import kotlinx.io.core.Output +import kotlinx.io.core.* +import kotlinx.serialization.BinaryFormat import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.SerialFormat import kotlinx.serialization.SerializationStrategy @@ -18,26 +18,56 @@ import kotlinx.serialization.modules.EmptyModule import kotlinx.serialization.modules.SerialModule import net.mamoe.mirai.qqandroid.io.serialization.IOFormat import net.mamoe.mirai.qqandroid.io.serialization.JceCharset +import net.mamoe.mirai.qqandroid.io.serialization.JceOld +import net.mamoe.mirai.utils.io.toReadPacket /** * Jce 数据结构序列化和反序列化器. * * @author Him188 */ -class JceNew( +class Jce( override val context: SerialModule, val charset: JceCharset -) : SerialFormat, IOFormat { - override fun dump(serializer: SerializationStrategy, output: Output): ByteArray { - TODO("Not yet implemented") +) : SerialFormat, IOFormat, BinaryFormat { + override fun dumpTo(serializer: SerializationStrategy, ojb: T, output: Output) { + output.writePacket(JceOld.byCharSet(this.charset).dumpAsPacket(serializer, ojb)) } override fun load(deserializer: DeserializationStrategy, input: Input): T { return JceDecoder(JceInput(input, charset), context).decodeSerializableValue(deserializer) } + override fun dump(serializer: SerializationStrategy, value: T): ByteArray { + return buildPacket { dumpTo(serializer, value, this) }.readBytes() + } + + override fun load(deserializer: DeserializationStrategy, bytes: ByteArray): T { + return load(deserializer, bytes.toReadPacket()) + } + companion object { - val UTF_8 = JceNew(EmptyModule, JceCharset.UTF8) - val GBK = JceNew(EmptyModule, JceCharset.GBK) + val UTF_8 = Jce(EmptyModule, JceCharset.UTF8) + val GBK = Jce(EmptyModule, JceCharset.GBK) + + fun byCharSet(c: JceCharset): Jce { + return if (c == JceCharset.UTF8) UTF_8 else GBK + } + + internal const val BYTE: Byte = 0 + internal const val DOUBLE: Byte = 5 + internal const val FLOAT: Byte = 4 + internal const val INT: Byte = 2 + internal const val JCE_MAX_STRING_LENGTH = 104857600 + internal const val LIST: Byte = 9 + internal const val LONG: Byte = 3 + internal const val MAP: Byte = 8 + internal const val SHORT: Byte = 1 + internal const val SIMPLE_LIST: Byte = 13 + internal const val STRING1: Byte = 6 + internal const val STRING4: Byte = 7 + internal const val STRUCT_BEGIN: Byte = 10 + internal const val STRUCT_END: Byte = 11 + internal const val ZERO_TYPE: Byte = 12 } } \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/common.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/common.kt index 6b015794d..d172a43b7 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/common.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/common.kt @@ -11,7 +11,6 @@ package net.mamoe.mirai.qqandroid.io.serialization.jce import kotlinx.io.core.Output import kotlinx.serialization.SerialInfo -import net.mamoe.mirai.qqandroid.io.serialization.Jce /** @@ -27,15 +26,47 @@ annotation class JceId(val id: Int) * 保留这个结构, 为将来增加功能的兼容性. */ @PublishedApi -internal data class JceTag( - val id: Int, - val isNullable: Boolean -){ +internal abstract class JceTag { + abstract val id: Int + abstract val isNullable: Boolean + internal var isSimpleByteArray: Boolean = false } +internal sealed class JceTagListElement( + override val isNullable: Boolean +) : JceTag(){ + override val id: Int get() = 0 + + object Nullable : JceTagListElement(true) + object NotNull : JceTagListElement(false) +} + +internal sealed class JceTagMapEntryKey( + override val isNullable: Boolean +) : JceTag(){ + override val id: Int get() = 0 + + object Nullable : JceTagMapEntryKey(true) + object NotNull : JceTagMapEntryKey(false) +} + +internal sealed class JceTagMapEntryValue( + override val isNullable: Boolean +) : JceTag() { + override val id: Int get() = 1 + + object Nullable : JceTagMapEntryValue(true) + object NotNull : JceTagMapEntryValue(false) +} + +internal data class JceTagCommon( + override val id: Int, + override val isNullable: Boolean +) : JceTag() + fun JceHead.checkType(type: Byte) { - check(this.type == type) {"type mismatch. Expected $type, actual ${this.type}"} + check(this.type == type) { "type mismatch. Expected $type, actual ${this.type}" } } @PublishedApi diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt index cdb62011a..7b12bee2b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt @@ -18,21 +18,29 @@ import kotlinx.serialization.SerialDescriptor import kotlinx.serialization.SerializationStrategy import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.ProtoBuf +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestDataVersion2 import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestDataVersion3 import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket +import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.firstValue import net.mamoe.mirai.utils.io.read +import net.mamoe.mirai.utils.io.readPacketExact +import net.mamoe.mirai.utils.io.toReadPacket import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName fun ByteArray.loadAs(deserializer: DeserializationStrategy, c: JceCharset = JceCharset.UTF8): T { - return Jce.byCharSet(c).load(deserializer, this) + return Jce.byCharSet(c).load(deserializer, this.toReadPacket()) } -fun BytePacketBuilder.writeJceStruct(serializer: SerializationStrategy, struct: T, charset: JceCharset = JceCharset.GBK) { - this.writePacket(Jce.byCharSet(charset).dumpAsPacket(serializer, struct)) +fun BytePacketBuilder.writeJceStruct( + serializer: SerializationStrategy, + struct: T, + charset: JceCharset = JceCharset.GBK +) { + Jce.byCharSet(charset).dumpTo(serializer, struct, this) } fun ByteReadPacket.readJceStruct( @@ -40,7 +48,8 @@ fun ByteReadPacket.readJceStruct( charset: JceCharset = JceCharset.UTF8, length: Int = this.remaining.toInt() ): T { - return Jce.byCharSet(charset).load(serializer, this, length) + @OptIn(MiraiInternalAPI::class) + return Jce.byCharSet(charset).load(serializer, this.readPacketExact(length)) } /** @@ -82,7 +91,8 @@ fun ByteReadPacket.decodeUniRequestPacketAndDeserialize(name: String? = null }) } -fun T.toByteArray(serializer: SerializationStrategy, c: JceCharset = JceCharset.GBK): ByteArray = Jce.byCharSet(c).dump(serializer, this) +fun T.toByteArray(serializer: SerializationStrategy, c: JceCharset = JceCharset.GBK): ByteArray = + Jce.byCharSet(c).dump(serializer, this) fun BytePacketBuilder.writeProtoBuf(serializer: SerializationStrategy, v: T) { this.writeFully(v.toByteArray(serializer)) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt index b96d5ea8d..9a0545802 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt @@ -10,138 +10,138 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.data.Packet import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId @Serializable internal class BigDataChannel( - @ProtoId(0) val vBigdataIplists: List, - @ProtoId(1) val sBigdataSigSession: ByteArray? = null, - @ProtoId(2) val sBigdataKeySession: ByteArray? = null, - @ProtoId(3) val uSigUin: Long? = null, - @ProtoId(4) val iConnectFlag: Int? = 1, - @ProtoId(5) val vBigdataPbBuf: ByteArray? = null + @JceId(0) val vBigdataIplists: List, + @JceId(1) val sBigdataSigSession: ByteArray? = null, + @JceId(2) val sBigdataKeySession: ByteArray? = null, + @JceId(3) val uSigUin: Long? = null, + @JceId(4) val iConnectFlag: Int? = 1, + @JceId(5) val vBigdataPbBuf: ByteArray? = null ) : JceStruct @Serializable internal class BigDataIpInfo( - @ProtoId(0) val uType: Long, - @ProtoId(1) val sIp: String = "", - @ProtoId(2) val uPort: Long + @JceId(0) val uType: Long, + @JceId(1) val sIp: String = "", + @JceId(2) val uPort: Long ) : JceStruct @Serializable internal class BigDataIpList( - @ProtoId(0) val uServiceType: Long, - @ProtoId(1) val vIplist: List, - @ProtoId(2) val netSegConfs: List? = null, - @ProtoId(3) val ufragmentSize: Long? = null + @JceId(0) val uServiceType: Long, + @JceId(1) val vIplist: List, + @JceId(2) val netSegConfs: List? = null, + @JceId(3) val ufragmentSize: Long? = null ) : JceStruct @Serializable internal class ClientLogConfig( - @ProtoId(1) val type: Int, - @ProtoId(2) val timeStart: TimeStamp? = null, - @ProtoId(3) val timeFinish: TimeStamp? = null, - @ProtoId(4) val loglevel: Byte? = null, - @ProtoId(5) val cookie: Int? = null, - @ProtoId(6) val lseq: Long? = null + @JceId(1) val type: Int, + @JceId(2) val timeStart: TimeStamp? = null, + @JceId(3) val timeFinish: TimeStamp? = null, + @JceId(4) val loglevel: Byte? = null, + @JceId(5) val cookie: Int? = null, + @JceId(6) val lseq: Long? = null ) : JceStruct @Serializable internal class DomainIpChannel( - @ProtoId(0) val vDomainIplists: List + @JceId(0) val vDomainIplists: List ) : JceStruct @Serializable internal class DomainIpInfo( - @ProtoId(1) val uIp: Int, - @ProtoId(2) val uPort: Int + @JceId(1) val uIp: Int, + @JceId(2) val uPort: Int ) : JceStruct @Serializable internal class DomainIpList( - @ProtoId(0) val uDomainType: Int, - @ProtoId(1) val vIplist: List + @JceId(0) val uDomainType: Int, + @JceId(1) val vIplist: List ) : JceStruct @Serializable internal class FileStoragePushFSSvcList( - @ProtoId(0) val vUpLoadList: List, - @ProtoId(1) val vPicDownLoadList: List, - @ProtoId(2) val vGPicDownLoadList: List? = null, - @ProtoId(3) val vQzoneProxyServiceList: List? = null, - @ProtoId(4) val vUrlEncodeServiceList: List? = null, - @ProtoId(5) val bigDataChannel: BigDataChannel? = null, - @ProtoId(6) val vVipEmotionList: List? = null, - @ProtoId(7) val vC2CPicDownList: List? = null, - @ProtoId(8) val fmtIPInfo: FmtIPInfo? = null, - @ProtoId(9) val domainIpChannel: DomainIpChannel? = null, - @ProtoId(10) val pttlist: ByteArray? = null + @JceId(0) val vUpLoadList: List, + @JceId(1) val vPicDownLoadList: List, + @JceId(2) val vGPicDownLoadList: List? = null, + @JceId(3) val vQzoneProxyServiceList: List? = null, + @JceId(4) val vUrlEncodeServiceList: List? = null, + @JceId(5) val bigDataChannel: BigDataChannel? = null, + @JceId(6) val vVipEmotionList: List? = null, + @JceId(7) val vC2CPicDownList: List? = null, + @JceId(8) val fmtIPInfo: FmtIPInfo? = null, + @JceId(9) val domainIpChannel: DomainIpChannel? = null, + @JceId(10) val pttlist: ByteArray? = null ) : JceStruct @Serializable internal class FileStorageServerListInfo( - @ProtoId(1) val sIP: String = "", - @ProtoId(2) val iPort: Int + @JceId(1) val sIP: String = "", + @JceId(2) val iPort: Int ) : JceStruct @Serializable internal class FmtIPInfo( - @ProtoId(0) val sGateIp: String = "", - @ProtoId(1) val iGateIpOper: Long + @JceId(0) val sGateIp: String = "", + @JceId(1) val iGateIpOper: Long ) : JceStruct @Serializable internal class NetSegConf( - @ProtoId(0) val uint32NetType: Long? = null, - @ProtoId(1) val uint32Segsize: Long? = null, - @ProtoId(2) val uint32Segnum: Long? = null, - @ProtoId(3) val uint32Curconnnum: Long? = null + @JceId(0) val uint32NetType: Long? = null, + @JceId(1) val uint32Segsize: Long? = null, + @JceId(2) val uint32Segnum: Long? = null, + @JceId(3) val uint32Curconnnum: Long? = null ) : JceStruct @Suppress("ArrayInDataClass") @Serializable internal data class PushReq( - @ProtoId(1) val type: Int, - @ProtoId(2) val jcebuf: ByteArray, - @ProtoId(3) val seq: Long + @JceId(1) val type: Int, + @JceId(2) val jcebuf: ByteArray, + @JceId(3) val seq: Long ) : JceStruct, Packet @Serializable internal class PushResp( - @ProtoId(1) val type: Int, - @ProtoId(2) val seq: Long, - @ProtoId(3) val jcebuf: ByteArray? = null + @JceId(1) val type: Int, + @JceId(2) val seq: Long, + @JceId(3) val jcebuf: ByteArray? = null ) : JceStruct @Serializable internal class SsoServerList( - @ProtoId(1) val v2G3GList: List, - @ProtoId(3) val vWifiList: List, - @ProtoId(4) val iReconnect: Int, - @ProtoId(5) val testSpeed: Byte? = null, - @ProtoId(6) val useNewList: Byte? = null, - @ProtoId(7) val iMultiConn: Int? = 1, - @ProtoId(8) val vHttp2g3glist: List? = null, - @ProtoId(9) val vHttpWifilist: List? = null + @JceId(1) val v2G3GList: List, + @JceId(3) val vWifiList: List, + @JceId(4) val iReconnect: Int, + @JceId(5) val testSpeed: Byte? = null, + @JceId(6) val useNewList: Byte? = null, + @JceId(7) val iMultiConn: Int? = 1, + @JceId(8) val vHttp2g3glist: List? = null, + @JceId(9) val vHttpWifilist: List? = null ) : JceStruct @Serializable internal class SsoServerListInfo( - @ProtoId(1) val sIP: String = "", - @ProtoId(2) val iPort: Int, - @ProtoId(3) val linkType: Byte, - @ProtoId(4) val proxy: Byte, - @ProtoId(5) val protocolType: Byte? = null, - @ProtoId(6) val iTimeOut: Int? = 10 + @JceId(1) val sIP: String = "", + @JceId(2) val iPort: Int, + @JceId(3) val linkType: Byte, + @JceId(4) val proxy: Byte, + @JceId(5) val protocolType: Byte? = null, + @JceId(6) val iTimeOut: Int? = 10 ) : JceStruct @Serializable internal class TimeStamp( - @ProtoId(1) val year: Int, - @ProtoId(2) val month: Byte, - @ProtoId(3) val day: Byte, - @ProtoId(4) val hour: Byte + @JceId(1) val year: Int, + @JceId(2) val month: Byte, + @JceId(3) val day: Byte, + @JceId(4) val hour: Byte ) : JceStruct diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendList.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendList.kt index cdd65a123..bb079399e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendList.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendList.kt @@ -10,171 +10,171 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId @Serializable internal class ModifyGroupCardReq( - @ProtoId(0) val dwZero: Long, - @ProtoId(1) val dwGroupCode: Long, - @ProtoId(2) val dwNewSeq: Long, - @ProtoId(3) val vecUinInfo: List + @JceId(0) val dwZero: Long, + @JceId(1) val dwGroupCode: Long, + @JceId(2) val dwNewSeq: Long, + @JceId(3) val vecUinInfo: List ) : JceStruct @Serializable internal class stUinInfo( - @ProtoId(0) val dwuin: Long, - @ProtoId(1) val dwFlag: Long, - @ProtoId(2) val sName: String = "", - @ProtoId(3) val gender: Byte, - @ProtoId(4) val sPhone: String = "", - @ProtoId(5) val sEmail: String = "", - @ProtoId(6) val sRemark: String = "" + @JceId(0) val dwuin: Long, + @JceId(1) val dwFlag: Long, + @JceId(2) val sName: String = "", + @JceId(3) val gender: Byte, + @JceId(4) val sPhone: String = "", + @JceId(5) val sEmail: String = "", + @JceId(6) val sRemark: String = "" ) : JceStruct @Serializable internal class GetFriendListReq( - @ProtoId(0) val reqtype: Int? = null, - @ProtoId(1) val ifReflush: Byte? = null, - @ProtoId(2) val uin: Long? = null, - @ProtoId(3) val startIndex: Short? = null, - @ProtoId(4) val getfriendCount: Short? = null, - @ProtoId(5) val groupid: Byte? = null, - @ProtoId(6) val ifGetGroupInfo: Byte? = null, - @ProtoId(7) val groupstartIndex: Byte? = null, - @ProtoId(8) val getgroupCount: Byte? = null, - @ProtoId(9) val ifGetMSFGroup: Byte? = null, - @ProtoId(10) val ifShowTermType: Byte? = null, - @ProtoId(11) val version: Long? = null, - @ProtoId(12) val uinList: List? = null, - @ProtoId(13) val eAppType: Int = 0, - @ProtoId(14) val ifGetDOVId: Byte? = null, - @ProtoId(15) val ifGetBothFlag: Byte? = null, - @ProtoId(16) val vec0xd50Req: ByteArray? = null, - @ProtoId(17) val vec0xd6bReq: ByteArray? = null, - @ProtoId(18) val vecSnsTypelist: List? = null + @JceId(0) val reqtype: Int? = null, + @JceId(1) val ifReflush: Byte? = null, + @JceId(2) val uin: Long? = null, + @JceId(3) val startIndex: Short? = null, + @JceId(4) val getfriendCount: Short? = null, + @JceId(5) val groupid: Byte? = null, + @JceId(6) val ifGetGroupInfo: Byte? = null, + @JceId(7) val groupstartIndex: Byte? = null, + @JceId(8) val getgroupCount: Byte? = null, + @JceId(9) val ifGetMSFGroup: Byte? = null, + @JceId(10) val ifShowTermType: Byte? = null, + @JceId(11) val version: Long? = null, + @JceId(12) val uinList: List? = null, + @JceId(13) val eAppType: Int = 0, + @JceId(14) val ifGetDOVId: Byte? = null, + @JceId(15) val ifGetBothFlag: Byte? = null, + @JceId(16) val vec0xd50Req: ByteArray? = null, + @JceId(17) val vec0xd6bReq: ByteArray? = null, + @JceId(18) val vecSnsTypelist: List? = null ) : JceStruct @Serializable internal class GetFriendListResp( - @ProtoId(0) val reqtype: Int, - @ProtoId(1) val ifReflush: Byte, - @ProtoId(2) val uin: Long, - @ProtoId(3) val startIndex: Short, - @ProtoId(4) val getfriendCount: Short, - @ProtoId(5) val totoalFriendCount: Short, - @ProtoId(6) val friendCount: Short, - @ProtoId(7) val vecFriendInfo: List? = null, - @ProtoId(8) val groupid: Byte? = null, - @ProtoId(9) val ifGetGroupInfo: Byte, - @ProtoId(10) val groupstartIndex: Byte? = null, - @ProtoId(11) val getgroupCount: Byte? = null, - @ProtoId(12) val totoalGroupCount: Short? = null, - @ProtoId(13) val groupCount: Byte? = null, - @ProtoId(14) val vecGroupInfo: List? = null, - @ProtoId(15) val result: Int, - @ProtoId(16) val errorCode: Short? = null, - @ProtoId(17) val onlineFriendCount: Short? = null, - @ProtoId(18) val serverTime: Long? = null, - @ProtoId(19) val sqqOnLineCount: Short? = null, - @ProtoId(20) val vecMSFGroupInfo: List? = null, - @ProtoId(21) val respType: Byte? = null, - @ProtoId(22) val hasOtherRespFlag: Byte? = null, - @ProtoId(23) val stSelfInfo: FriendInfo? = null, - @ProtoId(24) val showPcIcon: Byte? = null, - @ProtoId(25) val wGetExtSnsRspCode: Short? = null, - @ProtoId(26) val stSubSrvRspCode: FriendListSubSrvRspCode? = null + @JceId(0) val reqtype: Int, + @JceId(1) val ifReflush: Byte, + @JceId(2) val uin: Long, + @JceId(3) val startIndex: Short, + @JceId(4) val getfriendCount: Short, + @JceId(5) val totoalFriendCount: Short, + @JceId(6) val friendCount: Short, + @JceId(7) val vecFriendInfo: List? = null, + @JceId(8) val groupid: Byte? = null, + @JceId(9) val ifGetGroupInfo: Byte, + @JceId(10) val groupstartIndex: Byte? = null, + @JceId(11) val getgroupCount: Byte? = null, + @JceId(12) val totoalGroupCount: Short? = null, + @JceId(13) val groupCount: Byte? = null, + @JceId(14) val vecGroupInfo: List? = null, + @JceId(15) val result: Int, + @JceId(16) val errorCode: Short? = null, + @JceId(17) val onlineFriendCount: Short? = null, + @JceId(18) val serverTime: Long? = null, + @JceId(19) val sqqOnLineCount: Short? = null, + @JceId(20) val vecMSFGroupInfo: List? = null, + @JceId(21) val respType: Byte? = null, + @JceId(22) val hasOtherRespFlag: Byte? = null, + @JceId(23) val stSelfInfo: FriendInfo? = null, + @JceId(24) val showPcIcon: Byte? = null, + @JceId(25) val wGetExtSnsRspCode: Short? = null, + @JceId(26) val stSubSrvRspCode: FriendListSubSrvRspCode? = null ) : JceStruct @Serializable internal class FriendListSubSrvRspCode( - @ProtoId(0) val wGetMutualMarkRspCode: Short? = null, - @ProtoId(1) val wGetIntimateInfoRspCode: Short? = null + @JceId(0) val wGetMutualMarkRspCode: Short? = null, + @JceId(1) val wGetIntimateInfoRspCode: Short? = null ) : JceStruct @Serializable internal class FriendInfo( - @ProtoId(0) val friendUin: Long, - @ProtoId(1) val groupId: Byte, - @ProtoId(2) val faceId: Short, - @ProtoId(3) val remark: String = "", - @ProtoId(4) val sqqtype: Byte, - @ProtoId(5) val status: Byte = 20, - @ProtoId(6) val memberLevel: Byte? = null, - @ProtoId(7) val isMqqOnLine: Byte? = null, - @ProtoId(8) val sqqOnLineState: Byte? = null, - @ProtoId(9) val isIphoneOnline: Byte? = null, - @ProtoId(10) val detalStatusFlag: Byte? = null, - @ProtoId(11) val sqqOnLineStateV2: Byte? = null, - @ProtoId(12) val sShowName: String? = "", - @ProtoId(13) val isRemark: Byte? = null, - @ProtoId(14) val nick: String? = "", - @ProtoId(15) val specialFlag: Byte? = null, - @ProtoId(16) val vecIMGroupID: ByteArray? = null, - @ProtoId(17) val vecMSFGroupID: ByteArray? = null, - @ProtoId(18) val iTermType: Int? = null, - @ProtoId(19) val oVipInfo: VipBaseInfo? = null, - @ProtoId(20) val network: Byte? = null, - @ProtoId(21) val vecRing: ByteArray? = null, - @ProtoId(22) val uAbiFlag: Long? = null, - @ProtoId(23) val ulFaceAddonId: Long? = null, - @ProtoId(24) val eNetworkType: Int? = 0, - @ProtoId(25) val uVipFont: Long? = null, - @ProtoId(26) val eIconType: Int? = 0, - @ProtoId(27) val termDesc: String? = "", - @ProtoId(28) val uColorRing: Long? = null, - @ProtoId(29) val apolloFlag: Byte? = null, - @ProtoId(30) val uApolloTimestamp: Long? = null, - @ProtoId(31) val sex: Byte? = null, - @ProtoId(32) val uFounderFont: Long? = null, - @ProtoId(33) val eimId: String? = "", - @ProtoId(34) val eimMobile: String? = "", - @ProtoId(35) val olympicTorch: Byte? = null, - @ProtoId(36) val uApolloSignTime: Long? = null, - @ProtoId(37) val uLaviUin: Long? = null, - @ProtoId(38) val uTagUpdateTime: Long? = null, - @ProtoId(39) val uGameLastLoginTime: Long? = null, - @ProtoId(40) val uGameAppid: Long? = null, - @ProtoId(41) val vecCardID: ByteArray? = null, - @ProtoId(42) val ulBitSet: Long? = null, - @ProtoId(43) val kingOfGloryFlag: Byte? = null, - @ProtoId(44) val ulKingOfGloryRank: Long? = null, - @ProtoId(45) val masterUin: String? = "", - @ProtoId(46) val uLastMedalUpdateTime: Long? = null, - @ProtoId(47) val uFaceStoreId: Long? = null, - @ProtoId(48) val uFontEffect: Long? = null, - @ProtoId(49) val sDOVId: String? = "", - @ProtoId(50) val uBothFlag: Long? = null, - @ProtoId(51) val centiShow3DFlag: Byte? = null, - @ProtoId(52) val vecIntimateInfo: ByteArray? = null, - @ProtoId(53) val showNameplate: Byte? = null, - @ProtoId(54) val newLoverDiamondFlag: Byte? = null, - @ProtoId(55) val vecExtSnsFrdData: ByteArray? = null, - @ProtoId(56) val vecMutualMarkData: ByteArray? = null + @JceId(0) val friendUin: Long, + @JceId(1) val groupId: Byte, + @JceId(2) val faceId: Short, + @JceId(3) val remark: String = "", + @JceId(4) val sqqtype: Byte, + @JceId(5) val status: Byte = 20, + @JceId(6) val memberLevel: Byte? = null, + @JceId(7) val isMqqOnLine: Byte? = null, + @JceId(8) val sqqOnLineState: Byte? = null, + @JceId(9) val isIphoneOnline: Byte? = null, + @JceId(10) val detalStatusFlag: Byte? = null, + @JceId(11) val sqqOnLineStateV2: Byte? = null, + @JceId(12) val sShowName: String? = "", + @JceId(13) val isRemark: Byte? = null, + @JceId(14) val nick: String? = "", + @JceId(15) val specialFlag: Byte? = null, + @JceId(16) val vecIMGroupID: ByteArray? = null, + @JceId(17) val vecMSFGroupID: ByteArray? = null, + @JceId(18) val iTermType: Int? = null, + @JceId(19) val oVipInfo: VipBaseInfo? = null, + @JceId(20) val network: Byte? = null, + @JceId(21) val vecRing: ByteArray? = null, + @JceId(22) val uAbiFlag: Long? = null, + @JceId(23) val ulFaceAddonId: Long? = null, + @JceId(24) val eNetworkType: Int? = 0, + @JceId(25) val uVipFont: Long? = null, + @JceId(26) val eIconType: Int? = 0, + @JceId(27) val termDesc: String? = "", + @JceId(28) val uColorRing: Long? = null, + @JceId(29) val apolloFlag: Byte? = null, + @JceId(30) val uApolloTimestamp: Long? = null, + @JceId(31) val sex: Byte? = null, + @JceId(32) val uFounderFont: Long? = null, + @JceId(33) val eimId: String? = "", + @JceId(34) val eimMobile: String? = "", + @JceId(35) val olympicTorch: Byte? = null, + @JceId(36) val uApolloSignTime: Long? = null, + @JceId(37) val uLaviUin: Long? = null, + @JceId(38) val uTagUpdateTime: Long? = null, + @JceId(39) val uGameLastLoginTime: Long? = null, + @JceId(40) val uGameAppid: Long? = null, + @JceId(41) val vecCardID: ByteArray? = null, + @JceId(42) val ulBitSet: Long? = null, + @JceId(43) val kingOfGloryFlag: Byte? = null, + @JceId(44) val ulKingOfGloryRank: Long? = null, + @JceId(45) val masterUin: String? = "", + @JceId(46) val uLastMedalUpdateTime: Long? = null, + @JceId(47) val uFaceStoreId: Long? = null, + @JceId(48) val uFontEffect: Long? = null, + @JceId(49) val sDOVId: String? = "", + @JceId(50) val uBothFlag: Long? = null, + @JceId(51) val centiShow3DFlag: Byte? = null, + @JceId(52) val vecIntimateInfo: ByteArray? = null, + @JceId(53) val showNameplate: Byte? = null, + @JceId(54) val newLoverDiamondFlag: Byte? = null, + @JceId(55) val vecExtSnsFrdData: ByteArray? = null, + @JceId(56) val vecMutualMarkData: ByteArray? = null ) : JceStruct @Serializable internal class VipBaseInfo( - @ProtoId(0) val mOpenInfo: Map + @JceId(0) val mOpenInfo: Map ) : JceStruct @Serializable internal class VipOpenInfo( - @ProtoId(0) val open: Boolean, - @ProtoId(1) val iVipType: Int = -1, - @ProtoId(2) val iVipLevel: Int = -1, - @ProtoId(3) val iVipFlag: Int? = null, - @ProtoId(4) val nameplateId: Long? = null + @JceId(0) val open: Boolean, + @JceId(1) val iVipType: Int = -1, + @JceId(2) val iVipLevel: Int = -1, + @JceId(3) val iVipFlag: Int? = null, + @JceId(4) val nameplateId: Long? = null ) : JceStruct @Serializable internal class GroupInfo( - @ProtoId(0) val groupId: Byte, - @ProtoId(1) val groupname: String = "", - @ProtoId(2) val friendCount: Int, - @ProtoId(3) val onlineFriendCount: Int, - @ProtoId(4) val seqid: Byte? = null, - @ProtoId(5) val sqqOnLineCount: Int? = null + @JceId(0) val groupId: Byte, + @JceId(1) val groupname: String = "", + @JceId(2) val friendCount: Int, + @JceId(3) val onlineFriendCount: Int, + @JceId(4) val seqid: Byte? = null, + @JceId(5) val sqqOnLineCount: Int? = null ) : JceStruct diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/OnlinePushPack.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/OnlinePushPack.kt index 7bb9cfd16..185390db0 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/OnlinePushPack.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/OnlinePushPack.kt @@ -10,249 +10,249 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId internal class OnlinePushPack { @Serializable internal class DelMsgInfo( - @ProtoId(0) val fromUin: Long, - @ProtoId(1) val uMsgTime: Long, - @ProtoId(2) val shMsgSeq: Short, - @ProtoId(3) val vMsgCookies: ByteArray? = null, - @ProtoId(4) val wCmd: Short? = null, - @ProtoId(5) val uMsgType: Long? = null, - @ProtoId(6) val uAppId: Long? = null, - @ProtoId(7) val sendTime: Long? = null, - @ProtoId(8) val ssoSeq: Int? = null, - @ProtoId(9) val ssoIp: Int? = null, - @ProtoId(10) val clientIp: Int? = null + @JceId(0) val fromUin: Long, + @JceId(1) val uMsgTime: Long, + @JceId(2) val shMsgSeq: Short, + @JceId(3) val vMsgCookies: ByteArray? = null, + @JceId(4) val wCmd: Short? = null, + @JceId(5) val uMsgType: Long? = null, + @JceId(6) val uAppId: Long? = null, + @JceId(7) val sendTime: Long? = null, + @JceId(8) val ssoSeq: Int? = null, + @JceId(9) val ssoIp: Int? = null, + @JceId(10) val clientIp: Int? = null ) : JceStruct @Serializable internal class DeviceInfo( - @ProtoId(0) val netType: Byte? = null, - @ProtoId(1) val devType: String? = "", - @ProtoId(2) val oSVer: String? = "", - @ProtoId(3) val vendorName: String? = "", - @ProtoId(4) val vendorOSName: String? = "", - @ProtoId(5) val iOSIdfa: String? = "" + @JceId(0) val netType: Byte? = null, + @JceId(1) val devType: String? = "", + @JceId(2) val oSVer: String? = "", + @JceId(3) val vendorName: String? = "", + @JceId(4) val vendorOSName: String? = "", + @JceId(5) val iOSIdfa: String? = "" ) : JceStruct @Serializable internal class Name( - @ProtoId(0) val fromUin: Long, - @ProtoId(1) val uMsgTime: Long, - @ProtoId(2) val shMsgType: Short, - @ProtoId(3) val shMsgSeq: Short, - @ProtoId(4) val msg: String = "", - @ProtoId(5) val uRealMsgTime: Int? = null, - @ProtoId(6) val vMsg: ByteArray? = null, - @ProtoId(7) val uAppShareID: Long? = null, - @ProtoId(8) val vMsgCookies: ByteArray? = null, - @ProtoId(9) val vAppShareCookie: ByteArray? = null, - @ProtoId(10) val msgUid: Long? = null, - @ProtoId(11) val lastChangeTime: Long? = 1L, - @ProtoId(12) val vCPicInfo: List? = null, - @ProtoId(13) val stShareData: ShareData? = null, - @ProtoId(14) val fromInstId: Long? = null, - @ProtoId(15) val vRemarkOfSender: ByteArray? = null, - @ProtoId(16) val fromMobile: String? = "", - @ProtoId(17) val fromName: String? = "", - @ProtoId(18) val vNickName: List? = null, - @ProtoId(19) val stC2CTmpMsgHead: TempMsgHead? = null + @JceId(0) val fromUin: Long, + @JceId(1) val uMsgTime: Long, + @JceId(2) val shMsgType: Short, + @JceId(3) val shMsgSeq: Short, + @JceId(4) val msg: String = "", + @JceId(5) val uRealMsgTime: Int? = null, + @JceId(6) val vMsg: ByteArray? = null, + @JceId(7) val uAppShareID: Long? = null, + @JceId(8) val vMsgCookies: ByteArray? = null, + @JceId(9) val vAppShareCookie: ByteArray? = null, + @JceId(10) val msgUid: Long? = null, + @JceId(11) val lastChangeTime: Long? = 1L, + @JceId(12) val vCPicInfo: List? = null, + @JceId(13) val stShareData: ShareData? = null, + @JceId(14) val fromInstId: Long? = null, + @JceId(15) val vRemarkOfSender: ByteArray? = null, + @JceId(16) val fromMobile: String? = "", + @JceId(17) val fromName: String? = "", + @JceId(18) val vNickName: List? = null, + @JceId(19) val stC2CTmpMsgHead: TempMsgHead? = null ) : JceStruct @Serializable internal class SvcReqPushMsg( - @ProtoId(0) val uin: Long, - @ProtoId(1) val uMsgTime: Long, - @ProtoId(2) val vMsgInfos: List, - @ProtoId(3) val svrip: Int? = 0, - @ProtoId(4) val vSyncCookie: ByteArray? = null, - @ProtoId(5) val vUinPairMsg: List? = null, - @ProtoId(6) val mPreviews: Map? = null + @JceId(0) val uin: Long, + @JceId(1) val uMsgTime: Long, + @JceId(2) val vMsgInfos: List, + @JceId(3) val svrip: Int? = 0, + @JceId(4) val vSyncCookie: ByteArray? = null, + @JceId(5) val vUinPairMsg: List? = null, + @JceId(6) val mPreviews: Map? = null // @SerialId(7) val wUserActive: Int? = null, //@SerialId(12) val wGeneralFlag: Int? = null ) : JceStruct @Serializable internal class SvcRespPushMsg( - @ProtoId(0) val uin: Long, - @ProtoId(1) val vDelInfos: List, - @ProtoId(2) val svrip: Int, - @ProtoId(3) val pushToken: ByteArray? = null, - @ProtoId(4) val serviceType: Int? = null, - @ProtoId(5) val deviceInfo: DeviceInfo? = null + @JceId(0) val uin: Long, + @JceId(1) val vDelInfos: List, + @JceId(2) val svrip: Int, + @JceId(3) val pushToken: ByteArray? = null, + @JceId(4) val serviceType: Int? = null, + @JceId(5) val deviceInfo: DeviceInfo? = null ) : JceStruct @Serializable internal class UinPairMsg( - @ProtoId(1) val uLastReadTime: Long? = null, - @ProtoId(2) val peerUin: Long? = null, - @ProtoId(3) val uMsgCompleted: Long? = null, - @ProtoId(4) val vMsgInfos: List? = null + @JceId(1) val uLastReadTime: Long? = null, + @JceId(2) val peerUin: Long? = null, + @JceId(3) val uMsgCompleted: Long? = null, + @JceId(4) val vMsgInfos: List? = null ) : JceStruct @Serializable internal class MsgType0x210( - @ProtoId(0) val uSubMsgType: Long, - @ProtoId(1) val stMsgInfo0x2: MsgType0x210SubMsgType0x2? = null, - @ProtoId(3) val stMsgInfo0xa: MsgType0x210SubMsgType0xa? = null, - @ProtoId(4) val stMsgInfo0xe: MsgType0x210SubMsgType0xe? = null, - @ProtoId(5) val stMsgInfo0x13: MsgType0x210SubMsgType0x13? = null, - @ProtoId(6) val stMsgInfo0x17: MsgType0x210SubMsgType0x17? = null, - @ProtoId(7) val stMsgInfo0x20: MsgType0x210SubMsgType0x20? = null, - @ProtoId(8) val stMsgInfo0x1d: MsgType0x210SubMsgType0x1d? = null, - @ProtoId(9) val stMsgInfo0x24: MsgType0x210SubMsgType0x24? = null, - @ProtoId(10) val vProtobuf: ByteArray? = null + @JceId(0) val uSubMsgType: Long, + @JceId(1) val stMsgInfo0x2: MsgType0x210SubMsgType0x2? = null, + @JceId(3) val stMsgInfo0xa: MsgType0x210SubMsgType0xa? = null, + @JceId(4) val stMsgInfo0xe: MsgType0x210SubMsgType0xe? = null, + @JceId(5) val stMsgInfo0x13: MsgType0x210SubMsgType0x13? = null, + @JceId(6) val stMsgInfo0x17: MsgType0x210SubMsgType0x17? = null, + @JceId(7) val stMsgInfo0x20: MsgType0x210SubMsgType0x20? = null, + @JceId(8) val stMsgInfo0x1d: MsgType0x210SubMsgType0x1d? = null, + @JceId(9) val stMsgInfo0x24: MsgType0x210SubMsgType0x24? = null, + @JceId(10) val vProtobuf: ByteArray? = null ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0x13( - @ProtoId(0) val uint32SrcAppId: Long? = null, - @ProtoId(1) val uint32SrcInstId: Long? = null, - @ProtoId(2) val uint32DstAppId: Long? = null, - @ProtoId(3) val uint32DstInstId: Long? = null, - @ProtoId(4) val uint64DstUin: Long? = null, - @ProtoId(5) val uint64Sessionid: Long? = null, - @ProtoId(6) val uint32Size: Long? = null, - @ProtoId(7) val uint32Index: Long? = null, - @ProtoId(8) val uint32Type: Long? = null, - @ProtoId(9) val buf: ByteArray? = null + @JceId(0) val uint32SrcAppId: Long? = null, + @JceId(1) val uint32SrcInstId: Long? = null, + @JceId(2) val uint32DstAppId: Long? = null, + @JceId(3) val uint32DstInstId: Long? = null, + @JceId(4) val uint64DstUin: Long? = null, + @JceId(5) val uint64Sessionid: Long? = null, + @JceId(6) val uint32Size: Long? = null, + @JceId(7) val uint32Index: Long? = null, + @JceId(8) val uint32Type: Long? = null, + @JceId(9) val buf: ByteArray? = null ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0x17( - @ProtoId(0) val dwOpType: Long? = null, - @ProtoId(1) val stAddGroup: AddGroup? = null, - @ProtoId(2) val stDelGroup: DelGroup? = null, - @ProtoId(3) val stModGroupName: ModGroupName? = null, - @ProtoId(4) val stModGroupSort: ModGroupSort? = null, - @ProtoId(5) val stModFriendGroup: ModFriendGroup? = null + @JceId(0) val dwOpType: Long? = null, + @JceId(1) val stAddGroup: AddGroup? = null, + @JceId(2) val stDelGroup: DelGroup? = null, + @JceId(3) val stModGroupName: ModGroupName? = null, + @JceId(4) val stModGroupSort: ModGroupSort? = null, + @JceId(5) val stModFriendGroup: ModFriendGroup? = null ) : JceStruct @Serializable internal class AddGroup( - @ProtoId(0) val dwGroupID: Long? = null, - @ProtoId(1) val dwSortID: Long? = null, - @ProtoId(2) val groupName: String? = "" + @JceId(0) val dwGroupID: Long? = null, + @JceId(1) val dwSortID: Long? = null, + @JceId(2) val groupName: String? = "" ) : JceStruct @Serializable internal class DelGroup( - @ProtoId(0) val dwGroupID: Long? = null + @JceId(0) val dwGroupID: Long? = null ) : JceStruct @Serializable internal class ModFriendGroup( - @ProtoId(0) val vMsgFrdGroup: List? = null + @JceId(0) val vMsgFrdGroup: List? = null ) : JceStruct @Serializable internal class FriendGroup( - @ProtoId(0) val dwFuin: Long? = null, - @ProtoId(1) val vOldGroupID: List? = null, - @ProtoId(2) val vNewGroupID: List? = null + @JceId(0) val dwFuin: Long? = null, + @JceId(1) val vOldGroupID: List? = null, + @JceId(2) val vNewGroupID: List? = null ) : JceStruct @Serializable internal class ModGroupName( - @ProtoId(0) val dwGroupID: Long? = null, - @ProtoId(1) val groupName: String? = "" + @JceId(0) val dwGroupID: Long? = null, + @JceId(1) val groupName: String? = "" ) : JceStruct @Serializable internal class ModGroupSort( - @ProtoId(0) val vMsgGroupSort: List? = null + @JceId(0) val vMsgGroupSort: List? = null ) : JceStruct @Serializable internal class GroupSort( - @ProtoId(0) val dwGroupID: Long? = null, - @ProtoId(1) val dwSortID: Long? = null + @JceId(0) val dwGroupID: Long? = null, + @JceId(1) val dwSortID: Long? = null ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0x1d( - @ProtoId(0) val dwOpType: Long? = null, - @ProtoId(1) val dwUin: Long? = null, - @ProtoId(2) val dwID: Long? = null, - @ProtoId(3) val value: String? = "" + @JceId(0) val dwOpType: Long? = null, + @JceId(1) val dwUin: Long? = null, + @JceId(2) val dwID: Long? = null, + @JceId(3) val value: String? = "" ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0x2( - @ProtoId(0) val uSrcAppId: Long? = null, - @ProtoId(1) val uSrcInstId: Long? = null, - @ProtoId(2) val uDstAppId: Long? = null, - @ProtoId(3) val uDstInstId: Long? = null, - @ProtoId(4) val uDstUin: Long? = null, - @ProtoId(5) val fileName: ByteArray? = null, - @ProtoId(6) val fileIndex: ByteArray? = null, - @ProtoId(7) val fileMd5: ByteArray? = null, - @ProtoId(8) val fileKey: ByteArray? = null, - @ProtoId(9) val uServerIp: Long? = null, - @ProtoId(10) val uServerPort: Long? = null, - @ProtoId(11) val fileLen: Long? = null, - @ProtoId(12) val sessionId: Long? = null, - @ProtoId(13) val originfileMd5: ByteArray? = null, - @ProtoId(14) val uOriginfiletype: Long? = null, - @ProtoId(15) val uSeq: Long? = null + @JceId(0) val uSrcAppId: Long? = null, + @JceId(1) val uSrcInstId: Long? = null, + @JceId(2) val uDstAppId: Long? = null, + @JceId(3) val uDstInstId: Long? = null, + @JceId(4) val uDstUin: Long? = null, + @JceId(5) val fileName: ByteArray? = null, + @JceId(6) val fileIndex: ByteArray? = null, + @JceId(7) val fileMd5: ByteArray? = null, + @JceId(8) val fileKey: ByteArray? = null, + @JceId(9) val uServerIp: Long? = null, + @JceId(10) val uServerPort: Long? = null, + @JceId(11) val fileLen: Long? = null, + @JceId(12) val sessionId: Long? = null, + @JceId(13) val originfileMd5: ByteArray? = null, + @JceId(14) val uOriginfiletype: Long? = null, + @JceId(15) val uSeq: Long? = null ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0x20( - @ProtoId(0) val dwOpType: Long? = null, - @ProtoId(1) val dwType: Long? = null, - @ProtoId(2) val dwUin: Long? = null, - @ProtoId(3) val remaek: String? = "" + @JceId(0) val dwOpType: Long? = null, + @JceId(1) val dwType: Long? = null, + @JceId(2) val dwUin: Long? = null, + @JceId(3) val remaek: String? = "" ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0x24( - @ProtoId(0) val vPluginNumList: List? = null + @JceId(0) val vPluginNumList: List? = null ) : JceStruct @Serializable internal class PluginNum( - @ProtoId(0) val dwID: Long? = null, - @ProtoId(1) val dwNUm: Long? = null, - @ProtoId(2) val flag: Byte? = null + @JceId(0) val dwID: Long? = null, + @JceId(1) val dwNUm: Long? = null, + @JceId(2) val flag: Byte? = null ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0xa( - @ProtoId(0) val uSrcAppId: Long? = null, - @ProtoId(1) val uSrcInstId: Long? = null, - @ProtoId(2) val uDstAppId: Long? = null, - @ProtoId(3) val uDstInstId: Long? = null, - @ProtoId(4) val uDstUin: Long? = null, - @ProtoId(5) val uType: Long? = null, - @ProtoId(6) val uServerIp: Long? = null, - @ProtoId(7) val uServerPort: Long? = null, - @ProtoId(8) val vUrlNotify: ByteArray? = null, - @ProtoId(9) val vTokenKey: ByteArray? = null, - @ProtoId(10) val uFileLen: Long? = null, - @ProtoId(11) val fileName: ByteArray? = null, - @ProtoId(12) val vMd5: ByteArray? = null, - @ProtoId(13) val sessionId: Long? = null, - @ProtoId(14) val originfileMd5: ByteArray? = null, - @ProtoId(15) val uOriginfiletype: Long? = null, - @ProtoId(16) val uSeq: Long? = null + @JceId(0) val uSrcAppId: Long? = null, + @JceId(1) val uSrcInstId: Long? = null, + @JceId(2) val uDstAppId: Long? = null, + @JceId(3) val uDstInstId: Long? = null, + @JceId(4) val uDstUin: Long? = null, + @JceId(5) val uType: Long? = null, + @JceId(6) val uServerIp: Long? = null, + @JceId(7) val uServerPort: Long? = null, + @JceId(8) val vUrlNotify: ByteArray? = null, + @JceId(9) val vTokenKey: ByteArray? = null, + @JceId(10) val uFileLen: Long? = null, + @JceId(11) val fileName: ByteArray? = null, + @JceId(12) val vMd5: ByteArray? = null, + @JceId(13) val sessionId: Long? = null, + @JceId(14) val originfileMd5: ByteArray? = null, + @JceId(15) val uOriginfiletype: Long? = null, + @JceId(16) val uSeq: Long? = null ) : JceStruct @Serializable internal class MsgType0x210SubMsgType0xe( - @ProtoId(0) val uint32SrcAppId: Long? = null, - @ProtoId(1) val uint32SrcInstId: Long? = null, - @ProtoId(2) val uint32DstAppId: Long? = null, - @ProtoId(3) val uint32DstInstId: Long? = null, - @ProtoId(4) val uint64DstUin: Long? = null, - @ProtoId(5) val uint64Sessionid: Long? = null, - @ProtoId(6) val uint32Operate: Long? = null, - @ProtoId(7) val uint32Seq: Long? = null, - @ProtoId(8) val uint32Code: Long? = null, - @ProtoId(9) val msg: String? = "" + @JceId(0) val uint32SrcAppId: Long? = null, + @JceId(1) val uint32SrcInstId: Long? = null, + @JceId(2) val uint32DstAppId: Long? = null, + @JceId(3) val uint32DstInstId: Long? = null, + @JceId(4) val uint64DstUin: Long? = null, + @JceId(5) val uint64Sessionid: Long? = null, + @JceId(6) val uint32Operate: Long? = null, + @JceId(7) val uint32Seq: Long? = null, + @JceId(8) val uint32Code: Long? = null, + @JceId(9) val msg: String? = "" ) : JceStruct } \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt index 295a3cc1b..f9550fec3 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt @@ -10,71 +10,71 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.data.Packet import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY @Suppress("ArrayInDataClass") @Serializable internal data class RequestPushNotify( - @ProtoId(0) val uin: Long? = 0L, - @ProtoId(1) val ctype: Byte = 0, - @ProtoId(2) val strService: String?, - @ProtoId(3) val strCmd: String?, - @ProtoId(4) val vNotifyCookie: ByteArray? = EMPTY_BYTE_ARRAY, - @ProtoId(5) val usMsgType: Int?, - @ProtoId(6) val wUserActive: Int?, - @ProtoId(7) val wGeneralFlag: Int?, - @ProtoId(8) val bindedUin: Long?, - @ProtoId(9) val stMsgInfo: MsgInfo?, - @ProtoId(10) val msgCtrlBuf: String?, - @ProtoId(11) val serverBuf: ByteArray?, - @ProtoId(12) val pingFlag: Long?, - @ProtoId(13) val svrip: Int? + @JceId(0) val uin: Long? = 0L, + @JceId(1) val ctype: Byte = 0, + @JceId(2) val strService: String?, + @JceId(3) val strCmd: String?, + @JceId(4) val vNotifyCookie: ByteArray? = EMPTY_BYTE_ARRAY, + @JceId(5) val usMsgType: Int?, + @JceId(6) val wUserActive: Int?, + @JceId(7) val wGeneralFlag: Int?, + @JceId(8) val bindedUin: Long?, + @JceId(9) val stMsgInfo: MsgInfo?, + @JceId(10) val msgCtrlBuf: String?, + @JceId(11) val serverBuf: ByteArray?, + @JceId(12) val pingFlag: Long?, + @JceId(13) val svrip: Int? ) : JceStruct, Packet @Serializable internal class MsgInfo( - @ProtoId(0) val lFromUin: Long? = 0L, - @ProtoId(1) val uMsgTime: Long? = 0L, - @ProtoId(2) val shMsgType: Short, - @ProtoId(3) val shMsgSeq: Short, - @ProtoId(4) val strMsg: String?, - @ProtoId(5) val uRealMsgTime: Int?, - @ProtoId(6) val vMsg: ByteArray?, - @ProtoId(7) val uAppShareID: Long?, - @ProtoId(8) val vMsgCookies: ByteArray? = EMPTY_BYTE_ARRAY, - @ProtoId(9) val vAppShareCookie: ByteArray? = EMPTY_BYTE_ARRAY, - @ProtoId(10) val lMsgUid: Long?, - @ProtoId(11) val lLastChangeTime: Long?, - @ProtoId(12) val vCPicInfo: List?, - @ProtoId(13) val stShareData: ShareData?, - @ProtoId(14) val lFromInstId: Long?, - @ProtoId(15) val vRemarkOfSender: ByteArray?, - @ProtoId(16) val strFromMobile: String?, - @ProtoId(17) val strFromName: String?, - @ProtoId(18) val vNickName: List?//, + @JceId(0) val lFromUin: Long? = 0L, + @JceId(1) val uMsgTime: Long? = 0L, + @JceId(2) val shMsgType: Short, + @JceId(3) val shMsgSeq: Short, + @JceId(4) val strMsg: String?, + @JceId(5) val uRealMsgTime: Int?, + @JceId(6) val vMsg: ByteArray?, + @JceId(7) val uAppShareID: Long?, + @JceId(8) val vMsgCookies: ByteArray? = EMPTY_BYTE_ARRAY, + @JceId(9) val vAppShareCookie: ByteArray? = EMPTY_BYTE_ARRAY, + @JceId(10) val lMsgUid: Long?, + @JceId(11) val lLastChangeTime: Long?, + @JceId(12) val vCPicInfo: List?, + @JceId(13) val stShareData: ShareData?, + @JceId(14) val lFromInstId: Long?, + @JceId(15) val vRemarkOfSender: ByteArray?, + @JceId(16) val strFromMobile: String?, + @JceId(17) val strFromName: String?, + @JceId(18) val vNickName: List?//, //@SerialId(19) val stC2CTmpMsgHead: TempMsgHead? ) : JceStruct @Serializable internal class ShareData( - @ProtoId(0) val pkgname: String = "", - @ProtoId(1) val msgtail: String = "", - @ProtoId(2) val picurl: String = "", - @ProtoId(3) val url: String = "" + @JceId(0) val pkgname: String = "", + @JceId(1) val msgtail: String = "", + @JceId(2) val picurl: String = "", + @JceId(3) val url: String = "" ) : JceStruct @Serializable internal class TempMsgHead( - @ProtoId(0) val c2c_type: Int? = 0, - @ProtoId(1) val serviceType: Int? = 0 + @JceId(0) val c2c_type: Int? = 0, + @JceId(1) val serviceType: Int? = 0 ) : JceStruct @Serializable internal class CPicInfo( - @ProtoId(0) val vPath: ByteArray = EMPTY_BYTE_ARRAY, - @ProtoId(1) val vHost: ByteArray? = EMPTY_BYTE_ARRAY + @JceId(0) val vPath: ByteArray = EMPTY_BYTE_ARRAY, + @JceId(1) val vHost: ByteArray? = EMPTY_BYTE_ARRAY ) : JceStruct \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPacket.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPacket.kt index d4da06e09..3f7857b70 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPacket.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPacket.kt @@ -10,37 +10,37 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY private val EMPTY_MAP = mapOf() @Serializable internal class RequestPacket( - @ProtoId(1) val iVersion: Short? = 3, - @ProtoId(2) val cPacketType: Byte = 0, - @ProtoId(3) val iMessageType: Int = 0, - @ProtoId(4) val iRequestId: Int, - @ProtoId(5) val sServantName: String = "", - @ProtoId(6) val sFuncName: String = "", - @ProtoId(7) val sBuffer: ByteArray = EMPTY_BYTE_ARRAY, - @ProtoId(8) val iTimeout: Int? = 0, - @ProtoId(9) val context: Map? = EMPTY_MAP, - @ProtoId(10) val status: Map? = EMPTY_MAP + @JceId(1) val iVersion: Short? = 3, + @JceId(2) val cPacketType: Byte = 0, + @JceId(3) val iMessageType: Int = 0, + @JceId(4) val iRequestId: Int, + @JceId(5) val sServantName: String = "", + @JceId(6) val sFuncName: String = "", + @JceId(7) val sBuffer: ByteArray = EMPTY_BYTE_ARRAY, + @JceId(8) val iTimeout: Int? = 0, + @JceId(9) val context: Map? = EMPTY_MAP, + @JceId(10) val status: Map? = EMPTY_MAP ) : JceStruct @Serializable internal class RequestDataVersion3( - @ProtoId(0) val map: Map // 注意: ByteArray 不能直接放序列化的 JceStruct!! 要放类似 RequestDataStructSvcReqRegister 的 + @JceId(0) val map: Map // 注意: ByteArray 不能直接放序列化的 JceStruct!! 要放类似 RequestDataStructSvcReqRegister 的 ) : JceStruct @Serializable internal class RequestDataVersion2( - @ProtoId(0) val map: Map> + @JceId(0) val map: Map> ) : JceStruct @Serializable internal class RequestDataStructSvcReqRegister( - @ProtoId(0) val struct: SvcReqRegister + @JceId(0) val struct: SvcReqRegister ) : JceStruct \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPushForceOffline.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPushForceOffline.kt index aeba6f1ba..0027473e8 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPushForceOffline.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPushForceOffline.kt @@ -12,11 +12,12 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId @Serializable internal class RequestPushForceOffline( - @ProtoId(0) val uin: Long, - @ProtoId(1) val title: String? = "", - @ProtoId(2) val tips: String? = "", - @ProtoId(3) val sameDevice: Byte? = null + @JceId(0) val uin: Long, + @JceId(1) val title: String? = "", + @JceId(2) val tips: String? = "", + @JceId(3) val sameDevice: Byte? = null ) : JceStruct \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/SvcReqRegister.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/SvcReqRegister.kt index d351d8aea..40b568d67 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/SvcReqRegister.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/SvcReqRegister.kt @@ -10,46 +10,46 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId @Serializable internal class SvcReqRegister( - @ProtoId(0) val lUin: Long = 0L, - @ProtoId(1) val lBid: Long = 0L, - @ProtoId(2) val cConnType: Byte = 0, - @ProtoId(3) val sOther: String = "", - @ProtoId(4) val iStatus: Int = 11, - @ProtoId(5) val bOnlinePush: Byte = 0, - @ProtoId(6) val bIsOnline: Byte = 0, - @ProtoId(7) val bIsShowOnline: Byte = 0, - @ProtoId(8) val bKikPC: Byte = 0, - @ProtoId(9) val bKikWeak: Byte = 0, - @ProtoId(10) val timeStamp: Long = 0L, - @ProtoId(11) val iOSVersion: Long = 0L, - @ProtoId(12) val cNetType: Byte = 0, - @ProtoId(13) val sBuildVer: String? = "", - @ProtoId(14) val bRegType: Byte = 0, - @ProtoId(15) val vecDevParam: ByteArray? = null, - @ProtoId(16) val vecGuid: ByteArray? = null, - @ProtoId(17) val iLocaleID: Int = 2052, - @ProtoId(18) val bSlientPush: Byte = 0, - @ProtoId(19) val strDevName: String? = null, - @ProtoId(20) val strDevType: String? = null, - @ProtoId(21) val strOSVer: String? = null, - @ProtoId(22) val bOpenPush: Byte = 1, - @ProtoId(23) val iLargeSeq: Long = 0L, - @ProtoId(24) val iLastWatchStartTime: Long = 0L, - @ProtoId(26) val uOldSSOIp: Long = 0L, - @ProtoId(27) val uNewSSOIp: Long = 0L, - @ProtoId(28) val sChannelNo: String? = null, - @ProtoId(29) val lCpId: Long = 0L, - @ProtoId(30) val strVendorName: String? = null, - @ProtoId(31) val strVendorOSName: String? = null, - @ProtoId(32) val strIOSIdfa: String? = null, - @ProtoId(33) val bytes_0x769_reqbody: ByteArray? = null, - @ProtoId(34) val bIsSetStatus: Byte = 0, - @ProtoId(35) val vecServerBuf: ByteArray? = null, - @ProtoId(36) val bSetMute: Byte = 0 + @JceId(0) val lUin: Long = 0L, + @JceId(1) val lBid: Long = 0L, + @JceId(2) val cConnType: Byte = 0, + @JceId(3) val sOther: String = "", + @JceId(4) val iStatus: Int = 11, + @JceId(5) val bOnlinePush: Byte = 0, + @JceId(6) val bIsOnline: Byte = 0, + @JceId(7) val bIsShowOnline: Byte = 0, + @JceId(8) val bKikPC: Byte = 0, + @JceId(9) val bKikWeak: Byte = 0, + @JceId(10) val timeStamp: Long = 0L, + @JceId(11) val iOSVersion: Long = 0L, + @JceId(12) val cNetType: Byte = 0, + @JceId(13) val sBuildVer: String? = "", + @JceId(14) val bRegType: Byte = 0, + @JceId(15) val vecDevParam: ByteArray? = null, + @JceId(16) val vecGuid: ByteArray? = null, + @JceId(17) val iLocaleID: Int = 2052, + @JceId(18) val bSlientPush: Byte = 0, + @JceId(19) val strDevName: String? = null, + @JceId(20) val strDevType: String? = null, + @JceId(21) val strOSVer: String? = null, + @JceId(22) val bOpenPush: Byte = 1, + @JceId(23) val iLargeSeq: Long = 0L, + @JceId(24) val iLastWatchStartTime: Long = 0L, + @JceId(26) val uOldSSOIp: Long = 0L, + @JceId(27) val uNewSSOIp: Long = 0L, + @JceId(28) val sChannelNo: String? = null, + @JceId(29) val lCpId: Long = 0L, + @JceId(30) val strVendorName: String? = null, + @JceId(31) val strVendorOSName: String? = null, + @JceId(32) val strIOSIdfa: String? = null, + @JceId(33) val bytes_0x769_reqbody: ByteArray? = null, + @JceId(34) val bIsSetStatus: Byte = 0, + @JceId(35) val vecServerBuf: ByteArray? = null, + @JceId(36) val bSetMute: Byte = 0 // @SerialId(25) var vecBindUin: ArrayList<*>? = null // ?? 未知泛型 ) : JceStruct \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt index f72349e5a..b04ce98a4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt @@ -10,182 +10,182 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce import kotlinx.serialization.Serializable -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct +import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId @Serializable internal class GetTroopListReqV2Simplify( - @ProtoId(0) val uin: Long, - @ProtoId(1) val getMSFMsgFlag: Byte? = null, - @ProtoId(2) val vecCookies: ByteArray? = null, - @ProtoId(3) val vecGroupInfo: List? = null, - @ProtoId(4) val groupFlagExt: Byte? = null, - @ProtoId(5) val shVersion: Int? = null, - @ProtoId(6) val dwCompanyId: Long? = null, - @ProtoId(7) val versionNum: Long? = null, - @ProtoId(8) val getLongGroupName: Byte? = null + @JceId(0) val uin: Long, + @JceId(1) val getMSFMsgFlag: Byte? = null, + @JceId(2) val vecCookies: ByteArray? = null, + @JceId(3) val vecGroupInfo: List? = null, + @JceId(4) val groupFlagExt: Byte? = null, + @JceId(5) val shVersion: Int? = null, + @JceId(6) val dwCompanyId: Long? = null, + @JceId(7) val versionNum: Long? = null, + @JceId(8) val getLongGroupName: Byte? = null ) : JceStruct @Serializable internal class StTroopNumSimplify( - @ProtoId(0) val groupCode: Long, - @ProtoId(1) val dwGroupInfoSeq: Long? = null, - @ProtoId(2) val dwGroupFlagExt: Long? = null, - @ProtoId(3) val dwGroupRankSeq: Long? = null + @JceId(0) val groupCode: Long, + @JceId(1) val dwGroupInfoSeq: Long? = null, + @JceId(2) val dwGroupFlagExt: Long? = null, + @JceId(3) val dwGroupRankSeq: Long? = null ) : JceStruct @Serializable internal class GetTroopListRespV2( - @ProtoId(0) val uin: Long, - @ProtoId(1) val troopCount: Short, - @ProtoId(2) val result: Int, - @ProtoId(3) val errorCode: Short? = null, - @ProtoId(4) val vecCookies: ByteArray? = null, - @ProtoId(5) val vecTroopList: List? = null, - @ProtoId(6) val vecTroopListDel: List? = null, - @ProtoId(7) val vecTroopRank: List? = null, - @ProtoId(8) val vecFavGroup: List? = null, - @ProtoId(9) val vecTroopListExt: List? = null + @JceId(0) val uin: Long, + @JceId(1) val troopCount: Short, + @JceId(2) val result: Int, + @JceId(3) val errorCode: Short? = null, + @JceId(4) val vecCookies: ByteArray? = null, + @JceId(5) val vecTroopList: List? = null, + @JceId(6) val vecTroopListDel: List? = null, + @JceId(7) val vecTroopRank: List? = null, + @JceId(8) val vecFavGroup: List? = null, + @JceId(9) val vecTroopListExt: List? = null ) : JceStruct @Serializable internal class StTroopNum( - @ProtoId(0) val groupUin: Long, - @ProtoId(1) val groupCode: Long, - @ProtoId(2) val flag: Byte? = null, - @ProtoId(3) val dwGroupInfoSeq: Long? = null, - @ProtoId(4) val groupName: String = "", - @ProtoId(5) val groupMemo: String = "", - @ProtoId(6) val dwGroupFlagExt: Long? = null, - @ProtoId(7) val dwGroupRankSeq: Long? = null, - @ProtoId(8) val dwCertificationType: Long? = null, - @ProtoId(9) val dwShutUpTimestamp: Long? = null, - @ProtoId(10) val dwMyShutUpTimestamp: Long? = null, - @ProtoId(11) val dwCmdUinUinFlag: Long? = null, - @ProtoId(12) val dwAdditionalFlag: Long? = null, - @ProtoId(13) val dwGroupTypeFlag: Long? = null, - @ProtoId(14) val dwGroupSecType: Long? = null, - @ProtoId(15) val dwGroupSecTypeInfo: Long? = null, - @ProtoId(16) val dwGroupClassExt: Long? = null, - @ProtoId(17) val dwAppPrivilegeFlag: Long? = null, - @ProtoId(18) val dwSubscriptionUin: Long? = null, - @ProtoId(19) val dwMemberNum: Long? = null, - @ProtoId(20) val dwMemberNumSeq: Long? = null, - @ProtoId(21) val dwMemberCardSeq: Long? = null, - @ProtoId(22) val dwGroupFlagExt3: Long? = null, - @ProtoId(23) val dwGroupOwnerUin: Long, - @ProtoId(24) val isConfGroup: Byte? = null, - @ProtoId(25) val isModifyConfGroupFace: Byte? = null, - @ProtoId(26) val isModifyConfGroupName: Byte? = null, - @ProtoId(27) val dwCmduinJoinTime: Long? = null, - @ProtoId(28) val ulCompanyId: Long? = null, - @ProtoId(29) val dwMaxGroupMemberNum: Long? = null, - @ProtoId(30) val dwCmdUinGroupMask: Long? = null, - @ProtoId(31) val udwHLGuildAppid: Long? = null, - @ProtoId(32) val udwHLGuildSubType: Long? = null, - @ProtoId(33) val udwCmdUinRingtoneID: Long? = null, - @ProtoId(34) val udwCmdUinFlagEx2: Long? = null + @JceId(0) val groupUin: Long, + @JceId(1) val groupCode: Long, + @JceId(2) val flag: Byte? = null, + @JceId(3) val dwGroupInfoSeq: Long? = null, + @JceId(4) val groupName: String = "", + @JceId(5) val groupMemo: String = "", + @JceId(6) val dwGroupFlagExt: Long? = null, + @JceId(7) val dwGroupRankSeq: Long? = null, + @JceId(8) val dwCertificationType: Long? = null, + @JceId(9) val dwShutUpTimestamp: Long? = null, + @JceId(10) val dwMyShutUpTimestamp: Long? = null, + @JceId(11) val dwCmdUinUinFlag: Long? = null, + @JceId(12) val dwAdditionalFlag: Long? = null, + @JceId(13) val dwGroupTypeFlag: Long? = null, + @JceId(14) val dwGroupSecType: Long? = null, + @JceId(15) val dwGroupSecTypeInfo: Long? = null, + @JceId(16) val dwGroupClassExt: Long? = null, + @JceId(17) val dwAppPrivilegeFlag: Long? = null, + @JceId(18) val dwSubscriptionUin: Long? = null, + @JceId(19) val dwMemberNum: Long? = null, + @JceId(20) val dwMemberNumSeq: Long? = null, + @JceId(21) val dwMemberCardSeq: Long? = null, + @JceId(22) val dwGroupFlagExt3: Long? = null, + @JceId(23) val dwGroupOwnerUin: Long, + @JceId(24) val isConfGroup: Byte? = null, + @JceId(25) val isModifyConfGroupFace: Byte? = null, + @JceId(26) val isModifyConfGroupName: Byte? = null, + @JceId(27) val dwCmduinJoinTime: Long? = null, + @JceId(28) val ulCompanyId: Long? = null, + @JceId(29) val dwMaxGroupMemberNum: Long? = null, + @JceId(30) val dwCmdUinGroupMask: Long? = null, + @JceId(31) val udwHLGuildAppid: Long? = null, + @JceId(32) val udwHLGuildSubType: Long? = null, + @JceId(33) val udwCmdUinRingtoneID: Long? = null, + @JceId(34) val udwCmdUinFlagEx2: Long? = null ) : JceStruct @Serializable internal class StGroupRankInfo( - @ProtoId(0) val dwGroupCode: Long, - @ProtoId(1) val groupRankSysFlag: Byte? = null, - @ProtoId(2) val groupRankUserFlag: Byte? = null, - @ProtoId(3) val vecRankMap: List? = null, - @ProtoId(4) val dwGroupRankSeq: Long? = null, - @ProtoId(5) val ownerName: String? = "", - @ProtoId(6) val adminName: String? = "", - @ProtoId(7) val dwOfficeMode: Long? = null + @JceId(0) val dwGroupCode: Long, + @JceId(1) val groupRankSysFlag: Byte? = null, + @JceId(2) val groupRankUserFlag: Byte? = null, + @JceId(3) val vecRankMap: List? = null, + @JceId(4) val dwGroupRankSeq: Long? = null, + @JceId(5) val ownerName: String? = "", + @JceId(6) val adminName: String? = "", + @JceId(7) val dwOfficeMode: Long? = null ) : JceStruct @Serializable internal class StFavoriteGroup( - @ProtoId(0) val dwGroupCode: Long, - @ProtoId(1) val dwTimestamp: Long? = null, - @ProtoId(2) val dwSnsFlag: Long? = 1L, - @ProtoId(3) val dwOpenTimestamp: Long? = null + @JceId(0) val dwGroupCode: Long, + @JceId(1) val dwTimestamp: Long? = null, + @JceId(2) val dwSnsFlag: Long? = 1L, + @JceId(3) val dwOpenTimestamp: Long? = null ) : JceStruct @Serializable internal class StLevelRankPair( - @ProtoId(0) val dwLevel: Long? = null, - @ProtoId(1) val rank: String? = "" + @JceId(0) val dwLevel: Long? = null, + @JceId(1) val rank: String? = "" ) : JceStruct @Serializable internal class GetTroopMemberListReq( - @ProtoId(0) val uin: Long, - @ProtoId(1) val groupCode: Long, - @ProtoId(2) val nextUin: Long, - @ProtoId(3) val groupUin: Long, - @ProtoId(4) val version: Long? = null, - @ProtoId(5) val reqType: Long? = null, - @ProtoId(6) val getListAppointTime: Long? = null, - @ProtoId(7) val richCardNameVer: Byte? = null + @JceId(0) val uin: Long, + @JceId(1) val groupCode: Long, + @JceId(2) val nextUin: Long, + @JceId(3) val groupUin: Long, + @JceId(4) val version: Long? = null, + @JceId(5) val reqType: Long? = null, + @JceId(6) val getListAppointTime: Long? = null, + @JceId(7) val richCardNameVer: Byte? = null ) : JceStruct @Serializable internal class GetTroopMemberListResp( - @ProtoId(0) val uin: Long, - @ProtoId(1) val groupCode: Long, - @ProtoId(2) val groupUin: Long, - @ProtoId(3) val vecTroopMember: List, - @ProtoId(4) val nextUin: Long, - @ProtoId(5) val result: Int, - @ProtoId(6) val errorCode: Short? = null, - @ProtoId(7) val officeMode: Long? = null, - @ProtoId(8) val nextGetTime: Long? = null + @JceId(0) val uin: Long, + @JceId(1) val groupCode: Long, + @JceId(2) val groupUin: Long, + @JceId(3) val vecTroopMember: List, + @JceId(4) val nextUin: Long, + @JceId(5) val result: Int, + @JceId(6) val errorCode: Short? = null, + @JceId(7) val officeMode: Long? = null, + @JceId(8) val nextGetTime: Long? = null ) : JceStruct @Serializable internal class StTroopMemberInfo( - @ProtoId(0) val memberUin: Long, - @ProtoId(1) val faceId: Short, - @ProtoId(2) val age: Byte, - @ProtoId(3) val gender: Byte, - @ProtoId(4) val nick: String = "", - @ProtoId(5) val status: Byte = 20, - @ProtoId(6) val sShowName: String? = null, - @ProtoId(8) val sName: String? = null, - @ProtoId(9) val cGender: Byte? = null, - @ProtoId(10) val sPhone: String? = "", - @ProtoId(11) val sEmail: String? = "", - @ProtoId(12) val sMemo: String? = "", - @ProtoId(13) val autoRemark: String? = "", - @ProtoId(14) val dwMemberLevel: Long? = null, - @ProtoId(15) val dwJoinTime: Long? = null, - @ProtoId(16) val dwLastSpeakTime: Long? = null, - @ProtoId(17) val dwCreditLevel: Long? = null, - @ProtoId(18) val dwFlag: Long? = null, - @ProtoId(19) val dwFlagExt: Long? = null, - @ProtoId(20) val dwPoint: Long? = null, - @ProtoId(21) val concerned: Byte? = null, - @ProtoId(22) val shielded: Byte? = null, - @ProtoId(23) val sSpecialTitle: String? = "", - @ProtoId(24) val dwSpecialTitleExpireTime: Long? = null, - @ProtoId(25) val job: String? = "", - @ProtoId(26) val apolloFlag: Byte? = null, - @ProtoId(27) val dwApolloTimestamp: Long? = null, - @ProtoId(28) val dwGlobalGroupLevel: Long? = null, - @ProtoId(29) val dwTitleId: Long? = null, - @ProtoId(30) val dwShutupTimestap: Long? = null, - @ProtoId(31) val dwGlobalGroupPoint: Long? = null, - @ProtoId(32) val qzusrinfo: QzoneUserInfo? = null, - @ProtoId(33) val richCardNameVer: Byte? = null, - @ProtoId(34) val dwVipType: Long? = null, - @ProtoId(35) val dwVipLevel: Long? = null, - @ProtoId(36) val dwBigClubLevel: Long? = null, - @ProtoId(37) val dwBigClubFlag: Long? = null, - @ProtoId(38) val dwNameplate: Long? = null, - @ProtoId(39) val vecGroupHonor: ByteArray? = null + @JceId(0) val memberUin: Long, + @JceId(1) val faceId: Short, + @JceId(2) val age: Byte, + @JceId(3) val gender: Byte, + @JceId(4) val nick: String = "", + @JceId(5) val status: Byte = 20, + @JceId(6) val sShowName: String? = null, + @JceId(8) val sName: String? = null, + @JceId(9) val cGender: Byte? = null, + @JceId(10) val sPhone: String? = "", + @JceId(11) val sEmail: String? = "", + @JceId(12) val sMemo: String? = "", + @JceId(13) val autoRemark: String? = "", + @JceId(14) val dwMemberLevel: Long? = null, + @JceId(15) val dwJoinTime: Long? = null, + @JceId(16) val dwLastSpeakTime: Long? = null, + @JceId(17) val dwCreditLevel: Long? = null, + @JceId(18) val dwFlag: Long? = null, + @JceId(19) val dwFlagExt: Long? = null, + @JceId(20) val dwPoint: Long? = null, + @JceId(21) val concerned: Byte? = null, + @JceId(22) val shielded: Byte? = null, + @JceId(23) val sSpecialTitle: String? = "", + @JceId(24) val dwSpecialTitleExpireTime: Long? = null, + @JceId(25) val job: String? = "", + @JceId(26) val apolloFlag: Byte? = null, + @JceId(27) val dwApolloTimestamp: Long? = null, + @JceId(28) val dwGlobalGroupLevel: Long? = null, + @JceId(29) val dwTitleId: Long? = null, + @JceId(30) val dwShutupTimestap: Long? = null, + @JceId(31) val dwGlobalGroupPoint: Long? = null, + @JceId(32) val qzusrinfo: QzoneUserInfo? = null, + @JceId(33) val richCardNameVer: Byte? = null, + @JceId(34) val dwVipType: Long? = null, + @JceId(35) val dwVipLevel: Long? = null, + @JceId(36) val dwBigClubLevel: Long? = null, + @JceId(37) val dwBigClubFlag: Long? = null, + @JceId(38) val dwNameplate: Long? = null, + @JceId(39) val vecGroupHonor: ByteArray? = null ) : JceStruct @Serializable internal class QzoneUserInfo( - @ProtoId(0) val eStarState: Int? = null, - @ProtoId(1) val extendInfo: Map? = null + @JceId(0) val eStarState: Int? = null, + @JceId(1) val extendInfo: Map? = null ) : JceStruct \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid.io.serialization/JceInputTest.kt b/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid.io.serialization/JceInputTest.kt index c002ef2d2..7dcba9a4e 100644 --- a/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid.io.serialization/JceInputTest.kt +++ b/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid.io.serialization/JceInputTest.kt @@ -6,9 +6,9 @@ import kotlinx.io.core.buildPacket import kotlinx.io.core.writeFully import kotlinx.serialization.MissingFieldException import kotlinx.serialization.Serializable +import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId import net.mamoe.mirai.qqandroid.io.serialization.jce.JceInput -import net.mamoe.mirai.qqandroid.io.serialization.jce.JceNew import net.mamoe.mirai.qqandroid.io.serialization.jce.writeJceHead import kotlin.test.Test import kotlin.test.assertEquals @@ -98,7 +98,7 @@ internal class JceInputTest { to TestSerializableClassC(123123) ) ), - JceNew.UTF_8.load(TestSerializableClassA.serializer(), input) + Jce.UTF_8.load(TestSerializableClassA.serializer(), input) ) } @@ -155,7 +155,7 @@ internal class JceInputTest { 5, TestSerializableClassB(123, TestSerializableClassC(123123), 9) ), - JceNew.UTF_8.load(TestSerializableClassA.serializer(), input) + Jce.UTF_8.load(TestSerializableClassA.serializer(), input) ) } @@ -194,7 +194,7 @@ internal class JceInputTest { } } - assertEquals(TestSerializableClassA(), JceNew.UTF_8.load(TestSerializableClassA.serializer(), input)) + assertEquals(TestSerializableClassA(), Jce.UTF_8.load(TestSerializableClassA.serializer(), input)) } @Test @@ -232,7 +232,70 @@ internal class JceInputTest { assertEquals( TestSerializableClassA(mapOf(1 to 2, 33 to 44)), - JceNew.UTF_8.load(TestSerializableClassA.serializer(), input) + Jce.UTF_8.load(TestSerializableClassA.serializer(), input) + ) + } + + @Test + fun testMapStringInt() { + @Serializable + data class TestSerializableClassA( + @JceId(0) val byteArray: Map + ) + + val input = buildPacket { + writeJceHead(MAP, 0) + + mapOf("str1" to 2, "str2" to 44).let { + writeJceHead(BYTE, 0) + writeByte(it.size.toByte()) + + it.forEach { (key, value) -> + writeJceHead(STRING1, 0) + writeByte(key.length.toByte()) + writeStringUtf8(key) + + writeJceHead(INT, 1) + writeInt(value) + } + } + } + + assertEquals( + TestSerializableClassA(mapOf("str1" to 2, "str2" to 44)), + Jce.UTF_8.load(TestSerializableClassA.serializer(), input) + ) + } + + @Test + fun testMapStringByteArray() { + @Serializable + data class TestSerializableClassA( + @JceId(0) val byteArray: Map + ) + + val input = buildPacket { + writeJceHead(MAP, 0) + + mapOf("str1" to byteArrayOf(2, 3, 4), "str2" to byteArrayOf(2, 3, 4)).let { + writeJceHead(BYTE, 0) + writeByte(it.size.toByte()) + + it.forEach { (key, value) -> + writeJceHead(STRING1, 0) + writeByte(key.length.toByte()) + writeStringUtf8(key) + + writeJceHead(SIMPLE_LIST, 1) + writeJceHead(BYTE, 0) + writeFully(value) + } + } + } + + assertEquals( + TestSerializableClassA(mapOf("str1" to byteArrayOf(2, 3, 4), "str2" to byteArrayOf(2, 3, 4))), + Jce.UTF_8.load(TestSerializableClassA.serializer(), input) ) } @@ -282,7 +345,7 @@ internal class JceInputTest { } } - assertEquals(TestSerializableClassA(), JceNew.UTF_8.load(TestSerializableClassA.serializer(), input)) + assertEquals(TestSerializableClassA(), Jce.UTF_8.load(TestSerializableClassA.serializer(), input)) } @@ -319,7 +382,7 @@ internal class JceInputTest { writeByte(1) // boolean } - assertEquals(TestSerializableClassA(), JceNew.UTF_8.load(TestSerializableClassA.serializer(), input)) + assertEquals(TestSerializableClassA(), Jce.UTF_8.load(TestSerializableClassA.serializer(), input)) } @Test @@ -338,7 +401,7 @@ internal class JceInputTest { writeShort(123) } - assertFailsWith { JceNew.UTF_8.load(TestSerializableClassA.serializer(), input) } + assertFailsWith { Jce.UTF_8.load(TestSerializableClassA.serializer(), input) } } @Test