Commit 33d562a2 authored by Him188's avatar Him188

Merge remote-tracking branch 'origin/kotlin-1.3.70' into kotlin-1.3.70

parents ee3e2472 2e39daad
...@@ -71,7 +71,7 @@ If you meet any problem or have any questions, be free to open a issue. Our goal ...@@ -71,7 +71,7 @@ If you meet any problem or have any questions, be free to open a issue. Our goal
## Requirements ## Requirements
Kotlin 1.3.70 Kotlin 1.3.61
On JVM: Java 6 On JVM: Java 6
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
## 构建需求 ## 构建需求
- Kotlin 1.3.70 (必须) - Kotlin 1.3.61 (必须)
- JDK 6 或更高 (必须) - JDK 6 或更高 (必须)
- Android SDK 29 (可选, 用于编译安卓目标) - Android SDK 29 (可选, 用于编译安卓目标)
......
...@@ -5,9 +5,9 @@ miraiVersion=0.24.1 ...@@ -5,9 +5,9 @@ miraiVersion=0.24.1
kotlin.incremental.multiplatform=true kotlin.incremental.multiplatform=true
kotlin.parallel.tasks.in.project=true kotlin.parallel.tasks.in.project=true
# kotlin # kotlin
kotlinVersion=1.3.70 kotlinVersion=1.3.61
# kotlin libraries # kotlin libraries
serializationVersion=0.20.0-1.3.70-eap-274-2 serializationVersion=0.14.0
coroutinesVersion=1.3.3 coroutinesVersion=1.3.3
atomicFuVersion=0.14.1 atomicFuVersion=0.14.1
coroutinesIoVersion=0.1.16 coroutinesIoVersion=0.1.16
......
...@@ -59,7 +59,6 @@ kotlin { ...@@ -59,7 +59,6 @@ kotlin {
languageSettings.enableLanguageFeature("InlineClasses") languageSettings.enableLanguageFeature("InlineClasses")
languageSettings.useExperimentalAnnotation("kotlin.Experimental") languageSettings.useExperimentalAnnotation("kotlin.Experimental")
languageSettings.useExperimentalAnnotation("kotlin.OptIn")
dependencies { dependencies {
api(project(":mirai-core")) api(project(":mirai-core"))
...@@ -74,7 +73,6 @@ kotlin { ...@@ -74,7 +73,6 @@ kotlin {
commonMain { commonMain {
dependencies { dependencies {
api(kotlinx("serialization-runtime-common", serializationVersion)) api(kotlinx("serialization-runtime-common", serializationVersion))
api(kotlinx("serialization-protobuf-common", serializationVersion))
} }
} }
commonTest { commonTest {
...@@ -88,7 +86,6 @@ kotlin { ...@@ -88,7 +86,6 @@ kotlin {
if (isAndroidSDKAvailable) { if (isAndroidSDKAvailable) {
val androidMain by getting { val androidMain by getting {
dependencies { dependencies {
api(kotlinx("serialization-protobuf", serializationVersion))
} }
} }
......
...@@ -21,7 +21,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI ...@@ -21,7 +21,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
*/ */
@Suppress("INAPPLICABLE_JVM_NAME") @Suppress("INAPPLICABLE_JVM_NAME")
actual object QQAndroid : BotFactory { actual object QQAndroid : BotFactory {
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
@JvmName("newBot") @JvmName("newBot")
actual override fun Bot(context: Context, qq: Long, password: String, configuration: BotConfiguration): Bot { actual override fun Bot(context: Context, qq: Long, password: String, configuration: BotConfiguration): Bot {
return QQAndroidBot(context, BotAccount(qq, password), configuration) return QQAndroidBot(context, BotAccount(qq, password), configuration)
...@@ -30,7 +30,7 @@ actual object QQAndroid : BotFactory { ...@@ -30,7 +30,7 @@ actual object QQAndroid : BotFactory {
/** /**
* 使用指定的 [配置][configuration] 构造 [Bot] 实例 * 使用指定的 [配置][configuration] 构造 [Bot] 实例
*/ */
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
@JvmName("newBot") @JvmName("newBot")
actual override fun Bot( actual override fun Bot(
context: Context, context: Context,
......
...@@ -14,7 +14,7 @@ import net.mamoe.mirai.utils.BotConfiguration ...@@ -14,7 +14,7 @@ import net.mamoe.mirai.utils.BotConfiguration
import net.mamoe.mirai.utils.Context import net.mamoe.mirai.utils.Context
import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.MiraiInternalAPI
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
internal actual class QQAndroidBot internal actual class QQAndroidBot
actual constructor( actual constructor(
context: Context, context: Context,
......
...@@ -367,7 +367,7 @@ internal fun GroupImpl.Companion.checkIsInstance(expression: Boolean) { ...@@ -367,7 +367,7 @@ internal fun GroupImpl.Companion.checkIsInstance(expression: Boolean) {
} }
@Suppress("PropertyName") @Suppress("PropertyName")
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
internal class GroupImpl( internal class GroupImpl(
bot: QQAndroidBot, override val coroutineContext: CoroutineContext, bot: QQAndroidBot, override val coroutineContext: CoroutineContext,
override val id: Long, override val id: Long,
...@@ -383,7 +383,7 @@ internal class GroupImpl( ...@@ -383,7 +383,7 @@ internal class GroupImpl(
override lateinit var owner: Member override lateinit var owner: Member
@OptIn(MiraiExperimentalAPI::class) @UseExperimental(MiraiExperimentalAPI::class)
override val botAsMember: Member by lazy { override val botAsMember: Member by lazy {
Member(object : MemberInfo { Member(object : MemberInfo {
override val nameCard: String override val nameCard: String
...@@ -401,7 +401,7 @@ internal class GroupImpl( ...@@ -401,7 +401,7 @@ internal class GroupImpl(
}) })
} }
@OptIn(MiraiExperimentalAPI::class) @UseExperimental(MiraiExperimentalAPI::class)
override lateinit var botPermission: MemberPermission override lateinit var botPermission: MemberPermission
var _botMuteTimestamp: Int = groupInfo.botMuteRemaining var _botMuteTimestamp: Int = groupInfo.botMuteRemaining
...@@ -557,10 +557,10 @@ internal class GroupImpl( ...@@ -557,10 +557,10 @@ internal class GroupImpl(
TODO("not implemented") TODO("not implemented")
} }
@OptIn(MiraiExperimentalAPI::class) @UseExperimental(MiraiExperimentalAPI::class)
override fun Member(memberInfo: MemberInfo): Member { override fun Member(memberInfo: MemberInfo): Member {
return MemberImpl( return MemberImpl(
@OptIn(LowLevelAPI::class) @UseExperimental(LowLevelAPI::class)
bot._lowLevelNewQQ(memberInfo) as QQImpl, bot._lowLevelNewQQ(memberInfo) as QQImpl,
this, this,
this.coroutineContext, this.coroutineContext,
......
...@@ -28,22 +28,22 @@ import net.mamoe.mirai.qqandroid.message.OnlineFriendImageImpl ...@@ -28,22 +28,22 @@ import net.mamoe.mirai.qqandroid.message.OnlineFriendImageImpl
import net.mamoe.mirai.qqandroid.message.OnlineGroupImageImpl import net.mamoe.mirai.qqandroid.message.OnlineGroupImageImpl
import net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler import net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler
import net.mamoe.mirai.qqandroid.network.QQAndroidClient import net.mamoe.mirai.qqandroid.network.QQAndroidClient
import net.mamoe.mirai.qqandroid.network.protocol.packet.FriendList
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.PbMessageSvc import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.PbMessageSvc
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.TroopManagement import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.TroopManagement
import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import net.mamoe.mirai.utils.* import net.mamoe.mirai.utils.*
import kotlin.collections.asSequence import kotlin.collections.asSequence
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
internal expect class QQAndroidBot constructor( internal expect class QQAndroidBot constructor(
context: Context, context: Context,
account: BotAccount, account: BotAccount,
configuration: BotConfiguration configuration: BotConfiguration
) : QQAndroidBotBase ) : QQAndroidBotBase
@OptIn(MiraiInternalAPI::class, MiraiExperimentalAPI::class) @UseExperimental(MiraiInternalAPI::class, MiraiExperimentalAPI::class)
internal abstract class QQAndroidBotBase constructor( internal abstract class QQAndroidBotBase constructor(
context: Context, context: Context,
account: BotAccount, account: BotAccount,
...@@ -69,7 +69,7 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -69,7 +69,7 @@ internal abstract class QQAndroidBotBase constructor(
override val friends: ContactList<QQ> = ContactList(LockFreeLinkedList()) override val friends: ContactList<QQ> = ContactList(LockFreeLinkedList())
override val selfQQ: QQ by lazy { override val selfQQ: QQ by lazy {
@OptIn(LowLevelAPI::class) @UseExperimental(LowLevelAPI::class)
_lowLevelNewQQ(object : FriendInfo { _lowLevelNewQQ(object : FriendInfo {
override val uin: Long get() = this@QQAndroidBotBase.uin override val uin: Long get() = this@QQAndroidBotBase.uin
override val nick: String get() = this@QQAndroidBotBase.nick override val nick: String get() = this@QQAndroidBotBase.nick
...@@ -101,7 +101,7 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -101,7 +101,7 @@ internal abstract class QQAndroidBotBase constructor(
return groups.delegate.getOrNull(uin) return groups.delegate.getOrNull(uin)
} }
@OptIn(LowLevelAPI::class) @UseExperimental(LowLevelAPI::class)
override suspend fun _lowLevelQueryGroupList(): Sequence<Long> { override suspend fun _lowLevelQueryGroupList(): Sequence<Long> {
return network.run { return network.run {
FriendList.GetTroopListSimplify(bot.client) FriendList.GetTroopListSimplify(bot.client)
...@@ -109,7 +109,7 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -109,7 +109,7 @@ internal abstract class QQAndroidBotBase constructor(
}.groups.asSequence().map { it.groupUin.shl(32) and it.groupCode } }.groups.asSequence().map { it.groupUin.shl(32) and it.groupCode }
} }
@OptIn(LowLevelAPI::class) @UseExperimental(LowLevelAPI::class)
override suspend fun _lowLevelQueryGroupInfo(groupCode: Long): GroupInfo = network.run { override suspend fun _lowLevelQueryGroupInfo(groupCode: Long): GroupInfo = network.run {
TroopManagement.GetGroupInfo( TroopManagement.GetGroupInfo(
client = bot.client, client = bot.client,
...@@ -117,7 +117,7 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -117,7 +117,7 @@ internal abstract class QQAndroidBotBase constructor(
).sendAndExpect<GroupInfoImpl>(retry = 2) ).sendAndExpect<GroupInfoImpl>(retry = 2)
} }
@OptIn(LowLevelAPI::class) @UseExperimental(LowLevelAPI::class)
override suspend fun _lowLevelQueryGroupMemberList( override suspend fun _lowLevelQueryGroupMemberList(
groupUin: Long, groupUin: Long,
groupCode: Long, groupCode: Long,
...@@ -187,7 +187,7 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -187,7 +187,7 @@ internal abstract class QQAndroidBotBase constructor(
} }
} }
@OptIn(LowLevelAPI::class) @UseExperimental(LowLevelAPI::class)
override suspend fun _lowLevelRecallFriendMessage(friendId: Long, messageId: Long, time: Long) { override suspend fun _lowLevelRecallFriendMessage(friendId: Long, messageId: Long, time: Long) {
network.run { network.run {
val response: PbMessageSvc.PbMsgWithDraw.Response = val response: PbMessageSvc.PbMsgWithDraw.Response =
...@@ -198,7 +198,7 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -198,7 +198,7 @@ internal abstract class QQAndroidBotBase constructor(
} }
} }
@OptIn(LowLevelAPI::class) @UseExperimental(LowLevelAPI::class)
override suspend fun _lowLevelRecallGroupMessage(groupId: Long, messageId: Long) { override suspend fun _lowLevelRecallGroupMessage(groupId: Long, messageId: Long) {
network.run { network.run {
val response: PbMessageSvc.PbMsgWithDraw.Response = val response: PbMessageSvc.PbMsgWithDraw.Response =
......
...@@ -5,19 +5,11 @@ ...@@ -5,19 +5,11 @@
* Some code changed by Mamoe is annotated around "MIRAI MODIFY START" and "MIRAI MODIFY END" * Some code changed by Mamoe is annotated around "MIRAI MODIFY START" and "MIRAI MODIFY END"
*/ */
@file:Suppress("DEPRECATION_ERROR")
package net.mamoe.mirai.qqandroid.io.serialization package net.mamoe.mirai.qqandroid.io.serialization
import kotlinx.io.ByteArrayOutputStream import kotlinx.io.*
import kotlinx.io.ByteBuffer
import kotlinx.io.ByteOrder
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.ByteArraySerializer import kotlinx.serialization.internal.*
import kotlinx.serialization.builtins.MapEntrySerializer
import kotlinx.serialization.builtins.SetSerializer
import kotlinx.serialization.internal.MapLikeSerializer
import kotlinx.serialization.internal.TaggedEncoder
import kotlinx.serialization.modules.EmptyModule import kotlinx.serialization.modules.EmptyModule
import kotlinx.serialization.modules.SerialModule import kotlinx.serialization.modules.SerialModule
import kotlinx.serialization.protobuf.ProtoBuf import kotlinx.serialization.protobuf.ProtoBuf
...@@ -41,31 +33,22 @@ internal fun extractParameters(desc: SerialDescriptor, index: Int, zeroBasedDefa ...@@ -41,31 +33,22 @@ internal fun extractParameters(desc: SerialDescriptor, index: Int, zeroBasedDefa
* *
* 代码复制自 kotlinx.serialization. 修改部分已进行标注 (详见 "MIRAI MODIFY START") * 代码复制自 kotlinx.serialization. 修改部分已进行标注 (详见 "MIRAI MODIFY START")
*/ */
@OptIn(InternalSerializationApi::class, ExperimentalStdlibApi::class) class ProtoBufWithNullableSupport(context: SerialModule = EmptyModule) : AbstractSerialFormat(context), BinaryFormat {
class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModule) : SerialFormat, BinaryFormat {
internal open inner class ProtobufWriter(private val encoder: ProtobufEncoder) : TaggedEncoder<ProtoDesc>() { internal open inner class ProtobufWriter(val encoder: ProtobufEncoder) : TaggedEncoder<ProtoDesc>() {
override val context public override val context
get() = this@ProtoBufWithNullableSupport.context get() = this@ProtoBufWithNullableSupport.context
override fun beginStructure( override fun beginStructure(desc: SerialDescriptor, vararg typeParams: KSerializer<*>): CompositeEncoder = when (desc.kind) {
descriptor: SerialDescriptor,
vararg typeSerializers: KSerializer<*>
): CompositeEncoder =
when (descriptor.kind) {
StructureKind.LIST -> RepeatedWriter(encoder, currentTag) StructureKind.LIST -> RepeatedWriter(encoder, currentTag)
StructureKind.CLASS, StructureKind.OBJECT, is PolymorphicKind -> ObjectWriter(currentTagOrNull, encoder) StructureKind.CLASS, UnionKind.OBJECT, is PolymorphicKind -> ObjectWriter(currentTagOrNull, encoder)
StructureKind.MAP -> MapRepeatedWriter(currentTagOrNull, encoder) StructureKind.MAP -> MapRepeatedWriter(currentTagOrNull, encoder)
else -> throw SerializationException("Primitives are not supported at top-level") else -> throw SerializationException("Primitives are not supported at top-level")
} }
override fun encodeTaggedInt(tag: ProtoDesc, value: Int) = encoder.writeInt(value, tag.first, tag.second) override fun encodeTaggedInt(tag: ProtoDesc, value: Int) = encoder.writeInt(value, tag.first, tag.second)
override fun encodeTaggedByte(tag: ProtoDesc, value: Byte) = override fun encodeTaggedByte(tag: ProtoDesc, value: Byte) = encoder.writeInt(value.toInt(), tag.first, tag.second)
encoder.writeInt(value.toInt(), tag.first, tag.second) override fun encodeTaggedShort(tag: ProtoDesc, value: Short) = encoder.writeInt(value.toInt(), tag.first, tag.second)
override fun encodeTaggedShort(tag: ProtoDesc, value: Short) =
encoder.writeInt(value.toInt(), tag.first, tag.second)
override fun encodeTaggedLong(tag: ProtoDesc, value: Long) = encoder.writeLong(value, tag.first, tag.second) override fun encodeTaggedLong(tag: ProtoDesc, value: Long) = encoder.writeLong(value, tag.first, tag.second)
override fun encodeTaggedFloat(tag: ProtoDesc, value: Float) = encoder.writeFloat(value, tag.first) override fun encodeTaggedFloat(tag: ProtoDesc, value: Float) = encoder.writeFloat(value, tag.first)
override fun encodeTaggedDouble(tag: ProtoDesc, value: Double) = encoder.writeDouble(value, tag.first) override fun encodeTaggedDouble(tag: ProtoDesc, value: Double) = encoder.writeDouble(value, tag.first)
...@@ -99,15 +82,12 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu ...@@ -99,15 +82,12 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu
@Suppress("UNCHECKED_CAST", "NAME_SHADOWING") @Suppress("UNCHECKED_CAST", "NAME_SHADOWING")
override fun <T> encodeSerializableValue(serializer: SerializationStrategy<T>, value: T) = when { override fun <T> encodeSerializableValue(serializer: SerializationStrategy<T>, value: T) = when {
// encode maps as collection of map entries, not merged collection of key-values // encode maps as collection of map entries, not merged collection of key-values
serializer.descriptor.kind == StructureKind.MAP -> { serializer.descriptor is MapLikeDescriptor -> {
val serializer = (serializer as MapLikeSerializer<Any?, Any?, T, *>) val serializer = (serializer as MapLikeSerializer<Any?, Any?, T, *>)
val mapEntrySerial = MapEntrySerializer(serializer.keySerializer, serializer.valueSerializer) val mapEntrySerial = MapEntrySerializer(serializer.keySerializer, serializer.valueSerializer)
SetSerializer(mapEntrySerial).serialize(this, (value as Map<*, *>).entries) HashSetSerializer(mapEntrySerial).serialize(this, (value as Map<*, *>).entries)
} }
serializer.descriptor == ByteArraySerializer().descriptor -> encoder.writeBytes( serializer.descriptor == ByteArraySerializer.descriptor -> encoder.writeBytes(value as ByteArray, popTag().first)
value as ByteArray,
popTag().first
)
else -> serializer.serialize(this, value) else -> serializer.serialize(this, value)
} }
} }
...@@ -116,7 +96,7 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu ...@@ -116,7 +96,7 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu
val parentTag: ProtoDesc?, private val parentEncoder: ProtobufEncoder, val parentTag: ProtoDesc?, private val parentEncoder: ProtobufEncoder,
private val stream: ByteArrayOutputStream = ByteArrayOutputStream() private val stream: ByteArrayOutputStream = ByteArrayOutputStream()
) : ProtobufWriter(ProtobufEncoder(stream)) { ) : ProtobufWriter(ProtobufEncoder(stream)) {
override fun endEncode(descriptor: SerialDescriptor) { override fun endEncode(desc: SerialDescriptor) {
if (parentTag != null) { if (parentTag != null) {
parentEncoder.writeBytes(stream.toByteArray(), parentTag.first) parentEncoder.writeBytes(stream.toByteArray(), parentTag.first)
} else { } else {
...@@ -131,8 +111,7 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu ...@@ -131,8 +111,7 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu
else 2 to (parentTag?.second ?: ProtoNumberType.DEFAULT) else 2 to (parentTag?.second ?: ProtoNumberType.DEFAULT)
} }
internal inner class RepeatedWriter(encoder: ProtobufEncoder, private val curTag: ProtoDesc) : internal inner class RepeatedWriter(encoder: ProtobufEncoder, val curTag: ProtoDesc) : ProtobufWriter(encoder) {
ProtobufWriter(encoder) {
override fun SerialDescriptor.getTag(index: Int) = curTag override fun SerialDescriptor.getTag(index: Int) = curTag
} }
...@@ -163,7 +142,7 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu ...@@ -163,7 +142,7 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu
} }
fun writeString(value: String, tag: Int) { fun writeString(value: String, tag: Int) {
val bytes = value.encodeToByteArray() val bytes = value.toUtf8Bytes()
writeBytes(bytes, tag) writeBytes(bytes, tag)
} }
...@@ -249,17 +228,17 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu ...@@ -249,17 +228,17 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu
internal const val SIZE_DELIMITED = 2 internal const val SIZE_DELIMITED = 2
internal const val i32 = 5 internal const val i32 = 5
private val plain = ProtoBufWithNullableSupport() val plain = ProtoBufWithNullableSupport()
override fun <T> dump(serializer: SerializationStrategy<T>, value: T): ByteArray = plain.dump(serializer, value) override fun <T> dump(serializer: SerializationStrategy<T>, obj: T): ByteArray = plain.dump(serializer, obj)
override fun <T> load(deserializer: DeserializationStrategy<T>, bytes: ByteArray): T = override fun <T> load(deserializer: DeserializationStrategy<T>, bytes: ByteArray): T = plain.load(deserializer, bytes)
plain.load(deserializer, bytes) override fun install(module: SerialModule) = throw IllegalStateException("You should not install anything to global instance")
} }
override fun <T> dump(serializer: SerializationStrategy<T>, value: T): ByteArray { override fun <T> dump(serializer: SerializationStrategy<T>, obj: T): ByteArray {
val encoder = ByteArrayOutputStream() val encoder = ByteArrayOutputStream()
val dumper = ProtobufWriter(ProtobufEncoder(encoder)) val dumper = ProtobufWriter(ProtobufEncoder(encoder))
dumper.encode(serializer, value) dumper.encode(serializer, obj)
return encoder.toByteArray() return encoder.toByteArray()
} }
...@@ -269,3 +248,20 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu ...@@ -269,3 +248,20 @@ class ProtoBufWithNullableSupport(override val context: SerialModule = EmptyModu
} }
internal fun InputStream.readExactNBytes(bytes: Int): ByteArray {
val array = ByteArray(bytes)
var read = 0
while (read < bytes) {
val i = this.read(array, read, bytes - read)
if (i == -1) throw IOException("Unexpected EOF")
read += i
}
return array
}
internal fun InputStream.readToByteBuffer(bytes: Int): ByteBuffer {
val arr = readExactNBytes(bytes)
val buf = ByteBuffer.allocate(bytes)
buf.put(arr).flip()
return buf
}
\ No newline at end of file
...@@ -253,7 +253,7 @@ internal class MessageSourceFromSendFriend( ...@@ -253,7 +253,7 @@ internal class MessageSourceFromSendFriend(
val sequenceId: Int, val sequenceId: Int,
override val originalMessage: MessageChain override val originalMessage: MessageChain
) : MessageSourceFromSend() { ) : MessageSourceFromSend() {
@OptIn(ExperimentalCoroutinesApi::class) @UseExperimental(ExperimentalCoroutinesApi::class)
override val id: Long override val id: Long
get() = sequenceId.toLong().shl(32) or get() = sequenceId.toLong().shl(32) or
messageRandom.toLong().and(0xFFFFFFFF) messageRandom.toLong().and(0xFFFFFFFF)
...@@ -277,12 +277,12 @@ internal class MessageSourceFromSendGroup( ...@@ -277,12 +277,12 @@ internal class MessageSourceFromSendGroup(
) : MessageSourceFromSend() { ) : MessageSourceFromSend() {
private lateinit var sequenceIdDeferred: Deferred<Int> private lateinit var sequenceIdDeferred: Deferred<Int>
@OptIn(ExperimentalCoroutinesApi::class) @UseExperimental(ExperimentalCoroutinesApi::class)
override val id: Long override val id: Long
get() = sequenceIdDeferred.getCompleted().toLong().shl(32) or get() = sequenceIdDeferred.getCompleted().toLong().shl(32) or
messageRandom.toLong().and(0xFFFFFFFF) messageRandom.toLong().and(0xFFFFFFFF)
@OptIn(MiraiExperimentalAPI::class) @UseExperimental(MiraiExperimentalAPI::class)
internal fun startWaitingSequenceId(coroutineScope: CoroutineScope) { internal fun startWaitingSequenceId(coroutineScope: CoroutineScope) {
sequenceIdDeferred = sequenceIdDeferred =
coroutineScope.subscribingGetAsync<OnlinePush.PbPushGroupMsg.SendGroupMessageReceipt, Int>( coroutineScope.subscribingGetAsync<OnlinePush.PbPushGroupMsg.SendGroupMessageReceipt, Int>(
......
...@@ -219,7 +219,7 @@ private val atAllData = ImMsgBody.Elem( ...@@ -219,7 +219,7 @@ private val atAllData = ImMsgBody.Elem(
) )
) )
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
internal fun MessageChain.toRichTextElems(forGroup: Boolean): MutableList<ImMsgBody.Elem> { internal fun MessageChain.toRichTextElems(forGroup: Boolean): MutableList<ImMsgBody.Elem> {
val elements = mutableListOf<ImMsgBody.Elem>() val elements = mutableListOf<ImMsgBody.Elem>()
...@@ -332,7 +332,7 @@ internal class OnlineFriendImageImpl( ...@@ -332,7 +332,7 @@ internal class OnlineFriendImageImpl(
} }
} }
@OptIn(ExperimentalUnsignedTypes::class, MiraiInternalAPI::class) @UseExperimental(ExperimentalUnsignedTypes::class, MiraiInternalAPI::class)
internal fun MsgComm.Msg.toMessageChain(): MessageChain { internal fun MsgComm.Msg.toMessageChain(): MessageChain {
val elements = this.msgBody.richText.elems val elements = this.msgBody.richText.elems
...@@ -343,7 +343,7 @@ internal fun MsgComm.Msg.toMessageChain(): MessageChain { ...@@ -343,7 +343,7 @@ internal fun MsgComm.Msg.toMessageChain(): MessageChain {
} }
// These two functions are not identical, dont combine. // These two functions are not identical, dont combine.
@OptIn(ExperimentalUnsignedTypes::class, MiraiInternalAPI::class) @UseExperimental(ExperimentalUnsignedTypes::class, MiraiInternalAPI::class)
internal fun ImMsgBody.SourceMsg.toMessageChain(): MessageChain { internal fun ImMsgBody.SourceMsg.toMessageChain(): MessageChain {
val elements = this.elems!! val elements = this.elems!!
...@@ -368,9 +368,7 @@ private fun MessageChain.removeAtIfHasQuoteReply(): MessageChain = ...@@ -368,9 +368,7 @@ private fun MessageChain.removeAtIfHasQuoteReply(): MessageChain =
}.asMessageChain() }.asMessageChain()
} else this*/ } else this*/
@OptIn( @UseExperimental(MiraiInternalAPI::class, ExperimentalUnsignedTypes::class, MiraiDebugAPI::class, LowLevelAPI::class)
MiraiInternalAPI::class, ExperimentalUnsignedTypes::class, MiraiDebugAPI::class, LowLevelAPI::class
)
internal fun List<ImMsgBody.Elem>.joinToMessageChain(message: MessageChainBuilder) { internal fun List<ImMsgBody.Elem>.joinToMessageChain(message: MessageChainBuilder) {
this.forEach { this.forEach {
when { when {
......
...@@ -31,6 +31,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc ...@@ -31,6 +31,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import net.mamoe.mirai.qqandroid.network.protocol.packet.* import net.mamoe.mirai.qqandroid.network.protocol.packet.*
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvc import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvc
import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.Heartbeat import net.mamoe.mirai.qqandroid.network.protocol.packet.login.Heartbeat
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.WtLogin import net.mamoe.mirai.qqandroid.network.protocol.packet.login.WtLogin
...@@ -44,7 +45,7 @@ import kotlin.jvm.Volatile ...@@ -44,7 +45,7 @@ import kotlin.jvm.Volatile
import kotlin.time.ExperimentalTime import kotlin.time.ExperimentalTime
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler() { internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler() {
override val bot: QQAndroidBot by bot.unsafeWeakRef() override val bot: QQAndroidBot by bot.unsafeWeakRef()
override val supervisor: CompletableJob = SupervisorJob(bot.coroutineContext[Job]) override val supervisor: CompletableJob = SupervisorJob(bot.coroutineContext[Job])
...@@ -182,7 +183,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler ...@@ -182,7 +183,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
internal var pendingIncomingPackets: LockFreeLinkedList<KnownPacketFactories.IncomingPacket<*>>? = internal var pendingIncomingPackets: LockFreeLinkedList<KnownPacketFactories.IncomingPacket<*>>? =
LockFreeLinkedList() LockFreeLinkedList()
@OptIn(MiraiExperimentalAPI::class, ExperimentalTime::class) @UseExperimental(MiraiExperimentalAPI::class, ExperimentalTime::class)
override suspend fun init(): Unit = coroutineScope { override suspend fun init(): Unit = coroutineScope {
check(bot.isActive) { "bot is dead therefore network can't init" } check(bot.isActive) { "bot is dead therefore network can't init" }
check(this@QQAndroidBotNetworkHandler.isActive) { "network is dead therefore can't init" } check(this@QQAndroidBotNetworkHandler.isActive) { "network is dead therefore can't init" }
...@@ -371,7 +372,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler ...@@ -371,7 +372,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
* *
* @param input 一个完整的包的内容, 去掉开头的 int 包长度 * @param input 一个完整的包的内容, 去掉开头的 int 包长度
*/ */
@OptIn(ExperimentalCoroutinesApi::class) @UseExperimental(ExperimentalCoroutinesApi::class)
fun parsePacketAsync(input: Input): Job { fun parsePacketAsync(input: Input): Job {
return this.launch(start = CoroutineStart.ATOMIC) { return this.launch(start = CoroutineStart.ATOMIC) {
input.use { parsePacket(it) } input.use { parsePacket(it) }
......
...@@ -40,7 +40,7 @@ import net.mamoe.mirai.utils.io.* ...@@ -40,7 +40,7 @@ import net.mamoe.mirai.utils.io.*
DOMAINS DOMAINS
Pskey: "openmobile.qq.com" Pskey: "openmobile.qq.com"
*/ */
@OptIn(MiraiExperimentalAPI::class, MiraiInternalAPI::class) @UseExperimental(MiraiExperimentalAPI::class, MiraiInternalAPI::class)
@PublishedApi @PublishedApi
internal open class QQAndroidClient( internal open class QQAndroidClient(
context: Context, context: Context,
...@@ -158,7 +158,7 @@ internal open class QQAndroidClient( ...@@ -158,7 +158,7 @@ internal open class QQAndroidClient(
*/ */
val uin: Long get() = _uin val uin: Long get() = _uin
@OptIn(RawAccountIdUse::class) @UseExperimental(RawAccountIdUse::class)
@Suppress("PropertyName") @Suppress("PropertyName")
internal var _uin: Long = bot.account.id internal var _uin: Long = bot.account.id
......
...@@ -26,7 +26,6 @@ import io.ktor.utils.io.pool.useInstance ...@@ -26,7 +26,6 @@ import io.ktor.utils.io.pool.useInstance
import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
import kotlinx.io.InputStream import kotlinx.io.InputStream
import kotlinx.serialization.InternalSerializationApi
import net.mamoe.mirai.qqandroid.io.serialization.readProtoBuf import net.mamoe.mirai.qqandroid.io.serialization.readProtoBuf
import net.mamoe.mirai.qqandroid.network.QQAndroidClient import net.mamoe.mirai.qqandroid.network.QQAndroidClient
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead
...@@ -35,7 +34,7 @@ import net.mamoe.mirai.utils.io.ByteArrayPool ...@@ -35,7 +34,7 @@ import net.mamoe.mirai.utils.io.ByteArrayPool
import net.mamoe.mirai.utils.io.PlatformSocket import net.mamoe.mirai.utils.io.PlatformSocket
import net.mamoe.mirai.utils.io.withUse import net.mamoe.mirai.utils.io.withUse
@OptIn(MiraiInternalAPI::class, InternalSerializationApi::class) @UseExperimental(MiraiInternalAPI::class)
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
internal suspend fun HttpClient.postImage( internal suspend fun HttpClient.postImage(
htcmd: String, htcmd: String,
...@@ -93,9 +92,9 @@ internal suspend fun HttpClient.postImage( ...@@ -93,9 +92,9 @@ internal suspend fun HttpClient.postImage(
} }
} == HttpStatusCode.OK } == HttpStatusCode.OK
@OptIn(MiraiInternalAPI::class, InternalSerializationApi::class) @UseExperimental(MiraiInternalAPI::class)
internal object HighwayHelper { internal object HighwayHelper {
@OptIn(InternalCoroutinesApi::class) @UseExperimental(InternalCoroutinesApi::class)
suspend fun uploadImage( suspend fun uploadImage(
client: QQAndroidClient, client: QQAndroidClient,
serverIp: String, serverIp: String,
......
...@@ -15,6 +15,7 @@ import io.ktor.utils.io.ByteReadChannel ...@@ -15,6 +15,7 @@ import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.core.* import io.ktor.utils.io.core.*
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.io.InputStream
import net.mamoe.mirai.qqandroid.io.serialization.toByteArray import net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import net.mamoe.mirai.qqandroid.network.QQAndroidClient import net.mamoe.mirai.qqandroid.network.QQAndroidClient
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead
...@@ -22,7 +23,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY ...@@ -22,7 +23,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.io.* import net.mamoe.mirai.utils.io.*
@OptIn(MiraiInternalAPI::class) @UseExperimental(MiraiInternalAPI::class)
internal fun createImageDataPacketSequence( // RequestDataTrans internal fun createImageDataPacketSequence( // RequestDataTrans
client: QQAndroidClient, client: QQAndroidClient,
command: String, command: String,
......
...@@ -9,139 +9,139 @@ ...@@ -9,139 +9,139 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.jce package net.mamoe.mirai.qqandroid.network.protocol.data.jce
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.data.Packet import net.mamoe.mirai.data.Packet
import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.JceStruct
@Serializable @Serializable
internal class BigDataChannel( internal class BigDataChannel(
@ProtoId(0) val vBigdataIplists: List<BigDataIpList>, @SerialId(0) val vBigdataIplists: List<BigDataIpList>,
@ProtoId(1) val sBigdataSigSession: ByteArray? = null, @SerialId(1) val sBigdataSigSession: ByteArray? = null,
@ProtoId(2) val sBigdataKeySession: ByteArray? = null, @SerialId(2) val sBigdataKeySession: ByteArray? = null,
@ProtoId(3) val uSigUin: Long? = null, @SerialId(3) val uSigUin: Long? = null,
@ProtoId(4) val iConnectFlag: Int? = 1, @SerialId(4) val iConnectFlag: Int? = 1,
@ProtoId(5) val vBigdataPbBuf: ByteArray? = null @SerialId(5) val vBigdataPbBuf: ByteArray? = null
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class BigDataIpInfo( internal class BigDataIpInfo(
@ProtoId(0) val uType: Long, @SerialId(0) val uType: Long,
@ProtoId(1) val sIp: String = "", @SerialId(1) val sIp: String = "",
@ProtoId(2) val uPort: Long @SerialId(2) val uPort: Long
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class BigDataIpList( internal class BigDataIpList(
@ProtoId(0) val uServiceType: Long, @SerialId(0) val uServiceType: Long,
@ProtoId(1) val vIplist: List<BigDataIpInfo>, @SerialId(1) val vIplist: List<BigDataIpInfo>,
@ProtoId(2) val netSegConfs: List<NetSegConf>? = null, @SerialId(2) val netSegConfs: List<NetSegConf>? = null,
@ProtoId(3) val ufragmentSize: Long? = null @SerialId(3) val ufragmentSize: Long? = null
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class ClientLogConfig( internal class ClientLogConfig(
@ProtoId(1) val type: Int, @SerialId(1) val type: Int,
@ProtoId(2) val timeStart: TimeStamp? = null, @SerialId(2) val timeStart: TimeStamp? = null,
@ProtoId(3) val timeFinish: TimeStamp? = null, @SerialId(3) val timeFinish: TimeStamp? = null,
@ProtoId(4) val loglevel: Byte? = null, @SerialId(4) val loglevel: Byte? = null,
@ProtoId(5) val cookie: Int? = null, @SerialId(5) val cookie: Int? = null,
@ProtoId(6) val lseq: Long? = null @SerialId(6) val lseq: Long? = null
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class DomainIpChannel( internal class DomainIpChannel(
@ProtoId(0) val vDomainIplists: List<DomainIpList> @SerialId(0) val vDomainIplists: List<DomainIpList>
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class DomainIpInfo( internal class DomainIpInfo(
@ProtoId(1) val uIp: Int, @SerialId(1) val uIp: Int,
@ProtoId(2) val uPort: Int @SerialId(2) val uPort: Int
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class DomainIpList( internal class DomainIpList(
@ProtoId(0) val uDomainType: Int, @SerialId(0) val uDomainType: Int,
@ProtoId(1) val vIplist: List<DomainIpInfo> @SerialId(1) val vIplist: List<DomainIpInfo>
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class FileStoragePushFSSvcList( internal class FileStoragePushFSSvcList(
@ProtoId(0) val vUpLoadList: List<FileStorageServerListInfo>, @SerialId(0) val vUpLoadList: List<FileStorageServerListInfo>,
@ProtoId(1) val vPicDownLoadList: List<FileStorageServerListInfo>, @SerialId(1) val vPicDownLoadList: List<FileStorageServerListInfo>,
@ProtoId(2) val vGPicDownLoadList: List<FileStorageServerListInfo>? = null, @SerialId(2) val vGPicDownLoadList: List<FileStorageServerListInfo>? = null,
@ProtoId(3) val vQzoneProxyServiceList: List<FileStorageServerListInfo>? = null, @SerialId(3) val vQzoneProxyServiceList: List<FileStorageServerListInfo>? = null,
@ProtoId(4) val vUrlEncodeServiceList: List<FileStorageServerListInfo>? = null, @SerialId(4) val vUrlEncodeServiceList: List<FileStorageServerListInfo>? = null,
@ProtoId(5) val bigDataChannel: BigDataChannel? = null, @SerialId(5) val bigDataChannel: BigDataChannel? = null,
@ProtoId(6) val vVipEmotionList: List<FileStorageServerListInfo>? = null, @SerialId(6) val vVipEmotionList: List<FileStorageServerListInfo>? = null,
@ProtoId(7) val vC2CPicDownList: List<FileStorageServerListInfo>? = null, @SerialId(7) val vC2CPicDownList: List<FileStorageServerListInfo>? = null,
@ProtoId(8) val fmtIPInfo: FmtIPInfo? = null, @SerialId(8) val fmtIPInfo: FmtIPInfo? = null,
@ProtoId(9) val domainIpChannel: DomainIpChannel? = null, @SerialId(9) val domainIpChannel: DomainIpChannel? = null,
@ProtoId(10) val pttlist: ByteArray? = null @SerialId(10) val pttlist: ByteArray? = null
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class FileStorageServerListInfo( internal class FileStorageServerListInfo(
@ProtoId(1) val sIP: String = "", @SerialId(1) val sIP: String = "",
@ProtoId(2) val iPort: Int @SerialId(2) val iPort: Int
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class FmtIPInfo( internal class FmtIPInfo(
@ProtoId(0) val sGateIp: String = "", @SerialId(0) val sGateIp: String = "",
@ProtoId(1) val iGateIpOper: Long @SerialId(1) val iGateIpOper: Long
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class NetSegConf( internal class NetSegConf(
@ProtoId(0) val uint32NetType: Long? = null, @SerialId(0) val uint32NetType: Long? = null,
@ProtoId(1) val uint32Segsize: Long? = null, @SerialId(1) val uint32Segsize: Long? = null,
@ProtoId(2) val uint32Segnum: Long? = null, @SerialId(2) val uint32Segnum: Long? = null,
@ProtoId(3) val uint32Curconnnum: Long? = null @SerialId(3) val uint32Curconnnum: Long? = null
) : JceStruct ) : JceStruct
@Suppress("ArrayInDataClass") @Suppress("ArrayInDataClass")
@Serializable @Serializable
internal data class PushReq( internal data class PushReq(
@ProtoId(1) val type: Int, @SerialId(1) val type: Int,
@ProtoId(2) val jcebuf: ByteArray, @SerialId(2) val jcebuf: ByteArray,
@ProtoId(3) val seq: Long @SerialId(3) val seq: Long
) : JceStruct, Packet ) : JceStruct, Packet
@Serializable @Serializable
internal class PushResp( internal class PushResp(
@ProtoId(1) val type: Int, @SerialId(1) val type: Int,
@ProtoId(2) val seq: Long, @SerialId(2) val seq: Long,
@ProtoId(3) val jcebuf: ByteArray? = null @SerialId(3) val jcebuf: ByteArray? = null
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class SsoServerList( internal class SsoServerList(
@ProtoId(1) val v2G3GList: List<SsoServerListInfo>, @SerialId(1) val v2G3GList: List<SsoServerListInfo>,
@ProtoId(3) val vWifiList: List<SsoServerListInfo>, @SerialId(3) val vWifiList: List<SsoServerListInfo>,
@ProtoId(4) val iReconnect: Int, @SerialId(4) val iReconnect: Int,
@ProtoId(5) val testSpeed: Byte? = null, @SerialId(5) val testSpeed: Byte? = null,
@ProtoId(6) val useNewList: Byte? = null, @SerialId(6) val useNewList: Byte? = null,
@ProtoId(7) val iMultiConn: Int? = 1, @SerialId(7) val iMultiConn: Int? = 1,
@ProtoId(8) val vHttp2g3glist: List<SsoServerListInfo>? = null, @SerialId(8) val vHttp2g3glist: List<SsoServerListInfo>? = null,
@ProtoId(9) val vHttpWifilist: List<SsoServerListInfo>? = null @SerialId(9) val vHttpWifilist: List<SsoServerListInfo>? = null
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class SsoServerListInfo( internal class SsoServerListInfo(
@ProtoId(1) val sIP: String = "", @SerialId(1) val sIP: String = "",
@ProtoId(2) val iPort: Int, @SerialId(2) val iPort: Int,
@ProtoId(3) val linkType: Byte, @SerialId(3) val linkType: Byte,
@ProtoId(4) val proxy: Byte, @SerialId(4) val proxy: Byte,
@ProtoId(5) val protocolType: Byte? = null, @SerialId(5) val protocolType: Byte? = null,
@ProtoId(6) val iTimeOut: Int? = 10 @SerialId(6) val iTimeOut: Int? = 10
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class TimeStamp( internal class TimeStamp(
@ProtoId(1) val year: Int, @SerialId(1) val year: Int,
@ProtoId(2) val month: Byte, @SerialId(2) val month: Byte,
@ProtoId(3) val day: Byte, @SerialId(3) val day: Byte,
@ProtoId(4) val hour: Byte @SerialId(4) val hour: Byte
) : JceStruct ) : JceStruct
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.jce package net.mamoe.mirai.qqandroid.network.protocol.data.jce
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.data.Packet import net.mamoe.mirai.data.Packet
import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.JceStruct
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...@@ -18,63 +18,63 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY ...@@ -18,63 +18,63 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
@Suppress("ArrayInDataClass") @Suppress("ArrayInDataClass")
@Serializable @Serializable
internal data class RequestPushNotify( internal data class RequestPushNotify(
@ProtoId(0) val uin: Long? = 0L, @SerialId(0) val uin: Long? = 0L,
@ProtoId(1) val ctype: Byte = 0, @SerialId(1) val ctype: Byte = 0,
@ProtoId(2) val strService: String?, @SerialId(2) val strService: String?,
@ProtoId(3) val strCmd: String?, @SerialId(3) val strCmd: String?,
@ProtoId(4) val vNotifyCookie: ByteArray? = EMPTY_BYTE_ARRAY, @SerialId(4) val vNotifyCookie: ByteArray? = EMPTY_BYTE_ARRAY,
@ProtoId(5) val usMsgType: Int?, @SerialId(5) val usMsgType: Int?,
@ProtoId(6) val wUserActive: Int?, @SerialId(6) val wUserActive: Int?,
@ProtoId(7) val wGeneralFlag: Int?, @SerialId(7) val wGeneralFlag: Int?,
@ProtoId(8) val bindedUin: Long?, @SerialId(8) val bindedUin: Long?,
@ProtoId(9) val stMsgInfo: MsgInfo?, @SerialId(9) val stMsgInfo: MsgInfo?,
@ProtoId(10) val msgCtrlBuf: String?, @SerialId(10) val msgCtrlBuf: String?,
@ProtoId(11) val serverBuf: ByteArray?, @SerialId(11) val serverBuf: ByteArray?,
@ProtoId(12) val pingFlag: Long?, @SerialId(12) val pingFlag: Long?,
@ProtoId(13) val svrip: Int? @SerialId(13) val svrip: Int?
) : JceStruct, Packet ) : JceStruct, Packet
@Serializable @Serializable
internal class MsgInfo( internal class MsgInfo(
@ProtoId(0) val lFromUin: Long? = 0L, @SerialId(0) val lFromUin: Long? = 0L,
@ProtoId(1) val uMsgTime: Long? = 0L, @SerialId(1) val uMsgTime: Long? = 0L,
@ProtoId(2) val shMsgType: Short, @SerialId(2) val shMsgType: Short,
@ProtoId(3) val shMsgSeq: Short, @SerialId(3) val shMsgSeq: Short,
@ProtoId(4) val strMsg: String?, @SerialId(4) val strMsg: String?,
@ProtoId(5) val uRealMsgTime: Int?, @SerialId(5) val uRealMsgTime: Int?,
@ProtoId(6) val vMsg: ByteArray?, @SerialId(6) val vMsg: ByteArray?,
@ProtoId(7) val uAppShareID: Long?, @SerialId(7) val uAppShareID: Long?,
@ProtoId(8) val vMsgCookies: ByteArray? = EMPTY_BYTE_ARRAY, @SerialId(8) val vMsgCookies: ByteArray? = EMPTY_BYTE_ARRAY,
@ProtoId(9) val vAppShareCookie: ByteArray? = EMPTY_BYTE_ARRAY, @SerialId(9) val vAppShareCookie: ByteArray? = EMPTY_BYTE_ARRAY,
@ProtoId(10) val lMsgUid: Long?, @SerialId(10) val lMsgUid: Long?,
@ProtoId(11) val lLastChangeTime: Long?, @SerialId(11) val lLastChangeTime: Long?,
@ProtoId(12) val vCPicInfo: List<CPicInfo>?, @SerialId(12) val vCPicInfo: List<CPicInfo>?,
@ProtoId(13) val stShareData: ShareData?, @SerialId(13) val stShareData: ShareData?,
@ProtoId(14) val lFromInstId: Long?, @SerialId(14) val lFromInstId: Long?,
@ProtoId(15) val vRemarkOfSender: ByteArray?, @SerialId(15) val vRemarkOfSender: ByteArray?,
@ProtoId(16) val strFromMobile: String?, @SerialId(16) val strFromMobile: String?,
@ProtoId(17) val strFromName: String?, @SerialId(17) val strFromName: String?,
@ProtoId(18) val vNickName: List<String>?//, @SerialId(18) val vNickName: List<String>?//,
//@SerialId(19) val stC2CTmpMsgHead: TempMsgHead? //@SerialId(19) val stC2CTmpMsgHead: TempMsgHead?
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class ShareData( internal class ShareData(
@ProtoId(0) val pkgname: String = "", @SerialId(0) val pkgname: String = "",
@ProtoId(1) val msgtail: String = "", @SerialId(1) val msgtail: String = "",
@ProtoId(2) val picurl: String = "", @SerialId(2) val picurl: String = "",
@ProtoId(3) val url: String = "" @SerialId(3) val url: String = ""
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class TempMsgHead( internal class TempMsgHead(
@ProtoId(0) val c2c_type: Int? = 0, @SerialId(0) val c2c_type: Int? = 0,
@ProtoId(1) val serviceType: Int? = 0 @SerialId(1) val serviceType: Int? = 0
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class CPicInfo( internal class CPicInfo(
@ProtoId(0) val vPath: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(0) val vPath: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(1) val vHost: ByteArray? = EMPTY_BYTE_ARRAY @SerialId(1) val vHost: ByteArray? = EMPTY_BYTE_ARRAY
) : JceStruct ) : JceStruct
\ No newline at end of file
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.jce package net.mamoe.mirai.qqandroid.network.protocol.data.jce
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.JceStruct
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...@@ -18,29 +18,29 @@ private val EMPTY_MAP = mapOf<String, String>() ...@@ -18,29 +18,29 @@ private val EMPTY_MAP = mapOf<String, String>()
@Serializable @Serializable
internal class RequestPacket( internal class RequestPacket(
@ProtoId(1) val iVersion: Short = 3, @SerialId(1) val iVersion: Short = 3,
@ProtoId(2) val cPacketType: Byte = 0, @SerialId(2) val cPacketType: Byte = 0,
@ProtoId(3) val iMessageType: Int = 0, @SerialId(3) val iMessageType: Int = 0,
@ProtoId(4) val iRequestId: Int, @SerialId(4) val iRequestId: Int,
@ProtoId(5) val sServantName: String = "", @SerialId(5) val sServantName: String = "",
@ProtoId(6) val sFuncName: String = "", @SerialId(6) val sFuncName: String = "",
@ProtoId(7) val sBuffer: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(7) val sBuffer: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(8) val iTimeout: Int? = 0, @SerialId(8) val iTimeout: Int? = 0,
@ProtoId(9) val context: Map<String, String>? = EMPTY_MAP, @SerialId(9) val context: Map<String, String>? = EMPTY_MAP,
@ProtoId(10) val status: Map<String, String>? = EMPTY_MAP @SerialId(10) val status: Map<String, String>? = EMPTY_MAP
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class RequestDataVersion3( internal class RequestDataVersion3(
@ProtoId(0) val map: Map<String, ByteArray> // 注意: ByteArray 不能直接放序列化的 JceStruct!! 要放类似 RequestDataStructSvcReqRegister 的 @SerialId(0) val map: Map<String, ByteArray> // 注意: ByteArray 不能直接放序列化的 JceStruct!! 要放类似 RequestDataStructSvcReqRegister 的
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class RequestDataVersion2( internal class RequestDataVersion2(
@ProtoId(0) val map: Map<String, Map<String, ByteArray>> @SerialId(0) val map: Map<String, Map<String, ByteArray>>
) : JceStruct ) : JceStruct
@Serializable @Serializable
internal class RequestDataStructSvcReqRegister( internal class RequestDataStructSvcReqRegister(
@ProtoId(0) val struct: SvcReqRegister @SerialId(0) val struct: SvcReqRegister
) : JceStruct ) : JceStruct
\ No newline at end of file
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.jce package net.mamoe.mirai.qqandroid.network.protocol.data.jce
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.JceStruct
@Serializable @Serializable
internal class RequestPushForceOffline( internal class RequestPushForceOffline(
@ProtoId(0) val uin: Long, @SerialId(0) val uin: Long,
@ProtoId(1) val title: String? = "", @SerialId(1) val title: String? = "",
@ProtoId(2) val tips: String? = "", @SerialId(2) val tips: String? = "",
@ProtoId(3) val sameDevice: Byte? = null @SerialId(3) val sameDevice: Byte? = null
) : JceStruct ) : JceStruct
\ No newline at end of file
...@@ -9,47 +9,47 @@ ...@@ -9,47 +9,47 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.jce package net.mamoe.mirai.qqandroid.network.protocol.data.jce
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.JceStruct
@Serializable @Serializable
internal class SvcReqRegister( internal class SvcReqRegister(
@ProtoId(0) val lUin: Long = 0L, @SerialId(0) val lUin: Long = 0L,
@ProtoId(1) val lBid: Long = 0L, @SerialId(1) val lBid: Long = 0L,
@ProtoId(2) val cConnType: Byte = 0, @SerialId(2) val cConnType: Byte = 0,
@ProtoId(3) val sOther: String = "", @SerialId(3) val sOther: String = "",
@ProtoId(4) val iStatus: Int = 11, @SerialId(4) val iStatus: Int = 11,
@ProtoId(5) val bOnlinePush: Byte = 0, @SerialId(5) val bOnlinePush: Byte = 0,
@ProtoId(6) val bIsOnline: Byte = 0, @SerialId(6) val bIsOnline: Byte = 0,
@ProtoId(7) val bIsShowOnline: Byte = 0, @SerialId(7) val bIsShowOnline: Byte = 0,
@ProtoId(8) val bKikPC: Byte = 0, @SerialId(8) val bKikPC: Byte = 0,
@ProtoId(9) val bKikWeak: Byte = 0, @SerialId(9) val bKikWeak: Byte = 0,
@ProtoId(10) val timeStamp: Long = 0L, @SerialId(10) val timeStamp: Long = 0L,
@ProtoId(11) val iOSVersion: Long = 0L, @SerialId(11) val iOSVersion: Long = 0L,
@ProtoId(12) val cNetType: Byte = 0, @SerialId(12) val cNetType: Byte = 0,
@ProtoId(13) val sBuildVer: String? = "", @SerialId(13) val sBuildVer: String? = "",
@ProtoId(14) val bRegType: Byte = 0, @SerialId(14) val bRegType: Byte = 0,
@ProtoId(15) val vecDevParam: ByteArray? = null, @SerialId(15) val vecDevParam: ByteArray? = null,
@ProtoId(16) val vecGuid: ByteArray? = null, @SerialId(16) val vecGuid: ByteArray? = null,
@ProtoId(17) val iLocaleID: Int = 2052, @SerialId(17) val iLocaleID: Int = 2052,
@ProtoId(18) val bSlientPush: Byte = 0, @SerialId(18) val bSlientPush: Byte = 0,
@ProtoId(19) val strDevName: String? = null, @SerialId(19) val strDevName: String? = null,
@ProtoId(20) val strDevType: String? = null, @SerialId(20) val strDevType: String? = null,
@ProtoId(21) val strOSVer: String? = null, @SerialId(21) val strOSVer: String? = null,
@ProtoId(22) val bOpenPush: Byte = 1, @SerialId(22) val bOpenPush: Byte = 1,
@ProtoId(23) val iLargeSeq: Long = 0L, @SerialId(23) val iLargeSeq: Long = 0L,
@ProtoId(24) val iLastWatchStartTime: Long = 0L, @SerialId(24) val iLastWatchStartTime: Long = 0L,
@ProtoId(26) val uOldSSOIp: Long = 0L, @SerialId(26) val uOldSSOIp: Long = 0L,
@ProtoId(27) val uNewSSOIp: Long = 0L, @SerialId(27) val uNewSSOIp: Long = 0L,
@ProtoId(28) val sChannelNo: String? = null, @SerialId(28) val sChannelNo: String? = null,
@ProtoId(29) val lCpId: Long = 0L, @SerialId(29) val lCpId: Long = 0L,
@ProtoId(30) val strVendorName: String? = null, @SerialId(30) val strVendorName: String? = null,
@ProtoId(31) val strVendorOSName: String? = null, @SerialId(31) val strVendorOSName: String? = null,
@ProtoId(32) val strIOSIdfa: String? = null, @SerialId(32) val strIOSIdfa: String? = null,
@ProtoId(33) val bytes_0x769_reqbody: ByteArray? = null, @SerialId(33) val bytes_0x769_reqbody: ByteArray? = null,
@ProtoId(34) val bIsSetStatus: Byte = 0, @SerialId(34) val bIsSetStatus: Byte = 0,
@ProtoId(35) val vecServerBuf: ByteArray? = null, @SerialId(35) val vecServerBuf: ByteArray? = null,
@ProtoId(36) val bSetMute: Byte = 0 @SerialId(36) val bSetMute: Byte = 0
// @SerialId(25) var vecBindUin: ArrayList<*>? = null // ?? 未知泛型 // @SerialId(25) var vecBindUin: ArrayList<*>? = null // ?? 未知泛型
) : JceStruct ) : JceStruct
\ No newline at end of file
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.proto package net.mamoe.mirai.qqandroid.network.protocol.data.proto
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import kotlinx.serialization.protobuf.ProtoNumberType import kotlinx.serialization.protobuf.ProtoNumberType
import kotlinx.serialization.protobuf.ProtoType import kotlinx.serialization.protobuf.ProtoType
import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.io.ProtoBuf
...@@ -22,74 +22,74 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY ...@@ -22,74 +22,74 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
class Oidb0x858 : ProtoBuf { class Oidb0x858 : ProtoBuf {
@Serializable @Serializable
class GoldMsgTipsElem( class GoldMsgTipsElem(
@ProtoId(1) val type: Int = 0, @SerialId(1) val type: Int = 0,
@ProtoId(2) val billno: String = "", @SerialId(2) val billno: String = "",
@ProtoId(3) val result: Int = 0, @SerialId(3) val result: Int = 0,
@ProtoId(4) val amount: Int = 0, @SerialId(4) val amount: Int = 0,
@ProtoId(5) val total: Int = 0, @SerialId(5) val total: Int = 0,
@ProtoId(6) val interval: Int = 0, @SerialId(6) val interval: Int = 0,
@ProtoId(7) val finish: Int = 0, @SerialId(7) val finish: Int = 0,
@ProtoId(8) val uin: List<Long>? = null, @SerialId(8) val uin: List<Long>? = null,
@ProtoId(9) val action: Int = 0 @SerialId(9) val action: Int = 0
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class MessageRecallReminder( class MessageRecallReminder(
@ProtoId(1) val uin: Long = 0L, @SerialId(1) val uin: Long = 0L,
@ProtoId(2) val nickname: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(2) val nickname: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(3) val recalledMsgList: List<MessageMeta> = listOf(), @SerialId(3) val recalledMsgList: List<MessageMeta> = listOf(),
@ProtoId(4) val reminderContent: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(4) val reminderContent: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(5) val userdef: ByteArray = EMPTY_BYTE_ARRAY @SerialId(5) val userdef: ByteArray = EMPTY_BYTE_ARRAY
) : ProtoBuf { ) : ProtoBuf {
@Serializable @Serializable
class MessageMeta( class MessageMeta(
@ProtoId(1) val seq: Int = 0, @SerialId(1) val seq: Int = 0,
@ProtoId(2) val time: Int = 0, @SerialId(2) val time: Int = 0,
@ProtoId(3) val msgRandom: Int = 0 @SerialId(3) val msgRandom: Int = 0
) : ProtoBuf ) : ProtoBuf
} }
@Serializable @Serializable
class NotifyMsgBody( class NotifyMsgBody(
@ProtoId(1) val optEnumType: Int /* enum */ = 5, @SerialId(1) val optEnumType: Int /* enum */ = 5,
@ProtoId(2) val optUint64MsgTime: Long = 0L, @SerialId(2) val optUint64MsgTime: Long = 0L,
@ProtoId(3) val optUint64MsgExpires: Long = 0L, @SerialId(3) val optUint64MsgExpires: Long = 0L,
@ProtoId(4) val optUint64ConfUin: Long = 0L, @SerialId(4) val optUint64ConfUin: Long = 0L,
@ProtoId(5) val optMsgRedtips: RedGrayTipsInfo? = null, @SerialId(5) val optMsgRedtips: RedGrayTipsInfo? = null,
@ProtoId(6) val optMsgRecallReminder: MessageRecallReminder? = null, @SerialId(6) val optMsgRecallReminder: MessageRecallReminder? = null,
@ProtoId(7) val optMsgObjUpdate: NotifyObjmsgUpdate? = null, @SerialId(7) val optMsgObjUpdate: NotifyObjmsgUpdate? = null,
// @SerialId(8) val optStcmGameState: ApolloGameStatus.STCMGameMessage? = null, // @SerialId(8) val optStcmGameState: ApolloGameStatus.STCMGameMessage? = null,
// @SerialId(9) val aplloMsgPush: ApolloPushMsgInfo.STPushMsgElem? = null, // @SerialId(9) val aplloMsgPush: ApolloPushMsgInfo.STPushMsgElem? = null,
@ProtoId(10) val optMsgGoldtips: GoldMsgTipsElem? = null @SerialId(10) val optMsgGoldtips: GoldMsgTipsElem? = null
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class NotifyObjmsgUpdate( class NotifyObjmsgUpdate(
@ProtoId(1) val objmsgId: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(1) val objmsgId: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(2) val updateType: Int = 0, @SerialId(2) val updateType: Int = 0,
@ProtoId(3) val extMsg: ByteArray = EMPTY_BYTE_ARRAY @SerialId(3) val extMsg: ByteArray = EMPTY_BYTE_ARRAY
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class RedGrayTipsInfo( class RedGrayTipsInfo(
@ProtoId(1) val optUint32ShowLastest: Int = 0, @SerialId(1) val optUint32ShowLastest: Int = 0,
@ProtoId(2) val senderUin: Long = 0L, @SerialId(2) val senderUin: Long = 0L,
@ProtoId(3) val receiverUin: Long = 0L, @SerialId(3) val receiverUin: Long = 0L,
@ProtoId(4) val senderRichContent: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(4) val senderRichContent: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(5) val receiverRichContent: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(5) val receiverRichContent: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(6) val authkey: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(6) val authkey: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoType(ProtoNumberType.SIGNED) @ProtoId(7) val sint32Msgtype: Int = 0, @ProtoType(ProtoNumberType.SIGNED) @SerialId(7) val sint32Msgtype: Int = 0,
@ProtoId(8) val luckyFlag: Int = 0, @SerialId(8) val luckyFlag: Int = 0,
@ProtoId(9) val hideFlag: Int = 0, @SerialId(9) val hideFlag: Int = 0,
@ProtoId(10) val pcBody: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(10) val pcBody: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(11) val icon: Int = 0, @SerialId(11) val icon: Int = 0,
@ProtoId(12) val luckyUin: Long = 0L, @SerialId(12) val luckyUin: Long = 0L,
@ProtoId(13) val time: Int = 0, @SerialId(13) val time: Int = 0,
@ProtoId(14) val random: Int = 0, @SerialId(14) val random: Int = 0,
@ProtoId(15) val broadcastRichContent: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(15) val broadcastRichContent: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(16) val idiom: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(16) val idiom: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(17) val idiomSeq: Int = 0, @SerialId(17) val idiomSeq: Int = 0,
@ProtoId(18) val idiomAlpha: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(18) val idiomAlpha: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(19) val jumpurl: ByteArray = EMPTY_BYTE_ARRAY @SerialId(19) val jumpurl: ByteArray = EMPTY_BYTE_ARRAY
) : ProtoBuf ) : ProtoBuf
} }
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.proto package net.mamoe.mirai.qqandroid.network.protocol.data.proto
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.io.ProtoBuf
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...@@ -18,40 +18,40 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY ...@@ -18,40 +18,40 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
internal class Vec0xd50 : ProtoBuf { internal class Vec0xd50 : ProtoBuf {
@Serializable @Serializable
internal class ExtSnsFrdData( internal class ExtSnsFrdData(
@ProtoId(1) val frdUin: Long = 0L, @SerialId(1) val frdUin: Long = 0L,
@ProtoId(91001) val musicSwitch: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(91001) val musicSwitch: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(101001) val mutualmarkAlienation: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(101001) val mutualmarkAlienation: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(141001) val mutualmarkScore: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(141001) val mutualmarkScore: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(151001) val ksingSwitch: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(151001) val ksingSwitch: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(181001) val lbsShare: ByteArray = EMPTY_BYTE_ARRAY @SerialId(181001) val lbsShare: ByteArray = EMPTY_BYTE_ARRAY
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
internal class RspBody( internal class RspBody(
@ProtoId(1) val msgUpdateData: List<Vec0xd50.ExtSnsFrdData>? = null, @SerialId(1) val msgUpdateData: List<Vec0xd50.ExtSnsFrdData>? = null,
@ProtoId(11) val over: Int = 0, @SerialId(11) val over: Int = 0,
@ProtoId(12) val nextStart: Int = 0, @SerialId(12) val nextStart: Int = 0,
@ProtoId(13) val uint64UnfinishedUins: List<Long>? = null @SerialId(13) val uint64UnfinishedUins: List<Long>? = null
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
internal class ReqBody( internal class ReqBody(
@ProtoId(1) val appid: Long = 0L, @SerialId(1) val appid: Long = 0L,
@ProtoId(2) val maxPkgSize: Int = 0, @SerialId(2) val maxPkgSize: Int = 0,
@ProtoId(3) val startTime: Int = 0, @SerialId(3) val startTime: Int = 0,
@ProtoId(4) val startIndex: Int = 0, @SerialId(4) val startIndex: Int = 0,
@ProtoId(5) val reqNum: Int = 0, @SerialId(5) val reqNum: Int = 0,
@ProtoId(6) val uinList: List<Long>? = null, @SerialId(6) val uinList: List<Long>? = null,
@ProtoId(91001) val reqMusicSwitch: Int = 0, @SerialId(91001) val reqMusicSwitch: Int = 0,
@ProtoId(101001) val reqMutualmarkAlienation: Int = 0, @SerialId(101001) val reqMutualmarkAlienation: Int = 0,
@ProtoId(141001) val reqMutualmarkScore: Int = 0, @SerialId(141001) val reqMutualmarkScore: Int = 0,
@ProtoId(151001) val reqKsingSwitch: Int = 0, @SerialId(151001) val reqKsingSwitch: Int = 0,
@ProtoId(181001) val reqMutualmarkLbsshare: Int = 0 @SerialId(181001) val reqMutualmarkLbsshare: Int = 0
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
internal class KSingRelationInfo( internal class KSingRelationInfo(
@ProtoId(1) val flag: Int = 0 @SerialId(1) val flag: Int = 0
) : ProtoBuf ) : ProtoBuf
} }
...@@ -59,21 +59,21 @@ internal class Vec0xd50 : ProtoBuf { ...@@ -59,21 +59,21 @@ internal class Vec0xd50 : ProtoBuf {
internal class Vec0xd6b : ProtoBuf { internal class Vec0xd6b : ProtoBuf {
@Serializable @Serializable
internal class ReqBody( internal class ReqBody(
@ProtoId(1) val maxPkgSize: Int = 0, @SerialId(1) val maxPkgSize: Int = 0,
@ProtoId(2) val startTime: Int = 0, @SerialId(2) val startTime: Int = 0,
@ProtoId(11) val uinList: List<Long>? = null @SerialId(11) val uinList: List<Long>? = null
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
internal class RspBody( internal class RspBody(
@ProtoId(11) val msgMutualmarkData: List<Vec0xd6b.MutualMarkData>? = null, @SerialId(11) val msgMutualmarkData: List<Vec0xd6b.MutualMarkData>? = null,
@ProtoId(12) val uint64UnfinishedUins: List<Long>? = null @SerialId(12) val uint64UnfinishedUins: List<Long>? = null
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
internal class MutualMarkData( internal class MutualMarkData(
@ProtoId(1) val frdUin: Long = 0L, @SerialId(1) val frdUin: Long = 0L,
@ProtoId(2) val result: Int = 0 @SerialId(2) val result: Int = 0
// @SerialId(11) val mutualmarkInfo: List<Mutualmark.MutualMark>? = null // @SerialId(11) val mutualmarkInfo: List<Mutualmark.MutualMark>? = null
) : ProtoBuf ) : ProtoBuf
} }
...@@ -82,26 +82,26 @@ internal class Vec0xd6b : ProtoBuf { ...@@ -82,26 +82,26 @@ internal class Vec0xd6b : ProtoBuf {
internal class Mutualmark : ProtoBuf { internal class Mutualmark : ProtoBuf {
@Serializable @Serializable
internal class MutualmarkInfo( internal class MutualmarkInfo(
@ProtoId(1) val lastActionTime: Long = 0L, @SerialId(1) val lastActionTime: Long = 0L,
@ProtoId(2) val level: Int = 0, @SerialId(2) val level: Int = 0,
@ProtoId(3) val lastChangeTime: Long = 0L, @SerialId(3) val lastChangeTime: Long = 0L,
@ProtoId(4) val continueDays: Int = 0, @SerialId(4) val continueDays: Int = 0,
@ProtoId(5) val wildcardWording: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(5) val wildcardWording: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(6) val notifyTime: Long = 0L, @SerialId(6) val notifyTime: Long = 0L,
@ProtoId(7) val iconStatus: Long = 0L, @SerialId(7) val iconStatus: Long = 0L,
@ProtoId(8) val iconStatusEndTime: Long = 0L, @SerialId(8) val iconStatusEndTime: Long = 0L,
@ProtoId(9) val closeFlag: Int = 0, @SerialId(9) val closeFlag: Int = 0,
@ProtoId(10) val resourceInfo: ByteArray = EMPTY_BYTE_ARRAY @SerialId(10) val resourceInfo: ByteArray = EMPTY_BYTE_ARRAY
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
internal class ResourceInfo17( internal class ResourceInfo17(
@ProtoId(1) val dynamicUrl: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(1) val dynamicUrl: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(2) val staticUrl: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(2) val staticUrl: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(3) val cartoonUrl: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(3) val cartoonUrl: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(4) val cartoonMd5: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(4) val cartoonMd5: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(5) val playCartoon: Int = 0, @SerialId(5) val playCartoon: Int = 0,
@ProtoId(6) val word: ByteArray = EMPTY_BYTE_ARRAY @SerialId(6) val word: ByteArray = EMPTY_BYTE_ARRAY
) : ProtoBuf ) : ProtoBuf
} }
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.proto package net.mamoe.mirai.qqandroid.network.protocol.data.proto
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.io.ProtoBuf
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...@@ -18,51 +18,51 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY ...@@ -18,51 +18,51 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
class GroupLabel : ProtoBuf { class GroupLabel : ProtoBuf {
@Serializable @Serializable
class Label( class Label(
@ProtoId(1) val name: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(1) val name: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(2) val enumType: Int /* enum */ = 1, @SerialId(2) val enumType: Int /* enum */ = 1,
@ProtoId(3) val textColor: GroupLabel.Color? = null, @SerialId(3) val textColor: GroupLabel.Color? = null,
@ProtoId(4) val edgingColor: GroupLabel.Color? = null, @SerialId(4) val edgingColor: GroupLabel.Color? = null,
@ProtoId(5) val labelAttr: Int = 0, @SerialId(5) val labelAttr: Int = 0,
@ProtoId(6) val labelType: Int = 0 @SerialId(6) val labelType: Int = 0
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class RspBody( class RspBody(
@ProtoId(1) val error: ByteArray = EMPTY_BYTE_ARRAY, @SerialId(1) val error: ByteArray = EMPTY_BYTE_ARRAY,
@ProtoId(2) val groupInfo: List<GroupLabel.GroupInfo>? = null @SerialId(2) val groupInfo: List<GroupLabel.GroupInfo>? = null
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class SourceId( class SourceId(
@ProtoId(1) val sourceId: Int = 0 @SerialId(1) val sourceId: Int = 0
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class GroupInfo( class GroupInfo(
@ProtoId(1) val int32Result: Int = 0, @SerialId(1) val int32Result: Int = 0,
@ProtoId(2) val groupCode: Long = 0L, @SerialId(2) val groupCode: Long = 0L,
@ProtoId(3) val groupLabel: List<GroupLabel.Label>? = null @SerialId(3) val groupLabel: List<GroupLabel.Label>? = null
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class Color( class Color(
@ProtoId(1) val r: Int = 0, @SerialId(1) val r: Int = 0,
@ProtoId(2) val g: Int = 0, @SerialId(2) val g: Int = 0,
@ProtoId(3) val b: Int = 0 @SerialId(3) val b: Int = 0
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class ReqBody( class ReqBody(
@ProtoId(1) val sourceId: GroupLabel.SourceId? = null, @SerialId(1) val sourceId: GroupLabel.SourceId? = null,
@ProtoId(2) val uinInfo: GroupLabel.UinInfo? = null, @SerialId(2) val uinInfo: GroupLabel.UinInfo? = null,
@ProtoId(3) val numberLabel: Int = 5, @SerialId(3) val numberLabel: Int = 5,
@ProtoId(4) val groupCode: List<Long>? = null, @SerialId(4) val groupCode: List<Long>? = null,
@ProtoId(5) val labelStyle: Int = 0 @SerialId(5) val labelStyle: Int = 0
) : ProtoBuf ) : ProtoBuf
@Serializable @Serializable
class UinInfo( class UinInfo(
@ProtoId(1) val int64Longitude: Long = 0L, @SerialId(1) val int64Longitude: Long = 0L,
@ProtoId(2) val int64Latitude: Long = 0L @SerialId(2) val int64Latitude: Long = 0L
) : ProtoBuf ) : ProtoBuf
} }
\ No newline at end of file
...@@ -9,23 +9,23 @@ ...@@ -9,23 +9,23 @@
package net.mamoe.mirai.qqandroid.network.protocol.data.proto package net.mamoe.mirai.qqandroid.network.protocol.data.proto
import kotlinx.serialization.SerialId
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoId
import net.mamoe.mirai.qqandroid.io.ProtoBuf import net.mamoe.mirai.qqandroid.io.ProtoBuf
import kotlin.math.absoluteValue import kotlin.math.absoluteValue
import kotlin.random.Random import kotlin.random.Random
@Serializable @Serializable
class SyncCookie( class SyncCookie(
@ProtoId(1) val time1: Long? = null, // 1580277992 @SerialId(1) val time1: Long? = null, // 1580277992
@ProtoId(2) val time: Long, // 1580277992 @SerialId(2) val time: Long, // 1580277992
@ProtoId(3) val unknown1: Long = Random.nextLong().absoluteValue,// 678328038 @SerialId(3) val unknown1: Long = Random.nextLong().absoluteValue,// 678328038
@ProtoId(4) val unknown2: Long = Random.nextLong().absoluteValue, // 1687142153 @SerialId(4) val unknown2: Long = Random.nextLong().absoluteValue, // 1687142153
@ProtoId(5) val const1: Long = const1_, // 1458467940 @SerialId(5) val const1: Long = const1_, // 1458467940
@ProtoId(11) val const2: Long = const2_, // 2683038258 @SerialId(11) val const2: Long = const2_, // 2683038258
@ProtoId(12) val unknown3: Long = 0x1d, @SerialId(12) val unknown3: Long = 0x1d,
@ProtoId(13) val lastSyncTime: Long? = null, @SerialId(13) val lastSyncTime: Long? = null,
@ProtoId(14) val unknown4: Long = 0 @SerialId(14) val unknown4: Long = 0
) : ProtoBuf ) : ProtoBuf
private val const1_: Long = Random.nextLong().absoluteValue private val const1_: Long = Random.nextLong().absoluteValue
......
This diff is collapsed.
...@@ -52,5 +52,5 @@ data class BotAccount( ...@@ -52,5 +52,5 @@ data class BotAccount(
@MiraiInternalAPI @MiraiInternalAPI
@Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE)
@Target(CLASS, TYPEALIAS, FUNCTION, PROPERTY, FIELD, CONSTRUCTOR) @Target(CLASS, TYPEALIAS, FUNCTION, PROPERTY, FIELD, CONSTRUCTOR)
@RequiresOptIn(level = RequiresOptIn.Level.WARNING) @Experimental(level = Experimental.Level.WARNING)
annotation class RawAccountIdUse annotation class RawAccountIdUse
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment