diff --git a/buildSrc/src/main/kotlin/ProjectConfigure.kt b/buildSrc/src/main/kotlin/ProjectConfigure.kt index 2c8d7df17..0a2d280dd 100644 --- a/buildSrc/src/main/kotlin/ProjectConfigure.kt +++ b/buildSrc/src/main/kotlin/ProjectConfigure.kt @@ -173,7 +173,7 @@ val experimentalAnnotations = arrayOf( "net.mamoe.mirai.console.util.ConsoleInternalApi", "net.mamoe.mirai.console.util.ConsoleExperimentalApi", - "kotlinx.io.core.internal.DangerousInternalIoApi" + "io.ktor.utils.io.core.internal.DangerousInternalIoApi" ) fun Project.configureKotlinExperimentalUsages() { diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 09eac074b..694fddfd6 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -84,6 +84,8 @@ val `kotlinx-io-common` = kotlinx("io", Versions.io) val `kotlinx-io-jvm` = kotlinx("io-jvm", Versions.io) val `kotlinx-io-native` = kotlinx("io-macosx64", Versions.io) +val `ktor-io` = ktor("io", Versions.ktor) + fun KotlinDependencyHandler.implementationKotlinxIo(module: String) { implementation(module) { /* diff --git a/mirai-core-api/build.gradle.kts b/mirai-core-api/build.gradle.kts index dfc72868b..601d50c2d 100644 --- a/mirai-core-api/build.gradle.kts +++ b/mirai-core-api/build.gradle.kts @@ -41,7 +41,7 @@ kotlin { implementation(project(":mirai-console-compiler-annotations")) implementation(`kotlinx-serialization-protobuf`) implementation(`kotlinx-atomicfu`) - implementationKotlinxIo(`kotlinx-io-common`) + implementation(`ktor-io`) } } @@ -58,7 +58,6 @@ kotlin { implementation(`jetbrains-annotations`) implementation(`log4j-api`) compileOnly(`slf4j-api`) - implementationKotlinxIo(`kotlinx-io-jvm`) } } @@ -84,7 +83,6 @@ kotlin { val nativeMain by getting { dependencies { - implementationKotlinxIo(`kotlinx-io-native`) } } } diff --git a/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFile.kt b/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFile.kt index bdab71479..5d0aa6161 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFile.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFile.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -12,7 +12,7 @@ package net.mamoe.mirai.contact.file -import kotlinx.io.errors.IOException +import io.ktor.utils.io.errors.* import me.him188.kotlin.jvm.blocking.bridge.JvmBlockingBridge import net.mamoe.mirai.contact.PermissionDeniedException import net.mamoe.mirai.message.data.FileMessage diff --git a/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFileFolder.kt b/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFileFolder.kt index 22628abf0..5d22c130d 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFileFolder.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/file/AbsoluteFileFolder.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -12,7 +12,7 @@ package net.mamoe.mirai.contact.file -import kotlinx.io.errors.IOException +import io.ktor.utils.io.errors.* import me.him188.kotlin.jvm.blocking.bridge.JvmBlockingBridge import net.mamoe.mirai.contact.FileSupported import net.mamoe.mirai.contact.PermissionDeniedException diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt index 645af1b26..c25b2259a 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt @@ -11,7 +11,7 @@ package net.mamoe.mirai.message.data -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json diff --git a/mirai-core-api/src/commonMain/kotlin/spi/AudioToSilkService.kt b/mirai-core-api/src/commonMain/kotlin/spi/AudioToSilkService.kt index 0c3ecbe94..a1969c396 100644 --- a/mirai-core-api/src/commonMain/kotlin/spi/AudioToSilkService.kt +++ b/mirai-core-api/src/commonMain/kotlin/spi/AudioToSilkService.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.spi -import kotlinx.io.errors.IOException +import io.ktor.utils.io.errors.* import net.mamoe.mirai.utils.* import kotlin.coroutines.cancellation.CancellationException import kotlin.jvm.JvmStatic diff --git a/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt b/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt index c0af49644..8d62278a2 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.Serializer diff --git a/mirai-core-api/src/commonMain/kotlin/utils/ExternalResource.kt b/mirai-core-api/src/commonMain/kotlin/utils/ExternalResource.kt index 425e84edb..36cdc4a52 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/ExternalResource.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/ExternalResource.kt @@ -11,9 +11,9 @@ package net.mamoe.mirai.utils +import io.ktor.utils.io.core.* import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred -import kotlinx.io.core.Input import me.him188.kotlin.jvm.blocking.bridge.JvmBlockingBridge import net.mamoe.mirai.contact.Contact import net.mamoe.mirai.contact.Contact.Companion.sendImage diff --git a/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.kt b/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.kt index 5ffaed0ea..825a76aa9 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.kt @@ -11,8 +11,8 @@ package net.mamoe.mirai.utils +import io.ktor.utils.io.errors.* import kotlinx.coroutines.Dispatchers -import kotlinx.io.errors.IOException import net.mamoe.mirai.Bot import net.mamoe.mirai.IMirai import net.mamoe.mirai.utils.ExternalResource.Companion.sendAsImageTo diff --git a/mirai-core-api/src/jvmBaseMain/kotlin/internal/utils/ExternalResourceImpls.kt b/mirai-core-api/src/jvmBaseMain/kotlin/internal/utils/ExternalResourceImpls.kt index 7d5f21f6e..aa84869ce 100644 --- a/mirai-core-api/src/jvmBaseMain/kotlin/internal/utils/ExternalResourceImpls.kt +++ b/mirai-core-api/src/jvmBaseMain/kotlin/internal/utils/ExternalResourceImpls.kt @@ -9,15 +9,18 @@ package net.mamoe.mirai.internal.utils +import io.ktor.utils.io.core.Input +import io.ktor.utils.io.streams.* import kotlinx.atomicfu.atomic import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred -import kotlinx.io.core.Input -import kotlinx.io.streams.asInput import net.mamoe.mirai.utils.* import java.io.Closeable import java.io.InputStream import java.io.RandomAccessFile +import kotlin.io.buffered +import kotlin.io.inputStream +import kotlin.io.use internal fun InputStream.detectFileTypeAndClose(): String? { diff --git a/mirai-core-api/src/jvmBaseMain/kotlin/utils/AbstractExternalResource.kt b/mirai-core-api/src/jvmBaseMain/kotlin/utils/AbstractExternalResource.kt index 32c57cd7e..56ae39572 100644 --- a/mirai-core-api/src/jvmBaseMain/kotlin/utils/AbstractExternalResource.kt +++ b/mirai-core-api/src/jvmBaseMain/kotlin/utils/AbstractExternalResource.kt @@ -9,10 +9,10 @@ package net.mamoe.mirai.utils +import io.ktor.utils.io.errors.* import kotlinx.atomicfu.atomic import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred -import kotlinx.io.errors.IOException import net.mamoe.mirai.internal.utils.ExternalResourceHolder import net.mamoe.mirai.internal.utils.ExternalResourceLeakObserver import net.mamoe.mirai.internal.utils.detectFileTypeAndClose diff --git a/mirai-core-api/src/jvmBaseMain/kotlin/utils/DeviceInfo.kt b/mirai-core-api/src/jvmBaseMain/kotlin/utils/DeviceInfo.kt index 8b7a6cb99..d3bbb4645 100644 --- a/mirai-core-api/src/jvmBaseMain/kotlin/utils/DeviceInfo.kt +++ b/mirai-core-api/src/jvmBaseMain/kotlin/utils/DeviceInfo.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import kotlinx.serialization.Serializable import kotlinx.serialization.Transient import kotlinx.serialization.json.Json diff --git a/mirai-core-api/src/jvmBaseMain/kotlin/utils/ExternalResource.kt b/mirai-core-api/src/jvmBaseMain/kotlin/utils/ExternalResource.kt index 281e9a63d..37cca19a5 100644 --- a/mirai-core-api/src/jvmBaseMain/kotlin/utils/ExternalResource.kt +++ b/mirai-core-api/src/jvmBaseMain/kotlin/utils/ExternalResource.kt @@ -9,10 +9,10 @@ package net.mamoe.mirai.utils +import io.ktor.utils.io.core.Input +import io.ktor.utils.io.errors.* import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred -import kotlinx.io.core.Input -import kotlinx.io.errors.IOException import me.him188.kotlin.jvm.blocking.bridge.JvmBlockingBridge import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.Contact @@ -34,6 +34,8 @@ import net.mamoe.mirai.utils.ExternalResource.Companion.uploadAsImage import java.io.File import java.io.InputStream import java.io.RandomAccessFile +import kotlin.io.inputStream +import kotlin.io.use /** * 一个*不可变的*外部资源. 仅包含资源内容, 大小, 文件类型, 校验值而不包含文件名, 文件位置等. 外部资源有可能是一个文件, 也有可能只存在于内存, 或者以任意其他方式实现. diff --git a/mirai-core-api/src/nativeMain/kotlin/utils/BotConfiguration.kt b/mirai-core-api/src/nativeMain/kotlin/utils/BotConfiguration.kt index d938f1453..55ab15d4d 100644 --- a/mirai-core-api/src/nativeMain/kotlin/utils/BotConfiguration.kt +++ b/mirai-core-api/src/nativeMain/kotlin/utils/BotConfiguration.kt @@ -9,9 +9,9 @@ package net.mamoe.mirai.utils +import io.ktor.utils.io.core.* import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob -import kotlinx.io.core.Input import kotlinx.serialization.json.Json import net.mamoe.mirai.Bot import net.mamoe.mirai.BotFactory diff --git a/mirai-core-api/src/nativeMain/kotlin/utils/DeviceInfo.kt b/mirai-core-api/src/nativeMain/kotlin/utils/DeviceInfo.kt index 8897f9b08..6909a5c96 100644 --- a/mirai-core-api/src/nativeMain/kotlin/utils/DeviceInfo.kt +++ b/mirai-core-api/src/nativeMain/kotlin/utils/DeviceInfo.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import kotlinx.serialization.Serializable import kotlinx.serialization.Transient import kotlin.random.Random diff --git a/mirai-core-api/src/nativeMain/kotlin/utils/ExternalResource.kt b/mirai-core-api/src/nativeMain/kotlin/utils/ExternalResource.kt index 2c368e876..30a60f8e2 100644 --- a/mirai-core-api/src/nativeMain/kotlin/utils/ExternalResource.kt +++ b/mirai-core-api/src/nativeMain/kotlin/utils/ExternalResource.kt @@ -9,9 +9,9 @@ package net.mamoe.mirai.utils +import io.ktor.utils.io.core.* import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred -import kotlinx.io.core.Input import net.mamoe.mirai.contact.Contact import net.mamoe.mirai.contact.Contact.Companion.sendImage import net.mamoe.mirai.contact.Contact.Companion.uploadImage diff --git a/mirai-core-utils/build.gradle.kts b/mirai-core-utils/build.gradle.kts index c08a1041e..685b90e2d 100644 --- a/mirai-core-utils/build.gradle.kts +++ b/mirai-core-utils/build.gradle.kts @@ -35,7 +35,7 @@ kotlin { implementation(`kotlinx-atomicfu`) implementation(`kotlinx-serialization-protobuf`) - implementationKotlinxIo(`kotlinx-io-common`) + implementation(`ktor-io`) } } @@ -47,7 +47,6 @@ kotlin { val jvmBaseMain by getting { dependencies { - implementationKotlinxIo(`kotlinx-io-jvm`) } } @@ -71,7 +70,6 @@ kotlin { val nativeMain by getting { dependencies { - implementationKotlinxIo(`kotlinx-io-native`) } } } diff --git a/mirai-core-utils/src/commonMain/kotlin/ByteArrayPool.kt b/mirai-core-utils/src/commonMain/kotlin/ByteArrayPool.kt index 5af562477..da9c19c00 100644 --- a/mirai-core-utils/src/commonMain/kotlin/ByteArrayPool.kt +++ b/mirai-core-utils/src/commonMain/kotlin/ByteArrayPool.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.pool.DefaultPool +import io.ktor.utils.io.pool.* /** * 缓存 [ByteArray] 实例的 [ObjectPool] diff --git a/mirai-core-utils/src/commonMain/kotlin/Bytes.kt b/mirai-core-utils/src/commonMain/kotlin/Bytes.kt index 63f14ae18..d247ade85 100644 --- a/mirai-core-utils/src/commonMain/kotlin/Bytes.kt +++ b/mirai-core-utils/src/commonMain/kotlin/Bytes.kt @@ -13,7 +13,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.jvm.JvmMultifileClass diff --git a/mirai-core-utils/src/commonMain/kotlin/Closeable.kt b/mirai-core-utils/src/commonMain/kotlin/Closeable.kt index 2356ccedd..8deebf9f0 100644 --- a/mirai-core-utils/src/commonMain/kotlin/Closeable.kt +++ b/mirai-core-utils/src/commonMain/kotlin/Closeable.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.errors.IOException +import io.ktor.utils.io.errors.* public expect interface Closeable { @Throws(IOException::class) diff --git a/mirai-core-utils/src/commonMain/kotlin/IO.kt b/mirai-core-utils/src/commonMain/kotlin/IO.kt index 4e69d294a..d5f403e45 100644 --- a/mirai-core-utils/src/commonMain/kotlin/IO.kt +++ b/mirai-core-utils/src/commonMain/kotlin/IO.kt @@ -14,9 +14,8 @@ package net.mamoe.mirai.utils -import kotlinx.io.charsets.Charset -import kotlinx.io.charsets.Charsets -import kotlinx.io.core.* +import io.ktor.utils.io.charsets.* +import io.ktor.utils.io.core.* import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName import kotlin.jvm.JvmSynthetic diff --git a/mirai-core-utils/src/commonMain/kotlin/MiraiPlatformUtils.kt b/mirai-core-utils/src/commonMain/kotlin/MiraiPlatformUtils.kt index 1b54bbc57..a30105971 100644 --- a/mirai-core-utils/src/commonMain/kotlin/MiraiPlatformUtils.kt +++ b/mirai-core-utils/src/commonMain/kotlin/MiraiPlatformUtils.kt @@ -12,9 +12,8 @@ package net.mamoe.mirai.utils -import kotlinx.io.core.Closeable -import kotlinx.io.core.toByteArray -import kotlinx.io.core.use +import io.ktor.utils.io.core.* +import io.ktor.utils.io.core.Closeable import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.jvm.JvmMultifileClass diff --git a/mirai-core-utils/src/jvmBaseMain/kotlin/Crypto.kt b/mirai-core-utils/src/jvmBaseMain/kotlin/Crypto.kt index d4d6c9c87..6d726bbb4 100644 --- a/mirai-core-utils/src/jvmBaseMain/kotlin/Crypto.kt +++ b/mirai-core-utils/src/jvmBaseMain/kotlin/Crypto.kt @@ -12,7 +12,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.core.use +import io.ktor.utils.io.core.* import java.io.ByteArrayOutputStream import java.io.InputStream import java.io.OutputStream diff --git a/mirai-core-utils/src/nativeMain/kotlin/Closeable.kt b/mirai-core-utils/src/nativeMain/kotlin/Closeable.kt index 257444cd7..e66e2f71f 100644 --- a/mirai-core-utils/src/nativeMain/kotlin/Closeable.kt +++ b/mirai-core-utils/src/nativeMain/kotlin/Closeable.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.utils -import kotlinx.io.errors.IOException +import io.ktor.utils.io.errors.* public actual interface Closeable { @Throws(IOException::class) diff --git a/mirai-core/build.gradle.kts b/mirai-core/build.gradle.kts index 067f47b22..20b9470b2 100644 --- a/mirai-core/build.gradle.kts +++ b/mirai-core/build.gradle.kts @@ -39,7 +39,7 @@ kotlin { implementation(project(":mirai-core-utils")) implementation(`kotlinx-serialization-protobuf`) implementation(`kotlinx-atomicfu`) - implementationKotlinxIo(`kotlinx-io-common`) + implementation(`ktor-io`) } } @@ -55,7 +55,6 @@ kotlin { implementation(bouncycastle) implementation(`log4j-api`) implementation(`netty-all`) - implementationKotlinxIo(`kotlinx-io-jvm`) } } @@ -93,7 +92,6 @@ kotlin { val nativeMain by getting { dependencies { - implementationKotlinxIo(`kotlinx-io-native`) } } } diff --git a/mirai-core/src/commonMain/kotlin/MiraiImpl.kt b/mirai-core/src/commonMain/kotlin/MiraiImpl.kt index d4a47235d..088af7f1b 100644 --- a/mirai-core/src/commonMain/kotlin/MiraiImpl.kt +++ b/mirai-core/src/commonMain/kotlin/MiraiImpl.kt @@ -14,8 +14,7 @@ import io.ktor.client.engine.okhttp.* import io.ktor.client.features.* import io.ktor.client.request.* import io.ktor.client.request.forms.* -import kotlinx.io.core.discardExact -import kotlinx.io.core.readBytes +import io.ktor.utils.io.core.readBytes import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.jsonPrimitive diff --git a/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt b/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt index 2070d5d7b..904caf201 100644 --- a/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt +++ b/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt @@ -9,6 +9,7 @@ package net.mamoe.mirai.internal.message +import io.ktor.utils.io.core.* import net.mamoe.mirai.Bot import net.mamoe.mirai.internal.message.DeepMessageRefiner.refineDeep import net.mamoe.mirai.internal.message.LightMessageRefiner.refineLight diff --git a/mirai-core/src/commonMain/kotlin/message/atImpl.kt b/mirai-core/src/commonMain/kotlin/message/atImpl.kt new file mode 100644 index 000000000..e57873246 --- /dev/null +++ b/mirai-core/src/commonMain/kotlin/message/atImpl.kt @@ -0,0 +1,9 @@ +/* + * Copyright 2019-2022 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/dev/LICENSE + */ + diff --git a/mirai-core/src/commonMain/kotlin/message/data/audio.kt b/mirai-core/src/commonMain/kotlin/message/data/audio.kt index 02d2a404d..4a64f7a82 100644 --- a/mirai-core/src/commonMain/kotlin/message/data/audio.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/audio.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.message.data -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/message/faceImpl.kt b/mirai-core/src/commonMain/kotlin/message/faceImpl.kt new file mode 100644 index 000000000..e57873246 --- /dev/null +++ b/mirai-core/src/commonMain/kotlin/message/faceImpl.kt @@ -0,0 +1,9 @@ +/* + * Copyright 2019-2022 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/dev/LICENSE + */ + diff --git a/mirai-core/src/commonMain/kotlin/message/image/ImageDecoder.kt b/mirai-core/src/commonMain/kotlin/message/image/ImageDecoder.kt index a0a84e5a0..08552fe11 100644 --- a/mirai-core/src/commonMain/kotlin/message/image/ImageDecoder.kt +++ b/mirai-core/src/commonMain/kotlin/message/image/ImageDecoder.kt @@ -9,8 +9,8 @@ package net.mamoe.mirai.internal.message.image -import kotlinx.io.core.* -import kotlinx.io.streams.asInput +import io.ktor.utils.io.core.* +import io.ktor.utils.io.streams.asInput import net.mamoe.mirai.message.data.ImageType import net.mamoe.mirai.utils.* import java.io.IOException diff --git a/mirai-core/src/commonMain/kotlin/message/protocol/impl/FaceProtocol.kt b/mirai-core/src/commonMain/kotlin/message/protocol/impl/FaceProtocol.kt index d3eccac07..92bca0147 100644 --- a/mirai-core/src/commonMain/kotlin/message/protocol/impl/FaceProtocol.kt +++ b/mirai-core/src/commonMain/kotlin/message/protocol/impl/FaceProtocol.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.message.protocol.impl -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.message.protocol.MessageProtocol import net.mamoe.mirai.internal.message.protocol.ProcessorCollector import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder diff --git a/mirai-core/src/commonMain/kotlin/message/protocol/impl/FileMessageProtocol.kt b/mirai-core/src/commonMain/kotlin/message/protocol/impl/FileMessageProtocol.kt index 7a0e867a2..5c87fb1d4 100644 --- a/mirai-core/src/commonMain/kotlin/message/protocol/impl/FileMessageProtocol.kt +++ b/mirai-core/src/commonMain/kotlin/message/protocol/impl/FileMessageProtocol.kt @@ -9,9 +9,9 @@ package net.mamoe.mirai.internal.message.protocol.impl +import io.ktor.utils.io.core.* import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope -import kotlinx.io.core.readUShort import net.mamoe.mirai.internal.contact.SendMessageStep import net.mamoe.mirai.internal.message.data.FileMessageImpl import net.mamoe.mirai.internal.message.data.checkIsImpl diff --git a/mirai-core/src/commonMain/kotlin/message/protocol/impl/RichMessageProtocol.kt b/mirai-core/src/commonMain/kotlin/message/protocol/impl/RichMessageProtocol.kt index 3d2b1b3b5..756e64800 100644 --- a/mirai-core/src/commonMain/kotlin/message/protocol/impl/RichMessageProtocol.kt +++ b/mirai-core/src/commonMain/kotlin/message/protocol/impl/RichMessageProtocol.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.message.protocol.impl -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.message.data.ForwardMessageInternal import net.mamoe.mirai.internal.message.data.LightAppInternal import net.mamoe.mirai.internal.message.data.LongMessageInternal diff --git a/mirai-core/src/commonMain/kotlin/message/protocol/impl/TextProtocol.kt b/mirai-core/src/commonMain/kotlin/message/protocol/impl/TextProtocol.kt index e96ba825d..b7bf17810 100644 --- a/mirai-core/src/commonMain/kotlin/message/protocol/impl/TextProtocol.kt +++ b/mirai-core/src/commonMain/kotlin/message/protocol/impl/TextProtocol.kt @@ -9,10 +9,7 @@ package net.mamoe.mirai.internal.message.protocol.impl -import kotlinx.io.core.buildPacket -import kotlinx.io.core.discardExact -import kotlinx.io.core.readBytes -import kotlinx.io.core.readUInt +import io.ktor.utils.io.core.* import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.nameCardOrNick import net.mamoe.mirai.internal.message.protocol.MessageProtocol diff --git a/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt b/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt index 7ef04b089..bd1406cc6 100644 --- a/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt +++ b/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt @@ -1,20 +1,19 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ @file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR", "unused") package net.mamoe.mirai.internal.network +import io.ktor.utils.io.core.* import kotlinx.atomicfu.AtomicInt import kotlinx.atomicfu.atomic -import kotlinx.io.core.String -import kotlinx.io.core.toByteArray import net.mamoe.mirai.data.OnlineStatus import net.mamoe.mirai.internal.BotAccount import net.mamoe.mirai.internal.QQAndroidBot diff --git a/mirai-core/src/commonMain/kotlin/network/components/AccountSecretsManager.kt b/mirai-core/src/commonMain/kotlin/network/components/AccountSecretsManager.kt index 849ec650e..81cc18ba3 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/AccountSecretsManager.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/AccountSecretsManager.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.components -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import kotlinx.serialization.Serializable import net.mamoe.mirai.Bot import net.mamoe.mirai.internal.BotAccount diff --git a/mirai-core/src/commonMain/kotlin/network/components/PacketCodec.kt b/mirai-core/src/commonMain/kotlin/network/components/PacketCodec.kt index e0a65030a..fecb34bed 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/PacketCodec.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/PacketCodec.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.components -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.QQAndroidClient import net.mamoe.mirai.internal.network.component.ComponentKey diff --git a/mirai-core/src/commonMain/kotlin/network/highway/ChunkedFlowSession.kt b/mirai-core/src/commonMain/kotlin/network/highway/ChunkedFlowSession.kt index 86dff2faf..cc180671f 100644 --- a/mirai-core/src/commonMain/kotlin/network/highway/ChunkedFlowSession.kt +++ b/mirai-core/src/commonMain/kotlin/network/highway/ChunkedFlowSession.kt @@ -1,17 +1,17 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.highway +import io.ktor.utils.io.core.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow -import kotlinx.io.core.Closeable import net.mamoe.mirai.utils.runBIO import net.mamoe.mirai.utils.toLongUnsigned import net.mamoe.mirai.utils.withUse diff --git a/mirai-core/src/commonMain/kotlin/network/highway/Highway.kt b/mirai-core/src/commonMain/kotlin/network/highway/Highway.kt index 4b0f83567..58f3400fd 100644 --- a/mirai-core/src/commonMain/kotlin/network/highway/Highway.kt +++ b/mirai-core/src/commonMain/kotlin/network/highway/Highway.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,16 +9,14 @@ package net.mamoe.mirai.internal.network.highway +import io.ktor.utils.io.core.ByteReadPacket +import io.ktor.utils.io.core.buildPacket +import io.ktor.utils.io.core.writeFully import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.produceIn -import kotlinx.io.core.ByteReadPacket -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 diff --git a/mirai-core/src/commonMain/kotlin/network/keys.kt b/mirai-core/src/commonMain/kotlin/network/keys.kt index 058056053..d6077970e 100644 --- a/mirai-core/src/commonMain/kotlin/network/keys.kt +++ b/mirai-core/src/commonMain/kotlin/network/keys.kt @@ -9,9 +9,7 @@ package net.mamoe.mirai.internal.network -import kotlinx.io.core.BytePacketBuilder -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.writeFully +import io.ktor.utils.io.core.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import net.mamoe.mirai.internal.AbstractBot diff --git a/mirai-core/src/commonMain/kotlin/network/notice/decoders/MsgInfoDecoder.kt b/mirai-core/src/commonMain/kotlin/network/notice/decoders/MsgInfoDecoder.kt index 921c96df7..e067fa88f 100644 --- a/mirai-core/src/commonMain/kotlin/network/notice/decoders/MsgInfoDecoder.kt +++ b/mirai-core/src/commonMain/kotlin/network/notice/decoders/MsgInfoDecoder.kt @@ -1,17 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.notice.decoders -import kotlinx.io.core.discardExact -import kotlinx.io.core.readBytes -import kotlinx.io.core.readUInt +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.contact.GroupImpl import net.mamoe.mirai.internal.contact.checkIsGroupImpl import net.mamoe.mirai.internal.getGroupByUin diff --git a/mirai-core/src/commonMain/kotlin/network/notice/group/GroupNotificationProcessor.kt b/mirai-core/src/commonMain/kotlin/network/notice/group/GroupNotificationProcessor.kt index 486981406..ec0015c62 100644 --- a/mirai-core/src/commonMain/kotlin/network/notice/group/GroupNotificationProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/notice/group/GroupNotificationProcessor.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,8 +9,7 @@ package net.mamoe.mirai.internal.network.notice.group -import kotlinx.io.core.readUInt -import kotlinx.io.core.readUShort +import io.ktor.utils.io.core.* import net.mamoe.mirai.contact.NormalMember import net.mamoe.mirai.contact.getMember import net.mamoe.mirai.data.GroupHonorType diff --git a/mirai-core/src/commonMain/kotlin/network/notice/group/GroupOrMemberListNoticeProcessor.kt b/mirai-core/src/commonMain/kotlin/network/notice/group/GroupOrMemberListNoticeProcessor.kt index 759f2d0d7..c19d94be2 100644 --- a/mirai-core/src/commonMain/kotlin/network/notice/group/GroupOrMemberListNoticeProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/notice/group/GroupOrMemberListNoticeProcessor.kt @@ -1,20 +1,18 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.notice.group +import io.ktor.utils.io.core.* import kotlinx.coroutines.CancellationException import kotlinx.coroutines.cancel import kotlinx.coroutines.sync.withLock -import kotlinx.io.core.discardExact -import kotlinx.io.core.readUByte -import kotlinx.io.core.readUInt import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.MemberPermission.* import net.mamoe.mirai.event.events.* diff --git a/mirai-core/src/commonMain/kotlin/network/notice/priv/FriendNoticeProcessor.kt b/mirai-core/src/commonMain/kotlin/network/notice/priv/FriendNoticeProcessor.kt index c06029109..8d9a8ee62 100644 --- a/mirai-core/src/commonMain/kotlin/network/notice/priv/FriendNoticeProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/notice/priv/FriendNoticeProcessor.kt @@ -9,9 +9,7 @@ package net.mamoe.mirai.internal.network.notice.priv -import kotlinx.io.core.discardExact -import kotlinx.io.core.readUByte -import kotlinx.io.core.readUShort +import io.ktor.utils.io.core.* import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber import net.mamoe.mirai.contact.User diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt index b08852a52..b29206a1a 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt @@ -1,18 +1,18 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet -import kotlinx.io.core.BytePacketBuilder -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.buildPacket -import kotlinx.io.core.writeFully +import io.ktor.utils.io.core.BytePacketBuilder +import io.ktor.utils.io.core.ByteReadPacket +import io.ktor.utils.io.core.buildPacket +import io.ktor.utils.io.core.writeFully import net.mamoe.mirai.internal.network.QQAndroidClient import net.mamoe.mirai.internal.utils.crypto.ECDHKeyPair import net.mamoe.mirai.internal.utils.crypto.ECDHWithPublicKey diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt index 7b841a04c..0c789aea8 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt @@ -10,7 +10,7 @@ package net.mamoe.mirai.internal.network.protocol.packet -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient import net.mamoe.mirai.internal.network.appClientVersion diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt index 05b366eb5..034ab47be 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.event.Event import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt index 77567e934..85c7b2396 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt @@ -1,17 +1,17 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ @file:Suppress("NOTHING_TO_INLINE") package net.mamoe.mirai.internal.network.protocol.packet -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.network.* import net.mamoe.mirai.internal.network.protocol.LoginType import net.mamoe.mirai.internal.utils.GuidSource diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/GroupFile.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/GroupFile.kt index 0a57e4815..d0f1d92b6 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/GroupFile.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/GroupFile.kt @@ -1,17 +1,17 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ @file:Suppress("NOTHING_TO_INLINE") package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import kotlinx.serialization.DeserializationStrategy import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt index 9f995040b..0b0848f88 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt @@ -11,7 +11,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.message.contextualBugReportException import net.mamoe.mirai.internal.network.Packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MusicSharePacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MusicSharePacket.kt index e10c87a6a..9cac7461a 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MusicSharePacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MusicSharePacket.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt index a8fd824b1..97169f577 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt @@ -1,18 +1,17 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ @file:Suppress("INVISIBLE_MEMBER") package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.readBytes +import io.ktor.utils.io.core.* import net.mamoe.mirai.event.events.NewFriendRequestEvent import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt index 97433b6f0..9b7e1d067 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt @@ -9,8 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.readBytes +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt index dca992b8b..858eab003 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt @@ -1,17 +1,17 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ @file:Suppress("EXPERIMENTAL_API_USAGE") package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopEssenceMsgManager.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopEssenceMsgManager.kt index d11880e37..c89f9645d 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopEssenceMsgManager.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopEssenceMsgManager.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt index d72020d37..782fe0574 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt @@ -9,10 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.buildPacket -import kotlinx.io.core.readBytes -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import net.mamoe.mirai.contact.Member import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.contact.info.GroupInfoImpl diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt index a7b653c01..71d3ca51f 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat.image -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt index 7b67806cd..1efc61227 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.image -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt index d8769a9b6..d06671ade 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.QQAndroidClient import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt index 3b709032a..a30797809 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt @@ -11,10 +11,10 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive +import io.ktor.utils.io.core.* import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.delay import kotlinx.coroutines.launch -import kotlinx.io.core.ByteReadPacket import net.mamoe.mirai.Bot import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.events.BotEvent diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetRoamMsgReq.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetRoamMsgReq.kt index b1aa94b63..f57f687cf 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetRoamMsgReq.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetRoamMsgReq.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt index 340d107b7..aecaafc88 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt @@ -9,10 +9,9 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive +import io.ktor.utils.io.core.* import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.toByteArray import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.Member diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt index 138f3de3b..93530ab20 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.components.AccountSecretsManager import net.mamoe.mirai.internal.network.components.BotInitProcessor diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt index 794b43394..fd1dbc46e 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,9 +9,8 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive +import io.ktor.utils.io.core.* import kotlinx.atomicfu.loop -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.discardExact import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.components.SyncController.Companion.syncController import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPushNotify diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushReaded.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushReaded.kt index a1b880c66..5d92bf6a0 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushReaded.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushReaded.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.RequestPushStatus.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.RequestPushStatus.kt index b143e9ff8..aacde49f8 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.RequestPushStatus.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.RequestPushStatus.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.components.NoticeProcessorPipeline.Companion.processPacketThroughPipeline diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbC2CMsgSync.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbC2CMsgSync.kt index 0c98ffb09..1dbea12e1 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbC2CMsgSync.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbC2CMsgSync.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.components.NoticePipelineContext.Companion.KEY_FROM_SYNC diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt index 90f72b0e1..9cc193d84 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.components.NoticeProcessorPipeline.Companion.processPacketThroughPipeline diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt index 9ef57b5bc..acd7c28ff 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.components.NoticeProcessorPipeline.Companion.processPacketThroughPipeline diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt index 26b94bcaf..c82fc82b6 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.MultiPacket import net.mamoe.mirai.internal.network.Packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.SidExpired.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.SidExpired.kt index 02215d62b..4367312f7 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.SidExpired.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.SidExpired.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt index fa8448214..5337a6a4f 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.chat.voice -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.contact.uin import net.mamoe.mirai.internal.network.Packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt index 5fe74af57..2431a5814 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.list -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.contact.uin diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt index 3695a57a3..f92c7fd54 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.list -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/StrangerList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/StrangerList.kt index fe57ef4cf..d1d94ca25 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/StrangerList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/StrangerList.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.list -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.contact.Stranger import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.StrangerRelationChangeEvent diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt index 5ec4c7580..bae25702d 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.login -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.Event import net.mamoe.mirai.event.events.BotOfflineEvent diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt index 0fec1847a..34b46ccc3 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.login -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt index 74d7d8543..4a86a01b2 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.login @@ -13,7 +13,7 @@ import kotlinx.coroutines.CancellationException import kotlinx.coroutines.cancel import kotlinx.coroutines.delay import kotlinx.coroutines.sync.withLock -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.ByteReadPacket import kotlinx.serialization.protobuf.ProtoBuf import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.ClientKind diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt index 1a3c6d8d5..d718366e0 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt @@ -1,16 +1,16 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.login -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import net.mamoe.mirai.Bot import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.events.BotEvent diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin10.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin10.kt index 08d223725..6f9fbc629 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin10.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin10.kt @@ -1,14 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.network.* import net.mamoe.mirai.internal.network.protocol.packet.* import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin15.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin15.kt index 192a69f43..878154ab3 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin15.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin15.kt @@ -1,14 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.network.* import net.mamoe.mirai.internal.network.protocol.packet.* import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin2.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin2.kt index 1b1a2bfd3..0fd1956cc 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin2.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin2.kt @@ -9,6 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.network.QQAndroidClient import net.mamoe.mirai.internal.network.miscBitMap import net.mamoe.mirai.internal.network.protocol.packet.* diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin9.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin9.kt index ae98c28ea..f399bb469 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin9.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLogin9.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.toByteArray import net.mamoe.mirai.internal.network.* import net.mamoe.mirai.internal.network.protocol.packet.* import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLoginExt.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLoginExt.kt index cc822cb2e..bc66fee36 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLoginExt.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/wtlogin/WtLoginExt.kt @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin -import kotlinx.io.core.* +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.LoginExtraData import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/summarycard/SummaryCard.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/summarycard/SummaryCard.kt index 9c2815940..40fc508f2 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/summarycard/SummaryCard.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/summarycard/SummaryCard.kt @@ -1,16 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.protocol.packet.summarycard -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.discardExact +import io.ktor.utils.io.core.* import net.mamoe.mirai.data.UserProfile import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet diff --git a/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt b/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt index 777d0b6c0..b7c4ae64d 100644 --- a/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt +++ b/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,12 +9,11 @@ package net.mamoe.mirai.internal.utils +import io.ktor.utils.io.core.* +import io.ktor.utils.io.nio.readPacketAtMost +import io.ktor.utils.io.nio.writePacket import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.Closeable -import kotlinx.io.nio.readPacketAtMost -import kotlinx.io.nio.writePacket import java.net.InetSocketAddress import java.nio.channels.DatagramChannel import java.nio.channels.ReadableByteChannel diff --git a/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt b/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt index 832067810..2a33db2b5 100644 --- a/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt +++ b/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt @@ -1,29 +1,26 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.utils +import io.ktor.utils.io.core.* +import io.ktor.utils.io.streams.readPacketAtMost +import io.ktor.utils.io.streams.writePacket import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runInterruptible import kotlinx.coroutines.suspendCancellableCoroutine -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.Closeable -import kotlinx.io.streams.readPacketAtMost -import kotlinx.io.streams.writePacket import net.mamoe.mirai.internal.network.highway.HighwayProtocolChannel import net.mamoe.mirai.utils.withUse import java.io.BufferedInputStream import java.io.BufferedOutputStream import java.io.IOException -import java.net.NoRouteToHostException import java.net.Socket -import java.net.UnknownHostException import java.util.concurrent.Executors import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/mirai-core/src/commonMain/kotlin/utils/crypto/TEA.kt b/mirai-core/src/commonMain/kotlin/utils/crypto/TEA.kt index 4d00888ff..550c24c59 100644 --- a/mirai-core/src/commonMain/kotlin/utils/crypto/TEA.kt +++ b/mirai-core/src/commonMain/kotlin/utils/crypto/TEA.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.utils.crypto -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.utils.ByteArrayPool import net.mamoe.mirai.utils.toByteArray import net.mamoe.mirai.utils.toUHexString diff --git a/mirai-core/src/commonMain/kotlin/utils/io/output.kt b/mirai-core/src/commonMain/kotlin/utils/io/output.kt index 1ab7bc0c2..1ed92b1ec 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/output.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/output.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -13,9 +13,9 @@ package net.mamoe.mirai.internal.utils.io +import io.ktor.utils.io.core.* import io.ktor.utils.io.streams.* -import kotlinx.io.core.* -import kotlinx.io.streams.outputStream +import io.ktor.utils.io.streams.outputStream import net.mamoe.mirai.internal.utils.coerceAtMostOrFail import net.mamoe.mirai.internal.utils.crypto.TEA import net.mamoe.mirai.utils.ExternalResource diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt index 67f3c89a3..313ea7c49 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt @@ -11,9 +11,8 @@ package net.mamoe.mirai.internal.utils.io.serialization.tars -import kotlinx.io.charsets.Charset -import kotlinx.io.charsets.Charsets -import kotlinx.io.core.* +import io.ktor.utils.io.charsets.* +import io.ktor.utils.io.core.* import kotlinx.serialization.* import kotlinx.serialization.modules.EmptySerializersModule import kotlinx.serialization.modules.SerializersModule diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt index f847a578c..330669730 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt @@ -9,8 +9,8 @@ package net.mamoe.mirai.internal.utils.io.serialization.tars.internal -import kotlinx.io.charsets.Charset -import kotlinx.io.core.* +import io.ktor.utils.io.charsets.* +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt index 1bd9bf2d5..b0cfd8595 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt @@ -1,17 +1,16 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.utils.io.serialization.tars.internal -import kotlinx.io.charsets.Charset -import kotlinx.io.charsets.Charsets -import kotlinx.io.core.* +import io.ktor.utils.io.charsets.* +import io.ktor.utils.io.core.* import kotlinx.serialization.* import kotlinx.serialization.builtins.MapEntrySerializer import kotlinx.serialization.builtins.SetSerializer diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt index 261f9d58f..981e623ed 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,7 +9,7 @@ package net.mamoe.mirai.internal.utils.io.serialization.tars.internal -import kotlinx.io.core.Output +import io.ktor.utils.io.core.* import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.descriptors.SerialDescriptor import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt index 186fe95d8..6b5948136 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt @@ -13,8 +13,8 @@ package net.mamoe.mirai.internal.utils.io.serialization -import kotlinx.io.core.* -import kotlinx.io.streams.asInput +import io.ktor.utils.io.core.* +import io.ktor.utils.io.streams.asInput import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.descriptors.SerialDescriptor diff --git a/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt b/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt index 30ba0065d..b8e4a40c7 100644 --- a/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt +++ b/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal -import kotlinx.io.core.toByteArray +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.test.AbstractTest import net.mamoe.mirai.utils.gzip import net.mamoe.mirai.utils.ungzip diff --git a/mirai-core/src/commonTest/kotlin/message/protocol/impl/AbstractMessageProtocolTest.kt b/mirai-core/src/commonTest/kotlin/message/protocol/impl/AbstractMessageProtocolTest.kt index 15edd15df..6feea6143 100644 --- a/mirai-core/src/commonTest/kotlin/message/protocol/impl/AbstractMessageProtocolTest.kt +++ b/mirai-core/src/commonTest/kotlin/message/protocol/impl/AbstractMessageProtocolTest.kt @@ -9,10 +9,10 @@ package net.mamoe.mirai.internal.message.protocol.impl +import io.ktor.utils.io.core.* import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Deferred import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.io.core.ByteReadPacket import net.mamoe.mirai.contact.ContactOrBot import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Group diff --git a/mirai-core/src/commonTest/kotlin/network/framework/AbstractNettyNHTest.kt b/mirai-core/src/commonTest/kotlin/network/framework/AbstractNettyNHTest.kt index fca29eee6..0c69fd14f 100644 --- a/mirai-core/src/commonTest/kotlin/network/framework/AbstractNettyNHTest.kt +++ b/mirai-core/src/commonTest/kotlin/network/framework/AbstractNettyNHTest.kt @@ -1,21 +1,20 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.framework +import io.ktor.utils.io.core.* import io.netty.channel.Channel import io.netty.channel.embedded.EmbeddedChannel import io.netty.util.ReferenceCountUtil import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CoroutineScope -import kotlinx.io.core.buildPacket -import kotlinx.io.core.readBytes import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.serializer diff --git a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyResumeConnectionTest.kt b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyResumeConnectionTest.kt index d430697ce..318bf2878 100644 --- a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyResumeConnectionTest.kt +++ b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyResumeConnectionTest.kt @@ -1,15 +1,15 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.impl.netty -import kotlinx.io.core.ByteReadPacket +import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.network.framework.AbstractNettyNHTest import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket import net.mamoe.mirai.internal.test.runBlockingUnit diff --git a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettySendPacketTest.kt b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettySendPacketTest.kt index deca9932d..f09329780 100644 --- a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettySendPacketTest.kt +++ b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettySendPacketTest.kt @@ -1,21 +1,21 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.impl.netty +import io.ktor.utils.io.core.* import io.netty.channel.Channel import kotlinx.atomicfu.atomic import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.launch import kotlinx.coroutines.yield -import kotlinx.io.core.ByteReadPacket import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.framework.AbstractNettyNHTest import net.mamoe.mirai.internal.network.framework.TestNettyNH diff --git a/mirai-core/src/commonTest/kotlin/test/printing.kt b/mirai-core/src/commonTest/kotlin/test/printing.kt index c01c7a143..70cbdaf38 100644 --- a/mirai-core/src/commonTest/kotlin/test/printing.kt +++ b/mirai-core/src/commonTest/kotlin/test/printing.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -11,9 +11,7 @@ package test -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.Input -import kotlinx.io.core.readAvailable +import io.ktor.utils.io.core.* import net.mamoe.mirai.IMirai import net.mamoe.mirai.utils.* import kotlin.contracts.InvocationKind diff --git a/mirai-core/src/jvmBaseMain/kotlin/network/impl/netty/nettyUtils.kt b/mirai-core/src/jvmBaseMain/kotlin/network/impl/netty/nettyUtils.kt index 464d9bdd0..4e650d97a 100644 --- a/mirai-core/src/jvmBaseMain/kotlin/network/impl/netty/nettyUtils.kt +++ b/mirai-core/src/jvmBaseMain/kotlin/network/impl/netty/nettyUtils.kt @@ -9,6 +9,8 @@ package net.mamoe.mirai.internal.network.impl.netty +import io.ktor.utils.io.core.* +import io.ktor.utils.io.streams.* import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBufInputStream import io.netty.channel.ChannelFuture @@ -18,9 +20,6 @@ import kotlinx.coroutines.CoroutineExceptionHandler import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.Job import kotlinx.coroutines.suspendCancellableCoroutine -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.buildPacket -import kotlinx.io.streams.outputStream import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.SimpleLogger import net.mamoe.mirai.utils.SimpleLogger.LogPriority.ERROR