mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 01:30:17 +08:00
Cleanup
This commit is contained in:
parent
a5b82c5e48
commit
f1ac53f115
@ -18,7 +18,7 @@ import net.mamoe.mirai.data.OnlineStatus
|
|||||||
import net.mamoe.mirai.network.NoServerAvailableException
|
import net.mamoe.mirai.network.NoServerAvailableException
|
||||||
import net.mamoe.mirai.qqandroid.BotAccount
|
import net.mamoe.mirai.qqandroid.BotAccount
|
||||||
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
||||||
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcList
|
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin
|
||||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
|
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
|
||||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketLogger
|
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketLogger
|
||||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.Tlv
|
import net.mamoe.mirai.qqandroid.network.protocol.packet.Tlv
|
||||||
@ -122,7 +122,8 @@ internal open class QQAndroidClient(
|
|||||||
|
|
||||||
private val _ssoSequenceId: AtomicInt = atomic(85600)
|
private val _ssoSequenceId: AtomicInt = atomic(85600)
|
||||||
|
|
||||||
lateinit var fileStoragePushFSSvcList: FileStoragePushFSSvcList
|
lateinit var fileStoragePushFSSvcList: FileStoragePushFSSvcListFuckKotlin
|
||||||
|
|
||||||
internal suspend inline fun useNextServers(crossinline block: suspend (host: String, port: Int) -> Unit) {
|
internal suspend inline fun useNextServers(crossinline block: suspend (host: String, port: Int) -> Unit) {
|
||||||
@Suppress("UNREACHABLE_CODE", "ThrowableNotThrown") // false positive
|
@Suppress("UNREACHABLE_CODE", "ThrowableNotThrown") // false positive
|
||||||
retryCatching(bot.client.serverList.size) {
|
retryCatching(bot.client.serverList.size) {
|
||||||
|
@ -101,7 +101,7 @@ internal class _339(
|
|||||||
) : JceStruct
|
) : JceStruct
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
internal class FileStoragePushFSSvcList(
|
internal class FileStoragePushFSSvcListFuckKotlin(
|
||||||
@JceId(0) val vUpLoadList: List<FileStorageServerListInfo>? = listOf(),
|
@JceId(0) val vUpLoadList: List<FileStorageServerListInfo>? = listOf(),
|
||||||
@JceId(1) val vPicDownLoadList: List<FileStorageServerListInfo>? = listOf(),
|
@JceId(1) val vPicDownLoadList: List<FileStorageServerListInfo>? = listOf(),
|
||||||
@JceId(2) val vGPicDownLoadList: List<FileStorageServerListInfo>? = null,
|
@JceId(2) val vGPicDownLoadList: List<FileStorageServerListInfo>? = null,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -7,7 +7,7 @@ import kotlinx.io.core.toByteArray
|
|||||||
import kotlinx.io.core.writeFully
|
import kotlinx.io.core.writeFully
|
||||||
import kotlinx.serialization.MissingFieldException
|
import kotlinx.serialization.MissingFieldException
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcList
|
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin
|
||||||
import net.mamoe.mirai.qqandroid.utils.autoHexToBytes
|
import net.mamoe.mirai.qqandroid.utils.autoHexToBytes
|
||||||
import net.mamoe.mirai.qqandroid.utils.io.JceStruct
|
import net.mamoe.mirai.qqandroid.utils.io.JceStruct
|
||||||
import net.mamoe.mirai.qqandroid.utils.io.serialization.JceCharset
|
import net.mamoe.mirai.qqandroid.utils.io.serialization.JceCharset
|
||||||
@ -107,7 +107,7 @@ internal class JceInputTest {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
data.loadAs(FileStoragePushFSSvcList.serializer())
|
data.loadAs(FileStoragePushFSSvcListFuckKotlin.serializer())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -98,19 +98,12 @@ internal suspend inline fun <reified E : Event, R> subscribingGetOrNullImpl(
|
|||||||
var listener: Listener<E>? = null
|
var listener: Listener<E>? = null
|
||||||
@Suppress("DuplicatedCode") // for better performance
|
@Suppress("DuplicatedCode") // for better performance
|
||||||
listener = coroutineScope.subscribe {
|
listener = coroutineScope.subscribe {
|
||||||
val value = try {
|
result = kotlin.runCatching {
|
||||||
mapper.invoke(this, it)
|
mapper.invoke(this, it) ?: return@subscribe ListeningStatus.LISTENING
|
||||||
} catch (e: Exception) {
|
|
||||||
result = Result.failure(e)
|
|
||||||
listener!!.complete()
|
|
||||||
return@subscribe ListeningStatus.STOPPED
|
|
||||||
}
|
}
|
||||||
|
listener!!.complete()
|
||||||
|
return@subscribe ListeningStatus.STOPPED
|
||||||
|
|
||||||
if (value != null) {
|
|
||||||
result = Result.success(value)
|
|
||||||
listener!!.complete()
|
|
||||||
return@subscribe ListeningStatus.STOPPED
|
|
||||||
} else return@subscribe ListeningStatus.LISTENING
|
|
||||||
}
|
}
|
||||||
listener.join()
|
listener.join()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user