Fix build warnings

This commit is contained in:
Him188 2021-04-08 12:43:19 +08:00
parent 7feeaee1ca
commit 7be14f809c
6 changed files with 16 additions and 12 deletions

@ -1 +1 @@
Subproject commit ffef5c00db95c689ebfefcc92b90a79a28eb423a
Subproject commit 662013e4eced9ac3a1ac8a3c9a68ef8ee7d17ac2

View File

@ -24,7 +24,8 @@ import net.mamoe.mirai.contact.platform
import net.mamoe.mirai.event.*
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.*
import net.mamoe.mirai.internal.contact.logMessageReceived
import net.mamoe.mirai.internal.contact.replaceMagicCodes
import net.mamoe.mirai.internal.createOtherClient
import net.mamoe.mirai.internal.network.*
import net.mamoe.mirai.internal.network.protocol.data.proto.MsgSvc
@ -36,7 +37,10 @@ import net.mamoe.mirai.internal.network.protocol.packet.login.Heartbeat
import net.mamoe.mirai.internal.network.protocol.packet.login.StatSvc
import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin
import net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin.*
import net.mamoe.mirai.internal.utils.*
import net.mamoe.mirai.internal.utils.NoRouteToHostException
import net.mamoe.mirai.internal.utils.PlatformSocket
import net.mamoe.mirai.internal.utils.SocketException
import net.mamoe.mirai.internal.utils.UnknownHostException
import net.mamoe.mirai.network.*
import net.mamoe.mirai.utils.*
import java.util.concurrent.ConcurrentLinkedQueue
@ -800,6 +804,7 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
// CancellationException means network closed so don't retry
) {
withPacketListener(commandName, sequenceId) { listener ->
@Suppress("UNCHECKED_CAST")
return withTimeout(timeoutMillis) { // may throw CancellationException
channel.send(data, 0, data.size)
logger.verbose { "Send: $commandName" }

View File

@ -83,9 +83,9 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory<MessageSvcPbSendMsg.
txtAdd = true
last.add(element)
} else {
val splitted = element.content.chunked(80)
val split = element.content.chunked(80)
flush()
splitted.forEach { results.add(PlainText(it).toMessageChain()) }
split.forEach { results.add(PlainText(it).toMessageChain()) }
}
} else {
last.add(element)
@ -299,7 +299,6 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory<MessageSvcPbSendMsg.
client: QQAndroidClient,
targetMember: Member,
message: MessageChain,
fragmented: Boolean,
source: OnlineMessageSourceToTempImpl
): OutgoingPacket = buildOutgoingUniPacket(client) {
writeProtoBuf(
@ -466,6 +465,7 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory<MessageSvcPbSendMsg.
}
}
@Suppress("UNUSED_PARAMETER")
internal inline fun MessageSvcPbSendMsg.createToTemp(
client: QQAndroidClient,
member: Member,
@ -489,7 +489,6 @@ internal inline fun MessageSvcPbSendMsg.createToTemp(
client,
member,
message,
fragmented,
source
).let { listOf(it) }
}

View File

@ -29,7 +29,6 @@ internal object MessageSvcRequestPushStatus : IncomingPacketFactory<Packet?>(
bot.otherClientsLock.withLock {
val instanceInfo = packet.vecInstanceList?.firstOrNull()
val appId = instanceInfo?.iAppId ?: 1
val platformId = instanceInfo?.iPlatform?.toInt()
return when (packet.status.toInt()) {
1 -> { // online
if (bot.otherClients.any { appId == it.appId }) return null

View File

@ -273,9 +273,9 @@ internal class WtLogin {
tlvMap119[0x118]?.let { client.mainDisplayName = it }
tlvMap119[0x108]?.let { client.ksid = it }
tlvMap119[0x11a]?.read {
val faceId = readShort().toInt()
val age = readByte().toInt()
val gender = readByte().toInt()
readShort().toInt() // faceId
readByte().toInt() // age
readByte().toInt() // gender
val nickLength = readByte().toInt()
bot.nick = readString(nickLength)
}

View File

@ -23,7 +23,7 @@ internal object WtLogin15 : WtLoginExt {
operator fun invoke(
client: QQAndroidClient,
) = WtLogin.ExchangeEmp.buildOutgoingUniPacket(client, bodyType = 2, key = ByteArray(16)) { sequenceId ->
) = WtLogin.ExchangeEmp.buildOutgoingUniPacket(client, bodyType = 2, key = ByteArray(16)) {
// writeSsoPacket(client, client.subAppId, WtLogin.ExchangeEmp.commandName, sequenceId = sequenceId) {
writeOicqRequestPacket(
client,
@ -130,6 +130,7 @@ internal object WtLogin15 : WtLoginExt {
}
}
@Suppress("FunctionName", "SpellCheckingInspection")
internal fun get_mpasswd(): String {
var var5: String
val random = Random()