From 985f368f7d3e7d007d58bbe198395c5c854c95cc Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 19 Feb 2020 13:09:05 +0800 Subject: [PATCH] Fix friend message syncing --- .../qqandroid/network/QQAndroidBotNetworkHandler.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt index 94bc47a07..23d4d8983 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt @@ -189,7 +189,6 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler override suspend fun init(): Unit = coroutineScope { check(bot.isActive) { "bot is dead therefore network can't init" } check(this@QQAndroidBotNetworkHandler.isActive) { "network is dead therefore can't init" } - MessageSvc.PbGetMsg(bot.client, MsgSvc.SyncFlag.START, currentTimeSeconds).sendWithoutExpect() bot.qqs.delegate.clear() bot.groups.delegate.clear() @@ -297,6 +296,8 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler heartbeatJob = startHeartbeatJobOrKill() joinAll(friendListJob, groupJob) + MessageSvc.PbGetMsg(bot.client, MsgSvc.SyncFlag.START, currentTimeSeconds).sendAndExpect() + bot.firstLoginSucceed = true _pendingEnabled.value = false @@ -507,7 +508,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler suspend fun OutgoingPacket.sendWithoutExpect() { check(bot.isActive) { "bot is dead therefore can't send any packet" } check(this@QQAndroidBotNetworkHandler.isActive) { "network is dead therefore can't send any packet" } - logger.info("Send: ${this.commandName}") + logger.verbose("Send: ${this.commandName}") withContext(this@QQAndroidBotNetworkHandler.coroutineContext + CoroutineName("Packet sender")) { channel.send(delegate) } @@ -533,7 +534,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler withContext(this@QQAndroidBotNetworkHandler.coroutineContext + CoroutineName("Packet sender")) { channel.send(delegate) } - logger.info("Send: ${this.commandName}") + logger.verbose("Send: ${this.commandName}") return withTimeoutOrNull(timeoutMillis) { @Suppress("UNCHECKED_CAST") handler.await() as E @@ -552,7 +553,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler withContext(this@QQAndroidBotNetworkHandler.coroutineContext + CoroutineName("Packet sender")) { channel.send(data, 0, length) } - logger.info("Send: ${this.commandName}") + logger.verbose("Send: ${this.commandName}") return withTimeoutOrNull(timeoutMillis) { @Suppress("UNCHECKED_CAST") handler.await() as E