diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt index 7721433a1..45bf3761e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt @@ -222,10 +222,16 @@ internal open class QQAndroidClient( ) val pbGetMessageCacheList = SyncingCacheList() - val systemMsgNewGroupCacheList = SyncingCacheList() + + internal data class SystemMsgNewGroupSyncId( + val sequence: Long, + val time: Long + ) + + val systemMsgNewGroupCacheList = SyncingCacheList(10) } - val c2cMessageSync = MessageSvcSyncData() + val syncingController = MessageSvcSyncData() /* * 以下登录使用 diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt index 9e37e2cb5..816949169 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt @@ -83,7 +83,7 @@ internal object MessageSvcPbGetMsg : OutgoingPacketFactory { - bot.client.c2cMessageSync.syncCookie = resp.syncCookie - bot.client.c2cMessageSync.pubAccountCookie = resp.pubAccountCookie + bot.client.syncingController.syncCookie = resp.syncCookie + bot.client.syncingController.pubAccountCookie = resp.pubAccountCookie } 1 -> { - bot.client.c2cMessageSync.syncCookie = resp.syncCookie + bot.client.syncingController.syncCookie = resp.syncCookie } 2 -> { - bot.client.c2cMessageSync.pubAccountCookie = resp.pubAccountCookie + bot.client.syncingController.pubAccountCookie = resp.pubAccountCookie } } @@ -176,7 +176,7 @@ internal object MessageSvcPbGetMsg : OutgoingPacketFactory - if (!bot.client.c2cMessageSync.pbGetMessageCacheList.addCache( + if (!bot.client.syncingController.pbGetMessageCacheList.addCache( QQAndroidClient.MessageSvcSyncData.PbGetMessageSyncId( uid = msg.msgHead.msgUid, sequence = msg.msgHead.msgSeq, @@ -418,7 +418,7 @@ internal object MessageSvcPbGetMsg : OutgoingPacketFactory() } return @@ -429,7 +429,7 @@ internal object MessageSvcPbGetMsg : OutgoingPacketFactory() } return diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt index 414d296ec..0dda51956 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt @@ -80,7 +80,7 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory( override suspend fun QQAndroidBot.handle(packet: RequestPushNotify, sequenceId: Int): OutgoingPacket? { - client.c2cMessageSync.firstNotify.loop { firstNotify -> + client.syncingController.firstNotify.loop { firstNotify -> network.run { return MessageSvcPbGetMsg( client, MsgSvc.SyncFlag.START, if (firstNotify) { - if (!client.c2cMessageSync.firstNotify.compareAndSet(firstNotify, false)) { + if (!client.syncingController.firstNotify.compareAndSet(firstNotify, false)) { return@loop } null