mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-29 17:20:11 +08:00
Fix FriendListPacket
This commit is contained in:
parent
efb662a978
commit
a2d652b50f
@ -31,6 +31,10 @@ 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])
|
||||||
|
|
||||||
|
override val coroutineContext: CoroutineContext = bot.coroutineContext + CoroutineExceptionHandler { _, throwable ->
|
||||||
|
throwable.logStacktrace("Exception in NetworkHandler")
|
||||||
|
}
|
||||||
|
|
||||||
private lateinit var channel: PlatformSocket
|
private lateinit var channel: PlatformSocket
|
||||||
|
|
||||||
override suspend fun login() {
|
override suspend fun login() {
|
||||||
@ -316,7 +320,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
|||||||
packetListeners.addLast(handler)
|
packetListeners.addLast(handler)
|
||||||
bot.logger.info("Send: ${this.commandName}")
|
bot.logger.info("Send: ${this.commandName}")
|
||||||
channel.send(delegate)
|
channel.send(delegate)
|
||||||
return withTimeoutOrNull(3000) {
|
return withTimeout(3000) {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
handler.await() as E
|
handler.await() as E
|
||||||
} ?: net.mamoe.mirai.qqandroid.utils.inline {
|
} ?: net.mamoe.mirai.qqandroid.utils.inline {
|
||||||
@ -337,6 +341,4 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun awaitDisconnection() = supervisor.join()
|
override suspend fun awaitDisconnection() = supervisor.join()
|
||||||
|
|
||||||
override val coroutineContext: CoroutineContext = bot.coroutineContext
|
|
||||||
}
|
}
|
@ -3,8 +3,6 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce
|
|||||||
import kotlinx.serialization.SerialId
|
import kotlinx.serialization.SerialId
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import net.mamoe.mirai.qqandroid.io.JceStruct
|
import net.mamoe.mirai.qqandroid.io.JceStruct
|
||||||
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Vec0xd50
|
|
||||||
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Vec0xd6b
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
internal class GetFriendListReq(
|
internal class GetFriendListReq(
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user