From 5d81ff26803327628287360ff60856d442053939 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sun, 12 Jan 2020 00:15:25 +0800 Subject: [PATCH] Cleanup --- .../mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt | 9 +-------- .../network/protocol/packet/login/LoginPacket.kt | 2 +- .../src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt index 5efc81679..7c78eb00d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt @@ -16,7 +16,6 @@ import kotlin.random.Random */ inline class Tlv(val value: ByteArray) -@Suppress("MemberVisibilityCanBePrivate") fun BytePacketBuilder.t1(uin: Long, ip: String) { writeShort(0x1) writeShortLVPacket { @@ -618,10 +617,4 @@ private fun Boolean.toByte(): Byte = if (this) 1 else 0 private fun Boolean.toInt(): Int = if (this) 1 else 0 private infix fun Int.shouldEqualsTo(int: Int) = check(this == int) { "Required $int, but found $this" } -private infix fun ByteArray.requireSize(exactSize: Int) = check(this.size == exactSize) { "Required size $exactSize, but found ${this.size}" } - -fun randomAndroidId(): String = buildString(15) { - repeat(15) { append(Random.nextInt(10)) } -} - -// AndroidDevInfo: oicq.wlogin_sdk.tools.util#get_android_dev_info +private infix fun ByteArray.requireSize(exactSize: Int) = check(this.size == exactSize) { "Required size $exactSize, but found ${this.size}" } \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt index 6cf19c1df..d3081662b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt @@ -41,7 +41,7 @@ internal object LoginPacket : PacketFactory writeOicqRequestPacket(client, EncryptMethodECDH7(client.ecdh), id) { writeShort(9) // subCommand - writeShort(0x17) + writeShort(17) // count of TLVs, probably ignored by server? //writeShort(LoginType.PASSWORD.value.toShort()) t18(appId, client.appClientVersion, client.uin) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt index 0546d81f6..6ef17cebb 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt @@ -10,7 +10,7 @@ import kotlin.annotation.AnnotationTarget.* data class BotAccount( /** - * **注意**: 在 Android 协议, 总是使用 `QQAndroidClient.uin`, 而不要使用 [BotAccount.id]. 将来 [BotAccount.id] 可能会变为 [String] + * **注意**: 在 Android 协议, 总是使用 `QQAndroidClient.uin` 或 [Bot.uin], 而不要使用 [BotAccount.id]. 将来 [BotAccount.id] 可能会变为 [String] */ @MiraiExperimentalAPI val id: Long, @@ -20,7 +20,7 @@ data class BotAccount( } /** - * 标记直接访问 [BotAccount.id], 而不是访问 [Bot.uin] + * 标记直接访问 [BotAccount.id], 而不是访问 [Bot.uin]. 这将可能会不兼容未来的 API 修改. */ @Retention(AnnotationRetention.SOURCE) @Target(CLASS, TYPEALIAS, FUNCTION, PROPERTY, FIELD, CONSTRUCTOR)