mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-07 16:40:43 +08:00
fix build
This commit is contained in:
parent
9ac0a8715c
commit
03e12eb287
@ -559,7 +559,12 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
}
|
||||
}
|
||||
// bot.network.logger.error(rep)
|
||||
return bot.json.decodeFromString(GroupAnnouncementList.serializer(), rep)
|
||||
return json.decodeFromString(GroupAnnouncementList.serializer(), rep)
|
||||
}
|
||||
|
||||
private val json = Json {
|
||||
ignoreUnknownKeys = true
|
||||
isLenient = true
|
||||
}
|
||||
|
||||
@LowLevelApi
|
||||
|
@ -81,7 +81,7 @@ internal class QQAndroidBot constructor(
|
||||
|
||||
// TODO: 2021/4/14 bdhSyncer.loadFromCache() when login
|
||||
|
||||
private val components: ConcurrentComponentStorage by lazy {
|
||||
internal val components: ConcurrentComponentStorage by lazy {
|
||||
ConcurrentComponentStorage().apply {
|
||||
set(
|
||||
SsoProcessor,
|
||||
|
@ -21,7 +21,9 @@ import kotlinx.io.core.buildPacket
|
||||
import kotlinx.io.core.discardExact
|
||||
import kotlinx.io.core.writeFully
|
||||
import net.mamoe.mirai.internal.QQAndroidBot
|
||||
import net.mamoe.mirai.internal.asQQAndroidBot
|
||||
import net.mamoe.mirai.internal.network.QQAndroidClient
|
||||
import net.mamoe.mirai.internal.network.handler.components.BdhSessionSyncer
|
||||
import net.mamoe.mirai.internal.network.handler.context.BdhSession
|
||||
import net.mamoe.mirai.internal.network.handler.logger
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.CSDataHighwayHead
|
||||
@ -71,7 +73,7 @@ internal object Highway {
|
||||
localeId: Int = 2052,
|
||||
): BdhUploadResponse {
|
||||
val bdhSession = kotlin.runCatching {
|
||||
val deferred = bot.bdhSyncer.bdhSession
|
||||
val deferred = bot.asQQAndroidBot().components[BdhSessionSyncer].bdhSession
|
||||
// no need to care about timeout. proceed by bot init
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
if (noBdhAwait) deferred.getCompleted() else deferred.await()
|
||||
|
@ -19,7 +19,9 @@ import net.mamoe.mirai.event.events.BotOfflineEvent
|
||||
import net.mamoe.mirai.internal.QQAndroidBot
|
||||
import net.mamoe.mirai.internal.message.contextualBugReportException
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.internal.network.handler.components.BdhSessionSyncer
|
||||
import net.mamoe.mirai.internal.network.handler.components.ServerAddress
|
||||
import net.mamoe.mirai.internal.network.handler.components.ServerList
|
||||
import net.mamoe.mirai.internal.network.handler.context.BdhSession
|
||||
import net.mamoe.mirai.internal.network.handler.logger
|
||||
import net.mamoe.mirai.internal.network.networkType
|
||||
@ -87,6 +89,8 @@ internal class ConfigPushSvc {
|
||||
}
|
||||
|
||||
override suspend fun QQAndroidBot.handle(packet: PushReqResponse, sequenceId: Int): OutgoingPacket? {
|
||||
val bdhSyncer = bot.components[BdhSessionSyncer]
|
||||
|
||||
fun handleConfigPush(packet: PushReqResponse.ConfigPush) {
|
||||
val pushReq = packet.struct
|
||||
|
||||
@ -94,9 +98,10 @@ internal class ConfigPushSvc {
|
||||
val fileStoragePushFSSvcList = pushReq.jcebuf.loadAs(FileStoragePushFSSvcList.serializer())
|
||||
bot.client.fileStoragePushFSSvcList = fileStoragePushFSSvcList
|
||||
|
||||
|
||||
val bigDataChannel = fileStoragePushFSSvcList.bigDataChannel
|
||||
if (bigDataChannel?.vBigdataPbBuf == null) {
|
||||
bot.bdhSyncer.bdhSession.completeExceptionally(IllegalStateException("BdhSession not received."))
|
||||
bdhSyncer.bdhSession.completeExceptionally(IllegalStateException("BdhSession not received."))
|
||||
return
|
||||
}
|
||||
|
||||
@ -149,10 +154,11 @@ internal class ConfigPushSvc {
|
||||
bot.network.logger.info { "Server list: ${pushServerList.joinToString()}." }
|
||||
|
||||
if (pushServerList.isNotEmpty()) {
|
||||
bot.serverListNew.setPreferred(pushServerList.shuffled().map { ServerAddress(it.host, it.port) })
|
||||
bot.components[ServerList].setPreferred(
|
||||
pushServerList.shuffled().map { ServerAddress(it.host, it.port) })
|
||||
}
|
||||
bot.bdhSyncer.saveToCache()
|
||||
bot.bdhSyncer.saveServerListToCache()
|
||||
bdhSyncer.saveToCache()
|
||||
bdhSyncer.saveServerListToCache()
|
||||
if (serverListPush.reconnectNeeded == 1) {
|
||||
bot.logger.info { "Server request to change server." }
|
||||
bot.launch {
|
||||
|
@ -28,6 +28,7 @@ import net.mamoe.mirai.internal.contact.appId
|
||||
import net.mamoe.mirai.internal.createOtherClient
|
||||
import net.mamoe.mirai.internal.message.contextualBugReportException
|
||||
import net.mamoe.mirai.internal.network.*
|
||||
import net.mamoe.mirai.internal.network.handler.components.ContactCacheService
|
||||
import net.mamoe.mirai.internal.network.protocol.data.jce.*
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.Oidb0x769
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.StatSvcGetOnline
|
||||
@ -136,7 +137,7 @@ internal class StatSvc {
|
||||
client: QQAndroidClient,
|
||||
regPushReason: RegPushReason = RegPushReason.appRegister
|
||||
) = impl(client, 1 or 2 or 4, client.onlineStatus, regPushReason) {
|
||||
client.bot.friendListCache?.let { friendListCache: FriendListCache ->
|
||||
client.bot.components[ContactCacheService].friendListCache?.let { friendListCache: FriendListCache ->
|
||||
iLargeSeq = friendListCache.friendListSeq
|
||||
// timeStamp = friendListCache.timeStamp
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user