diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 382dce28e..000000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: android - -jdk: oraclejdk8 -### need JDK11 - -env: - global: - - ANDROID_API_LEVEL=28 - - ANDROID_BUILD_TOOLS_VERSION=28.0.3 - - ANDROID_ABI=armeabi-v7a - -android: - components: - - tools - - platform-tools - - tools - - extra-android-m2repository - licenses: - - 'android-sdk-preview-license-52d11cd2' - - 'android-sdk-license-.+' - - 'google-gdk-license-.+' - -before_install: - - touch $HOME/.android/repositories.cfg - - yes | sdkmanager "platforms;android-28" - - yes | sdkmanager "build-tools;28.0.3" - -### need JDK8( SDK manager thing) - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache - -before_script: - - chmod +x gradlew - -script: - - ./gradlew clean build - - ./gradlew test \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bab6164fc..6499a04cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ mirai 欢迎一切形式的代码贡献。你可以通过以下几种途径向 m ### 注意事项 - 尽量不要引用新的库 - 遵守 Kotlin 官方代码规范(提交前使用 IDE 格式化代码 (commit 时勾选 'Reformat code')) -- 不要手动拆解数据包. 请一定使用 `kotlinx.serialization` 拆解 ProtoBuf, 使用 `net.mamoe.mirai.qqandroid.utils.io.serialization.Tars` 拆解 Tars 数据包, 使用 `kotlinx.serialization` 拆解 Json 数据. +- 不要手动拆解数据包. 请一定使用 `kotlinx.serialization` 拆解 ProtoBuf, 使用 `net.mamoe.mirai.internal.utils.io.serialization.Tars` 拆解 Tars 数据包, 使用 `kotlinx.serialization` 拆解 Json 数据. ## 社区 diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c4192631f..000000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index abc80e711..87422303c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -273,19 +273,19 @@ subprojects { suppress = true } perPackageOption { - prefix = "net.mamoe.mirai.qqandroid.utils" + prefix = "net.mamoe.mirai.internal.utils" suppress = true } perPackageOption { - prefix = "net.mamoe.mirai.qqandroid.contact" + prefix = "net.mamoe.mirai.internal.contact" suppress = true } perPackageOption { - prefix = "net.mamoe.mirai.qqandroid.message" + prefix = "net.mamoe.mirai.internal.message" suppress = true } perPackageOption { - prefix = "net.mamoe.mirai.qqandroid.network" + prefix = "net.mamoe.mirai.internal.network" suppress = true } } diff --git a/buildSrc/src/main/kotlin/utils.kt b/buildSrc/src/main/kotlin/utils.kt index 3b7230f4b..9dd5269ca 100644 --- a/buildSrc/src/main/kotlin/utils.kt +++ b/buildSrc/src/main/kotlin/utils.kt @@ -3,16 +3,13 @@ import java.io.OutputStream import java.security.MessageDigest /* + * Copyright 2019-2020 Mamoe Technologies and contributors. * - * * Copyright 2020 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/master/LICENSE + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * + * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @OptIn(ExperimentalUnsignedTypes::class) fun ByteArray.toUHexString( separator: String = " ", diff --git a/compatibility-validator/build.gradle.kts b/compatibility-validator/build.gradle.kts deleted file mode 100644 index 971365998..000000000 --- a/compatibility-validator/build.gradle.kts +++ /dev/null @@ -1,49 +0,0 @@ -@file:Suppress("UNUSED_VARIABLE") - -plugins { - kotlin("jvm") - java -} - -description = "Binary and source compatibility validator for mirai-core and mirai-core-qqandroid" - -repositories { - mavenCentral() - jcenter() -} - -kotlin { - sourceSets { - all { - languageSettings.enableLanguageFeature("InlineClasses") - languageSettings.useExperimentalAnnotation("kotlin.Experimental") - } - - main { - dependencies { - api(kotlin("stdlib", Versions.Kotlin.stdlib)) - runtimeOnly(project(":mirai-core-qqandroid")) - compileOnly("net.mamoe:mirai-core-qqandroid:0.38.0") - } - } - - test { - dependencies { - api(kotlin("stdlib", Versions.Kotlin.stdlib)) - api(kotlin("test")) - api(kotlin("test-junit")) - runtimeOnly(project(":mirai-core-qqandroid")) - compileOnly("net.mamoe:mirai-core-qqandroid:0.38.0") - } - } - } -} - -tasks.withType { - kotlinOptions.jvmTarget = "1.8" -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} \ No newline at end of file diff --git a/compatibility-validator/src/main/java/compatibility/CompatibilityTest.java b/compatibility-validator/src/main/java/compatibility/CompatibilityTest.java deleted file mode 100644 index 63ff3dd19..000000000 --- a/compatibility-validator/src/main/java/compatibility/CompatibilityTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package compatibility; - -import net.mamoe.mirai.Bot; -import net.mamoe.mirai.BotFactoryJvm; -import net.mamoe.mirai.message.data.MessageUtils; - -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ -public class CompatibilityTest { - public static void main(String[] args) { - Bot bot = BotFactoryJvm.newBot(Long.parseLong(System.getenv("qq")), System.getenv("password")); - - bot.getFriend(123).sendMessage(MessageUtils.newChain("") - .plus("") - .plus(MessageUtils.newImage(""))); - bot.getFriend(123).sendMessage(""); - } -} diff --git a/compatibility-validator/src/test/kotlin/compatibility/CombinedMessageTest.kt b/compatibility-validator/src/test/kotlin/compatibility/CombinedMessageTest.kt deleted file mode 100644 index 843884a18..000000000 --- a/compatibility-validator/src/test/kotlin/compatibility/CombinedMessageTest.kt +++ /dev/null @@ -1,78 +0,0 @@ -package compatibility - -import net.mamoe.mirai.message.data.* -import kotlin.test.Test -import kotlin.test.assertEquals - - -internal class CombinedMessageTest { - - - @Test - fun testAsSequence() { - var message: Message = "Hello ".toMessage() - message += "World" - - assertEquals( - "Hello World", - (message as CombinedMessage).asSequence().joinToString(separator = "") - ) - } - - @Test - fun testAsSequence2() { - var message: Message = "Hello ".toMessage() - message += listOf( - PlainText("W"), - PlainText("o"), - PlainText("r") + PlainText("ld") - ).asMessageChain() - - assertEquals( - "Hello World", - (message as CombinedMessage).asSequence().joinToString(separator = "") - ) - } -} - -fun Iterator.joinToString( - separator: CharSequence = ", ", - prefix: CharSequence = "", - postfix: CharSequence = "", - limit: Int = -1, - truncated: CharSequence = "...", - transform: ((T) -> CharSequence)? = null -): String { - return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString() -} - -fun Iterator.joinTo( - buffer: A, - separator: CharSequence = ", ", - prefix: CharSequence = "", - postfix: CharSequence = "", - limit: Int = -1, - truncated: CharSequence = "...", - transform: ((T) -> CharSequence)? = null -): A { - buffer.append(prefix) - var count = 0 - for (element in this) { - if (++count > 1) buffer.append(separator) - if (limit < 0 || count <= limit) { - buffer.appendElement(element, transform) - } else break - } - if (limit in 0 until count) buffer.append(truncated) - buffer.append(postfix) - return buffer -} - -internal fun Appendable.appendElement(element: T, transform: ((T) -> CharSequence)?) { - when { - transform != null -> append(transform(element)) - element is CharSequence? -> append(element) - element is Char -> append(element) - else -> append(element.toString()) - } -} \ No newline at end of file diff --git a/compatibility-validator/src/test/kotlin/compatibility/TestKotlinCompatibility.kt b/compatibility-validator/src/test/kotlin/compatibility/TestKotlinCompatibility.kt deleted file mode 100644 index 051444cd7..000000000 --- a/compatibility-validator/src/test/kotlin/compatibility/TestKotlinCompatibility.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package compatibility - -import net.mamoe.mirai.message.data.Message -import net.mamoe.mirai.message.data.PlainText -import org.junit.Test - - -internal class TestKotlinCompatibility { - - @Test - fun testMessageChain() { - val x = PlainText("te") + PlainText("st") - - println(Message::class.java.declaredMethods.joinToString("\n")) - println() - println(x::class.java.declaredMethods.joinToString("\n")) - } -} \ No newline at end of file diff --git a/docs/mirai.md b/docs/mirai.md index 3b2ec87f5..d38e199b9 100644 --- a/docs/mirai.md +++ b/docs/mirai.md @@ -20,9 +20,9 @@ mirai 项目整体由 核心 (`mirai-core`) 与 控制台(`mirai-console`) 组成. -- [`mirai-core`](../mirai-core) 是机器人服务支持**库**. 提供所有机器人相关 API. **本身只包含抽象类和接口, 使用时还需要同时依赖协议模块**. +- [`mirai-core`](../mirai-core-api) 是机器人服务支持**库**. 提供所有机器人相关 API. **本身只包含抽象类和接口, 使用时还需要同时依赖协议模块**. 可用的协议模块: - - [`mirai-core-qqandroid`](../mirai-core-qqandroid): Android QQ 8.3.0 版本协议实现. + - [`mirai-core-qqandroid`](../mirai-core): Android QQ 8.3.0 版本协议实现. `mirai-core` 设计为一个 **`支持库`**, 意味着它可以被独立依赖, 在任意项目中使用. 详见下文. diff --git a/gradle/api-validation.gradle b/gradle/api-validation.gradle index c18c40cdc..c3434f235 100644 --- a/gradle/api-validation.gradle +++ b/gradle/api-validation.gradle @@ -5,9 +5,9 @@ apiValidation { ] ignoredPackages += [ - "net.mamoe.mirai.qqandroid.contact", - "net.mamoe.mirai.qqandroid.message", - "net.mamoe.mirai.qqandroid.network", - "net.mamoe.mirai.qqandroid.utils" + "net.mamoe.mirai.internal.contact", + "net.mamoe.mirai.internal.message", + "net.mamoe.mirai.internal.network", + "net.mamoe.mirai.internal.utils" ] } \ No newline at end of file diff --git a/java-compatibility-validator/build.gradle.kts b/java-compatibility-validator/build.gradle.kts deleted file mode 100644 index 46f1024f8..000000000 --- a/java-compatibility-validator/build.gradle.kts +++ /dev/null @@ -1,47 +0,0 @@ -@file:Suppress("UNUSED_VARIABLE") - -plugins { - kotlin("jvm") - java -} - -description = "Java compatibility validator for mirai-core and mirai-core-qqandroid" - -repositories { - mavenCentral() - jcenter() -} - -kotlin { - sourceSets { - all { - languageSettings.enableLanguageFeature("InlineClasses") - languageSettings.useExperimentalAnnotation("kotlin.Experimental") - } - - main { - dependencies { - api(kotlin("stdlib", Versions.Kotlin.stdlib)) - api(project(":mirai-core-qqandroid")) - } - } - - test { - dependencies { - api(kotlin("stdlib", Versions.Kotlin.stdlib)) - api(kotlin("test")) - api(kotlin("test-junit")) - api(project(":mirai-core-qqandroid")) - } - } - } -} - -tasks.withType { - kotlinOptions.jvmTarget = "1.8" -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} \ No newline at end of file diff --git a/java-compatibility-validator/src/main/java/test/MPPCompatibilityTest.java b/java-compatibility-validator/src/main/java/test/MPPCompatibilityTest.java deleted file mode 100644 index c86fb687d..000000000 --- a/java-compatibility-validator/src/main/java/test/MPPCompatibilityTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package test; - -import net.mamoe.mirai.Bot; -import net.mamoe.mirai.contact.Contact; -import net.mamoe.mirai.contact.QQ; - -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ -public class MPPCompatibilityTest { - public static void main(String[] args) { - final QQ next = Bot.getInstances().get(0).getFriends().iterator().next(); - ((Contact) next).sendMessage(""); - } -} diff --git a/mirai-core-all/build.gradle.kts b/mirai-core-all/build.gradle.kts index d5d00c41a..d396a559c 100644 --- a/mirai-core-all/build.gradle.kts +++ b/mirai-core-all/build.gradle.kts @@ -54,7 +54,7 @@ kotlin { dependencies { api(project(":mirai-core")) - api(project(":mirai-core-qqandroid")) + api(project(":mirai-core-api")) } setupPublishing("mirai-core-all") \ No newline at end of file diff --git a/mirai-core-api/README.md b/mirai-core-api/README.md new file mode 100644 index 000000000..7c659728c --- /dev/null +++ b/mirai-core-api/README.md @@ -0,0 +1,10 @@ +# mirai-core + +mirai 的核心公开 API. + +mirai 为多协议设计, `mirai-core` 只提供基础框架和抽象数据类. +具体的各协议实现为 `mirai-core-PROTOCOL`, 这些协议模块都继承自 `mirai-core`. + +可用的协议模块: +- [`mirai-core-qqandroid`](../mirai-core): Android QQ 8.3.0 版本协议实现. + diff --git a/mirai-core-qqandroid/build.gradle.kts b/mirai-core-api/build.gradle.kts similarity index 77% rename from mirai-core-qqandroid/build.gradle.kts rename to mirai-core-api/build.gradle.kts index 4dd5ade6f..a27495b7a 100644 --- a/mirai-core-qqandroid/build.gradle.kts +++ b/mirai-core-api/build.gradle.kts @@ -4,16 +4,19 @@ plugins { kotlin("multiplatform") id("kotlinx-atomicfu") kotlin("plugin.serialization") + id("signing") id("net.mamoe.kotlin-jvm-blocking-bridge") `maven-publish` id("com.jfrog.bintray") } -description = "Mirai Protocol implementation for QQ Android" +description = "Mirai API module" val isAndroidSDKAvailable: Boolean by project kotlin { + explicitApi() + if (isAndroidSDKAvailable) { apply(from = rootProject.file("gradle/android.gradle")) android("android") { @@ -34,7 +37,8 @@ kotlin { ) } - jvm("jvm") { + jvm { + // withJava() // https://youtrack.jetbrains.com/issue/KT-39991 } sourceSets.apply { @@ -52,41 +56,50 @@ kotlin { languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.UnstableExternalImage") languageSettings.progressiveMode = true - - dependencies { - api(project(":mirai-core")) - } } val commonMain by getting { dependencies { + api(kotlin("serialization")) + api(kotlin("reflect")) + api1(kotlinx("serialization-core", Versions.Kotlin.serialization)) - api(kotlinx("coroutines-core", Versions.Kotlin.coroutines)) implementation1(kotlinx("serialization-protobuf", Versions.Kotlin.serialization)) - api1("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}") api1(kotlinx("io", Versions.Kotlin.io)) - implementation1(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo)) + api1(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo)) + api(kotlinx("coroutines-core", Versions.Kotlin.coroutines)) + + implementation1("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}") + + api1(ktor("client-cio")) + api1(ktor("client-core")) + api1(ktor("network")) } } - val commonTest by getting { + commonTest { dependencies { implementation(kotlin("test-annotations-common")) implementation(kotlin("test-common")) - implementation(kotlin("script-runtime")) } } if (isAndroidSDKAvailable) { val androidMain by getting { dependencies { + api(kotlin("reflect")) + + api1(kotlinx("io-jvm", Versions.Kotlin.io)) + api1(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo)) + + api1(ktor("client-android", Versions.Kotlin.ktor)) } } val androidTest by getting { dependencies { - implementation(kotlin("test", Versions.Kotlin.compiler)) - implementation(kotlin("test-junit", Versions.Kotlin.compiler)) + implementation(kotlin("test")) + implementation(kotlin("test-junit")) implementation(kotlin("test-annotations-common")) implementation(kotlin("test-common")) } @@ -95,18 +108,23 @@ kotlin { val jvmMain by getting { dependencies { - implementation("org.bouncycastle:bcprov-jdk15on:1.64") + api(kotlin("reflect")) + compileOnly("org.apache.logging.log4j:log4j-api:" + Versions.Logging.log4j) + compileOnly("org.slf4j:slf4j-api:" + Versions.Logging.slf4j) + + api1(ktor("client-core-jvm", Versions.Kotlin.ktor)) api1(kotlinx("io-jvm", Versions.Kotlin.io)) - // api(kotlinx("coroutines-debug", Versions.Kotlin.coroutines)) + api1(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo)) } } val jvmTest by getting { dependencies { - dependsOn(commonTest) - implementation(kotlin("test", Versions.Kotlin.compiler)) - implementation(kotlin("test-junit", Versions.Kotlin.compiler)) + implementation(kotlin("test")) + implementation(kotlin("test-junit")) implementation("org.pcap4j:pcap4j-distribution:1.8.2") + + runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE } } } @@ -132,7 +150,6 @@ fun org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler.api1(dependencyNo apply(from = rootProject.file("gradle/publish.gradle")) - tasks.withType { doFirst { publishing.publications diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt b/mirai-core-api/src/commonMain/kotlin/Bot.kt similarity index 99% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt rename to mirai-core-api/src/commonMain/kotlin/Bot.kt index b8c5956a8..2fbca4e8b 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt +++ b/mirai-core-api/src/commonMain/kotlin/Bot.kt @@ -6,7 +6,6 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "EXPERIMENTAL_API_USAGE", "unused", "FunctionName", "NOTHING_TO_INLINE", "UnusedImport", "EXPERIMENTAL_OVERRIDE", "CanBeParameter", "MemberVisibilityCanBePrivate" @@ -236,7 +235,7 @@ public abstract class Bot internal constructor( @PlannedRemoval("1.2.0") @Deprecated( "use extension.", - replaceWith = ReplaceWith("image.queryUrl()", imports = ["net.mamoe.mirai.message.data.queryUrl"]), + replaceWith = ReplaceWith("image.queryUrl()", imports = ["queryUrl"]), level = DeprecationLevel.ERROR ) @JvmSynthetic diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotFactory.kt b/mirai-core-api/src/commonMain/kotlin/BotFactory.kt similarity index 99% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotFactory.kt rename to mirai-core-api/src/commonMain/kotlin/BotFactory.kt index bd4dde5e8..0dcfe01dc 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotFactory.kt +++ b/mirai-core-api/src/commonMain/kotlin/BotFactory.kt @@ -6,7 +6,6 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") package net.mamoe.mirai diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt b/mirai-core-api/src/commonMain/kotlin/contact/Contact.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt rename to mirai-core-api/src/commonMain/kotlin/contact/Contact.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt b/mirai-core-api/src/commonMain/kotlin/contact/ContactList.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt rename to mirai-core-api/src/commonMain/kotlin/contact/ContactList.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactOrBot.kt b/mirai-core-api/src/commonMain/kotlin/contact/ContactOrBot.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactOrBot.kt rename to mirai-core-api/src/commonMain/kotlin/contact/ContactOrBot.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Exceptions.kt b/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Exceptions.kt rename to mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Friend.kt b/mirai-core-api/src/commonMain/kotlin/contact/Friend.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Friend.kt rename to mirai-core-api/src/commonMain/kotlin/contact/Friend.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt b/mirai-core-api/src/commonMain/kotlin/contact/Group.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt rename to mirai-core-api/src/commonMain/kotlin/contact/Group.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/JavaFriendly.common.kt b/mirai-core-api/src/commonMain/kotlin/contact/JavaFriendly.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/JavaFriendly.common.kt rename to mirai-core-api/src/commonMain/kotlin/contact/JavaFriendly.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt b/mirai-core-api/src/commonMain/kotlin/contact/Member.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt rename to mirai-core-api/src/commonMain/kotlin/contact/Member.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MemberPermission.kt b/mirai-core-api/src/commonMain/kotlin/contact/MemberPermission.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MemberPermission.kt rename to mirai-core-api/src/commonMain/kotlin/contact/MemberPermission.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/User.kt b/mirai-core-api/src/commonMain/kotlin/contact/User.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/User.kt rename to mirai-core-api/src/commonMain/kotlin/contact/User.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/FriendInfo.kt b/mirai-core-api/src/commonMain/kotlin/data/FriendInfo.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/FriendInfo.kt rename to mirai-core-api/src/commonMain/kotlin/data/FriendInfo.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupActiveData.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupActiveData.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupActiveData.kt rename to mirai-core-api/src/commonMain/kotlin/data/GroupActiveData.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupAnnouncement.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupAnnouncement.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupAnnouncement.kt rename to mirai-core-api/src/commonMain/kotlin/data/GroupAnnouncement.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupHonorListData.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupHonorListData.kt similarity index 97% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupHonorListData.kt rename to mirai-core-api/src/commonMain/kotlin/data/GroupHonorListData.kt index 356b121d7..79f11792d 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupHonorListData.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/GroupHonorListData.kt @@ -1,6 +1,9 @@ package net.mamoe.mirai.data -import kotlinx.serialization.* +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.Serializer import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupInfo.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt rename to mirai-core-api/src/commonMain/kotlin/data/GroupInfo.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/MemberInfo.kt b/mirai-core-api/src/commonMain/kotlin/data/MemberInfo.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/MemberInfo.kt rename to mirai-core-api/src/commonMain/kotlin/data/MemberInfo.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/OnlineStatus.kt b/mirai-core-api/src/commonMain/kotlin/data/OnlineStatus.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/OnlineStatus.kt rename to mirai-core-api/src/commonMain/kotlin/data/OnlineStatus.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt b/mirai-core-api/src/commonMain/kotlin/data/Profile.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt rename to mirai-core-api/src/commonMain/kotlin/data/Profile.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/Event.kt b/mirai-core-api/src/commonMain/kotlin/event/Event.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/Event.kt rename to mirai-core-api/src/commonMain/kotlin/event/Event.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/MessageSubscribersBuilder.kt b/mirai-core-api/src/commonMain/kotlin/event/MessageSubscribersBuilder.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/MessageSubscribersBuilder.kt rename to mirai-core-api/src/commonMain/kotlin/event/MessageSubscribersBuilder.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/deprecated.kt b/mirai-core-api/src/commonMain/kotlin/event/deprecated.kt similarity index 99% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/deprecated.kt rename to mirai-core-api/src/commonMain/kotlin/event/deprecated.kt index dfa26edca..92b89db4c 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/deprecated.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/deprecated.kt @@ -37,7 +37,7 @@ import kotlin.jvm.JvmName // // //// -//// 此文件存放所有 `net.mamoe.mirai.event.subscribeMessages` 已弃用的函数. +//// 此文件存放所有 `subscribeMessages` 已弃用的函数. //// // // diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/EventCancelledException.kt b/mirai-core-api/src/commonMain/kotlin/event/events/EventCancelledException.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/EventCancelledException.kt rename to mirai-core-api/src/commonMain/kotlin/event/events/EventCancelledException.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/README.md b/mirai-core-api/src/commonMain/kotlin/event/events/README.md similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/README.md rename to mirai-core-api/src/commonMain/kotlin/event/events/README.md diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/bot.kt b/mirai-core-api/src/commonMain/kotlin/event/events/bot.kt similarity index 98% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/bot.kt rename to mirai-core-api/src/commonMain/kotlin/event/events/bot.kt index 2db8de6aa..ac751d5b3 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/bot.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/bot.kt @@ -16,8 +16,8 @@ package net.mamoe.mirai.event.events import net.mamoe.mirai.Bot import net.mamoe.mirai.contact.User import net.mamoe.mirai.event.AbstractEvent +import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.message.action.Nudge -import net.mamoe.mirai.qqandroid.network.Packet import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.SinceMirai diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/friend.kt b/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt similarity index 98% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/friend.kt rename to mirai-core-api/src/commonMain/kotlin/event/events/friend.kt index 41cbc64d5..17afdc514 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/friend.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt @@ -20,7 +20,7 @@ import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.User import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.internal.MiraiAtomicBoolean -import net.mamoe.mirai.qqandroid.network.Packet +import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.internal.runBlocking import kotlin.jvm.* diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/group.kt b/mirai-core-api/src/commonMain/kotlin/event/events/group.kt similarity index 99% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/group.kt rename to mirai-core-api/src/commonMain/kotlin/event/events/group.kt index 5616c6605..e6ed888bd 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/group.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/group.kt @@ -22,8 +22,8 @@ import net.mamoe.mirai.contact.MemberPermission import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.BroadcastControllable import net.mamoe.mirai.event.internal.MiraiAtomicBoolean +import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.message.action.Nudge -import net.mamoe.mirai.qqandroid.network.Packet import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.internal.runBlocking diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/message.kt b/mirai-core-api/src/commonMain/kotlin/event/events/message.kt similarity index 96% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/message.kt rename to mirai-core-api/src/commonMain/kotlin/event/events/message.kt index 83c3ea23f..98f4fddfc 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/message.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/message.kt @@ -19,12 +19,12 @@ import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.CancellableEvent import net.mamoe.mirai.event.events.ImageUploadEvent.Failed import net.mamoe.mirai.event.events.ImageUploadEvent.Succeed +import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.data.Image import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.MessageSource -import net.mamoe.mirai.qqandroid.network.Packet import net.mamoe.mirai.utils.ExternalImage import net.mamoe.mirai.utils.PlannedRemoval import net.mamoe.mirai.utils.SinceMirai @@ -403,7 +403,7 @@ public sealed class ImageUploadEvent : BotEvent, BotActiveEvent, AbstractEvent() message = """ 以 MessagePreSendEvent 和 MessagePostSendEvent 替换. """, - replaceWith = ReplaceWith("MessagePreSendEvent", "net.mamoe.mirai.event.events.MessagePreSendEvent"), + replaceWith = ReplaceWith("MessagePreSendEvent", "MessagePreSendEvent"), level = DeprecationLevel.WARNING ) public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent() { @@ -415,7 +415,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent() message = """ 以 GroupMessagePreSendEvent 和 GroupMessagePostSendEvent 替换. """, - replaceWith = ReplaceWith("GroupMessagePreSendEvent", "net.mamoe.mirai.event.events.GroupMessagePreSendEvent"), + replaceWith = ReplaceWith("GroupMessagePreSendEvent", "GroupMessagePreSendEvent"), level = DeprecationLevel.WARNING ) public data class GroupMessageSendEvent internal constructor( @@ -429,7 +429,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent() """, replaceWith = ReplaceWith( "FriendMessagePreSendEvent", - "net.mamoe.mirai.event.events.FriendMessagePreSendEvent" + "FriendMessagePreSendEvent" ), level = DeprecationLevel.WARNING ) @@ -442,7 +442,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent() message = """ 以 TempMessagePreSendEvent 和 TempMessagePostSendEvent 替换. """, - replaceWith = ReplaceWith("TempMessagePreSendEvent", "net.mamoe.mirai.event.events.TempMessagePreSendEvent"), + replaceWith = ReplaceWith("TempMessagePreSendEvent", "TempMessagePreSendEvent"), level = DeprecationLevel.WARNING ) public data class TempMessageSendEvent internal constructor( diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/types.kt b/mirai-core-api/src/commonMain/kotlin/event/events/types.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/types.kt rename to mirai-core-api/src/commonMain/kotlin/event/events/types.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt b/mirai-core-api/src/commonMain/kotlin/event/internal/InternalEventListeners.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt rename to mirai-core-api/src/commonMain/kotlin/event/internal/InternalEventListeners.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/messageSubscribersInternal.kt b/mirai-core-api/src/commonMain/kotlin/event/internal/messageSubscribersInternal.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/messageSubscribersInternal.kt rename to mirai-core-api/src/commonMain/kotlin/event/internal/messageSubscribersInternal.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/linear.kt b/mirai-core-api/src/commonMain/kotlin/event/linear.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/linear.kt rename to mirai-core-api/src/commonMain/kotlin/event/linear.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/nextEvent.kt b/mirai-core-api/src/commonMain/kotlin/event/nextEvent.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/nextEvent.kt rename to mirai-core-api/src/commonMain/kotlin/event/nextEvent.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/select.kt b/mirai-core-api/src/commonMain/kotlin/event/select.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/select.kt rename to mirai-core-api/src/commonMain/kotlin/event/select.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt b/mirai-core-api/src/commonMain/kotlin/event/subscribeMessages.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt rename to mirai-core-api/src/commonMain/kotlin/event/subscribeMessages.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt b/mirai-core-api/src/commonMain/kotlin/event/subscriber.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt rename to mirai-core-api/src/commonMain/kotlin/event/subscriber.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriberDeprecated.kt b/mirai-core-api/src/commonMain/kotlin/event/subscriberDeprecated.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriberDeprecated.kt rename to mirai-core-api/src/commonMain/kotlin/event/subscriberDeprecated.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/javaFriendly.kt b/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt similarity index 99% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/javaFriendly.kt rename to mirai-core-api/src/commonMain/kotlin/javaFriendly.kt index eff6c5eec..ea0b20217 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/javaFriendly.kt +++ b/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt @@ -6,7 +6,6 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - package net.mamoe.mirai /** diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt b/mirai-core-api/src/commonMain/kotlin/lowLevelApi.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt rename to mirai-core-api/src/commonMain/kotlin/lowLevelApi.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/FriendMessageEvent.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/FriendMessageEvent.kt rename to mirai-core-api/src/commonMain/kotlin/message/FriendMessageEvent.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/GroupMessageEvent.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/GroupMessageEvent.kt rename to mirai-core-api/src/commonMain/kotlin/message/GroupMessageEvent.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/MessageEvent.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageEvent.kt rename to mirai-core-api/src/commonMain/kotlin/message/MessageEvent.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageReceipt.kt b/mirai-core-api/src/commonMain/kotlin/message/MessageReceipt.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessageReceipt.kt rename to mirai-core-api/src/commonMain/kotlin/message/MessageReceipt.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/TempMessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/TempMessageEvent.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/TempMessageEvent.kt rename to mirai-core-api/src/commonMain/kotlin/message/TempMessageEvent.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/action/Nudge.kt b/mirai-core-api/src/commonMain/kotlin/message/action/Nudge.kt similarity index 88% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/action/Nudge.kt rename to mirai-core-api/src/commonMain/kotlin/message/action/Nudge.kt index 927ec79df..078a5d39b 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/action/Nudge.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/action/Nudge.kt @@ -1,14 +1,11 @@ /* + * Copyright 2019-2020 Mamoe Technologies and contributors. * - * * Copyright 2020 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/master/LICENSE + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * + * https://github.com/mamoe/mirai/blob/master/LICENSE */ - package net.mamoe.mirai.message.action import net.mamoe.kjbb.JvmBlockingBridge diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/CodableMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/code/CodableMessage.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/CodableMessage.kt rename to mirai-core-api/src/commonMain/kotlin/message/code/CodableMessage.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/MiraiCode.kt b/mirai-core-api/src/commonMain/kotlin/message/code/MiraiCode.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/MiraiCode.kt rename to mirai-core-api/src/commonMain/kotlin/message/code/MiraiCode.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/internal/impl.kt b/mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/internal/impl.kt rename to mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt b/mirai-core-api/src/commonMain/kotlin/message/data/At.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/At.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/AtAll.kt b/mirai-core-api/src/commonMain/kotlin/message/data/AtAll.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/AtAll.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/AtAll.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CombinedMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/CombinedMessage.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CombinedMessage.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/CombinedMessage.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CustomMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CustomMessage.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Face.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Face.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/Face.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/ForwardMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/ForwardMessage.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/ForwardMessage.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/ForwardMessage.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/HummerMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/HummerMessage.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/Image.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Message.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/Message.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChainBuilder.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChainBuilder.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChainBuilder.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/MessageChainBuilder.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageSource.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/MessageSource.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSourceBuilder.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageSourceBuilder.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSourceBuilder.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/MessageSourceBuilder.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/PlainText.kt b/mirai-core-api/src/commonMain/kotlin/message/data/PlainText.kt similarity index 95% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/PlainText.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/PlainText.kt index 161e248d3..e64cecaec 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/PlainText.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/PlainText.kt @@ -52,7 +52,7 @@ public data class PlainText( */ @Deprecated( "为和 mirai code 区分, 请使用 PlainText(this)", - ReplaceWith("PlainText(this)", "net.mamoe.mirai.message.data.PlainText"), + ReplaceWith("PlainText(this)", "PlainText"), level = DeprecationLevel.WARNING ) @JvmSynthetic diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt b/mirai-core-api/src/commonMain/kotlin/message/data/QuoteReply.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/QuoteReply.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/README.md b/mirai-core-api/src/commonMain/kotlin/message/data/README.md similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/README.md rename to mirai-core-api/src/commonMain/kotlin/message/data/README.md diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/RichMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/RichMessage.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Voice.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Voice.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Voice.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/Voice.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/imageDeprecated.kt b/mirai-core-api/src/commonMain/kotlin/message/data/imageDeprecated.kt similarity index 91% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/imageDeprecated.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/imageDeprecated.kt index dd8296694..f34a9ca9a 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/imageDeprecated.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/imageDeprecated.kt @@ -48,7 +48,7 @@ internal const val ONLINE_OFFLINE_DEPRECATION_MESSAGE = """ @Deprecated( ONLINE_OFFLINE_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") + replaceWith = ReplaceWith("Image", "Image") ) @Suppress("EXPOSED_SUPER_INTERFACE") public interface OnlineImage : Image, ConstOriginUrlAware { @@ -69,7 +69,7 @@ public interface OnlineImage : Image, ConstOriginUrlAware { @Deprecated( ONLINE_OFFLINE_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") + replaceWith = ReplaceWith("Image", "Image") ) public interface OfflineImage : Image { public companion object Key : Message.Key { @@ -96,7 +96,7 @@ public suspend fun OfflineImage.queryUrl(): String { @Deprecated( ONLINE_OFFLINE_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") + replaceWith = ReplaceWith("Image", "Image") ) @Serializable public data class OfflineGroupImage( @@ -124,7 +124,7 @@ public data class OfflineGroupImage( @Deprecated( ONLINE_OFFLINE_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") + replaceWith = ReplaceWith("Image", "Image") ) public abstract class OnlineGroupImage : GroupImage(), OnlineImage @@ -137,7 +137,7 @@ public abstract class OnlineGroupImage : GroupImage(), OnlineImage @Deprecated( ONLINE_OFFLINE_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") + replaceWith = ReplaceWith("Image", "Image") ) @Serializable public data class OfflineFriendImage( @@ -161,7 +161,7 @@ public data class OfflineFriendImage( @Deprecated( ONLINE_OFFLINE_DEPRECATION_MESSAGE, level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") + replaceWith = ReplaceWith("Image", "Image") ) public abstract class OnlineFriendImage : FriendImage(), OnlineImage diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/impl.kt b/mirai-core-api/src/commonMain/kotlin/message/data/impl.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/impl.kt rename to mirai-core-api/src/commonMain/kotlin/message/data/impl.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/deprecated.kt b/mirai-core-api/src/commonMain/kotlin/message/deprecated.kt similarity index 87% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/deprecated.kt rename to mirai-core-api/src/commonMain/kotlin/message/deprecated.kt index 43ff1ab39..1d2dc5ed5 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/deprecated.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/deprecated.kt @@ -23,9 +23,9 @@ import net.mamoe.mirai.Bot import net.mamoe.mirai.contact.* import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.events.BotEvent +import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.OnlineMessageSource -import net.mamoe.mirai.qqandroid.network.Packet import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName @@ -35,7 +35,7 @@ import kotlin.jvm.JvmName */ @Deprecated( message = "use MessageEvent", - replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"), + replaceWith = ReplaceWith("MessageEvent", "MessageEvent"), level = DeprecationLevel.HIDDEN ) public abstract class MessagePacketBase : Packet, BotEvent, @@ -51,7 +51,7 @@ public abstract class MessagePacketBase(), @Deprecated( message = "Ambiguous name. Use MessageEvent instead", - replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"), + replaceWith = ReplaceWith("MessageEvent", "MessageEvent"), level = DeprecationLevel.HIDDEN ) @Suppress("DEPRECATION_ERROR") @@ -85,7 +85,7 @@ public abstract class ContactMessage : MessagePacket(), @Deprecated( message = "Ambiguous name. Use FriendMessageEvent instead", - replaceWith = ReplaceWith("FriendMessageEvent", "net.mamoe.mirai.message.FriendMessageEvent"), + replaceWith = ReplaceWith("FriendMessageEvent", "FriendMessageEvent"), level = DeprecationLevel.HIDDEN ) @Suppress("DEPRECATION_ERROR") @@ -101,7 +101,7 @@ public abstract class FriendMessage : MessageEvent() { @Deprecated( message = "Ambiguous name. Use GroupMessageEvent instead", - replaceWith = ReplaceWith("GroupMessageEvent", "net.mamoe.mirai.message.GroupMessageEvent"), + replaceWith = ReplaceWith("GroupMessageEvent", "GroupMessageEvent"), level = DeprecationLevel.HIDDEN ) @Suppress("DEPRECATION_ERROR") @@ -118,7 +118,7 @@ public abstract class GroupMessage : MessageEvent() { @Deprecated( message = "Ambiguous name. Use TempMessageEvent instead", - replaceWith = ReplaceWith("TempMessageEvent", "net.mamoe.mirai.message.TempMessageEvent"), + replaceWith = ReplaceWith("TempMessageEvent", "TempMessageEvent"), level = DeprecationLevel.HIDDEN ) public abstract class TempMessage : MessageEvent() { diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/utils.kt b/mirai-core-api/src/commonMain/kotlin/message/utils.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/utils.kt rename to mirai-core-api/src/commonMain/kotlin/message/utils.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/ForceOfflineException.kt b/mirai-core-api/src/commonMain/kotlin/network/ForceOfflineException.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/ForceOfflineException.kt rename to mirai-core-api/src/commonMain/kotlin/network/ForceOfflineException.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/LoginFailedException.kt b/mirai-core-api/src/commonMain/kotlin/network/LoginFailedException.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/LoginFailedException.kt rename to mirai-core-api/src/commonMain/kotlin/network/LoginFailedException.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/qqandroid.network/Packet.kt b/mirai-core-api/src/commonMain/kotlin/qqandroid.network/Packet.kt similarity index 95% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/qqandroid.network/Packet.kt rename to mirai-core-api/src/commonMain/kotlin/qqandroid.network/Packet.kt index 4be6949e2..895f29039 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/qqandroid.network/Packet.kt +++ b/mirai-core-api/src/commonMain/kotlin/qqandroid.network/Packet.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network +package net.mamoe.mirai.internal.network import net.mamoe.mirai.event.Event import net.mamoe.mirai.utils.MiraiInternalAPI diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/Annotations.kt b/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/Annotations.kt rename to mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/Channels.kt b/mirai-core-api/src/commonMain/kotlin/utils/Channels.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/Channels.kt rename to mirai-core-api/src/commonMain/kotlin/utils/Channels.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/Context.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/Context.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/Context.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/Context.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/DeviceInfo.kt b/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/DeviceInfo.kt rename to mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt b/mirai-core-api/src/commonMain/kotlin/utils/ExternalImage.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt rename to mirai-core-api/src/commonMain/kotlin/utils/ExternalImage.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/FileCacheStrategy.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/FileCacheStrategy.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LazyProperty.kt b/mirai-core-api/src/commonMain/kotlin/utils/LazyProperty.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LazyProperty.kt rename to mirai-core-api/src/commonMain/kotlin/utils/LazyProperty.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt b/mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt rename to mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LoginSolver.kt b/mirai-core-api/src/commonMain/kotlin/utils/LoginSolver.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LoginSolver.kt rename to mirai-core-api/src/commonMain/kotlin/utils/LoginSolver.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/MiraiLogger.kt b/mirai-core-api/src/commonMain/kotlin/utils/MiraiLogger.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/MiraiLogger.kt rename to mirai-core-api/src/commonMain/kotlin/utils/MiraiLogger.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/OverFileSizeMaxException.kt b/mirai-core-api/src/commonMain/kotlin/utils/OverFileSizeMaxException.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/OverFileSizeMaxException.kt rename to mirai-core-api/src/commonMain/kotlin/utils/OverFileSizeMaxException.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/SoftRef.kt b/mirai-core-api/src/commonMain/kotlin/utils/SoftRef.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/SoftRef.kt rename to mirai-core-api/src/commonMain/kotlin/utils/SoftRef.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/SystemDeviceInfo.kt b/mirai-core-api/src/commonMain/kotlin/utils/SystemDeviceInfo.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/SystemDeviceInfo.kt rename to mirai-core-api/src/commonMain/kotlin/utils/SystemDeviceInfo.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/TimeUtils.kt b/mirai-core-api/src/commonMain/kotlin/utils/TimeUtils.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/TimeUtils.kt rename to mirai-core-api/src/commonMain/kotlin/utils/TimeUtils.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/WeakRef.kt b/mirai-core-api/src/commonMain/kotlin/utils/WeakRef.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/WeakRef.kt rename to mirai-core-api/src/commonMain/kotlin/utils/WeakRef.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/ChunkedFlowSession.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/ChunkedFlowSession.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/ChunkedFlowSession.kt rename to mirai-core-api/src/commonMain/kotlin/utils/internal/ChunkedFlowSession.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/DeferredReusableInput.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/DeferredReusableInput.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/DeferredReusableInput.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/internal/DeferredReusableInput.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/ReusableInput.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/ReusableInput.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/ReusableInput.kt rename to mirai-core-api/src/commonMain/kotlin/utils/internal/ReusableInput.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/asReusableInput.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/asReusableInput.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/asReusableInput.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/internal/asReusableInput.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/md5.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/md5.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/md5.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/internal/md5.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/retryCatching.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/retryCatching.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/retryCatching.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/internal/retryCatching.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/runBlocking.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/runBlocking.common.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/internal/runBlocking.common.kt rename to mirai-core-api/src/commonMain/kotlin/utils/internal/runBlocking.common.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/BufferedInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/BufferedInputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/BufferedOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/BufferedOutputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/ByteArrayInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/ByteArrayInputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/ByteArrayOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt similarity index 75% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/ByteArrayOutputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt index c01d87bb9..5f909e097 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/ByteArrayOutputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") /** diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/Closeable.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt similarity index 86% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/Closeable.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt index 8e94a250a..c77b71bc7 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/Closeable.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") /** diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/DataInput.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/DataInput.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/DataOutput.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/DataOutput.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/EOFException.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/EOFException.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/File.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt similarity index 89% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/File.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt index 5e87fbcac..59c25b582 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/File.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt @@ -1,14 +1,11 @@ /* + * Copyright 2019-2020 Mamoe Technologies and contributors. * - * * Copyright 2020 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/master/LICENSE + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * + * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "unused", "NO_ACTUAL_FOR_EXPECT", diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FileDescriptor.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FileDescriptor.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FileInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FileInputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FileOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FileOutputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FilterInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FilterInputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FilterOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/FilterOutputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/IOException.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/IOException.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/InputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/InputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/ObjectInput.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/ObjectInput.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/OutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt similarity index 78% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/OutputStream.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt index bae5375a2..87025f2cb 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/OutputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") /** diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/WeakRefAndroid.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt similarity index 55% rename from mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/WeakRefAndroid.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt index 9d22c42b1..6b9bb0c3d 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/WeakRefAndroid.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt @@ -6,9 +6,20 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ +@file:Suppress( + "unused", + "NO_ACTUAL_FOR_EXPECT", + "PackageDirectoryMismatch", + "NON_FINAL_MEMBER_IN_FINAL_CLASS", + "VIRTUAL_MEMBER_HIDDEN" +) -package net.mamoe.mirai.utils +/** + * Bindings for JDK. + * + * All the sources are copied from OpenJDK. Copyright OpenJDK authors. + */ -import java.lang.ref.WeakReference +package java.io -actual typealias WeakRef = WeakReference \ No newline at end of file +public expect interface Serializable \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Inet4Address.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Inet4Address.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Inet6Address.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Inet6Address.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/InetAddress.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/InetAddress.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/InetSocketAddress.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/InetSocketAddress.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Proxy.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt similarity index 80% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Proxy.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt index 18c05279c..9170dcbe0 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Proxy.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "unused", "NO_ACTUAL_FOR_EXPECT", diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Socket.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/Socket.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketAddress.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketAddress.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketException.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketException.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketOption.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketOption.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketOptions.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/SocketOptions.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URI.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt similarity index 91% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URI.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt index 97e5896d5..e069d19d9 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URI.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "unused", "NO_ACTUAL_FOR_EXPECT", diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URL.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt similarity index 91% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URL.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt index 062ce28c3..ca746cc43 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URL.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "unused", "NO_ACTUAL_FOR_EXPECT", diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URLConnection.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt similarity index 95% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URLConnection.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt index 2eb6fbeb0..1534f5b49 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/net/URLConnection.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "unused", "NO_ACTUAL_FOR_EXPECT", diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Buffer.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt similarity index 97% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Buffer.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt index 6baebc72a..f9e58b6c3 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Buffer.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt @@ -1,14 +1,11 @@ /* + * Copyright 2019-2020 Mamoe Technologies and contributors. * - * * Copyright 2020 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/master/LICENSE - * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") /** diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/ByteBuffer.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt similarity index 99% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/ByteBuffer.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt index 57282a075..ab1c69995 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/ByteBuffer.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") /** diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/ByteOrder.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt similarity index 89% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/ByteOrder.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt index 431bab313..bc989f909 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/ByteOrder.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt @@ -1,12 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") /** diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/FileSystem.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/FileSystem.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Path.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt similarity index 84% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Path.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt index 963011193..c52da3677 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Path.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt @@ -1,14 +1,11 @@ /* + * Copyright 2019-2020 Mamoe Technologies and contributors. * - * * Copyright 2020 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/master/LICENSE + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * + * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "unused", "NO_ACTUAL_FOR_EXPECT", diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Paths.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Paths.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.kt diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Watchable.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.kt similarity index 100% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/nio/Watchable.kt rename to mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.kt diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/CombinedMessageTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/CombinedMessageTest.kt similarity index 82% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/CombinedMessageTest.kt rename to mirai-core-api/src/commonTest/kotlin/message.data/CombinedMessageTest.kt index 7df42f35e..b92a8b834 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/CombinedMessageTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/CombinedMessageTest.kt @@ -1,4 +1,12 @@ -package net.mamoe.mirai.message.data +/* + * Copyright 2019-2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ +package net.mamoe.mirai.message.data import kotlin.test.Test import kotlin.test.assertEquals diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ConstrainSingleTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/ConstrainSingleTest.kt similarity index 99% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ConstrainSingleTest.kt rename to mirai-core-api/src/commonTest/kotlin/message.data/ConstrainSingleTest.kt index 91d7ccbc2..928c6e941 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ConstrainSingleTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/ConstrainSingleTest.kt @@ -6,8 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -package net.mamoe.mirai.message.data +package net.mamoe.mirai.message.data import kotlin.test.Test import kotlin.test.assertEquals diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ContentEqualsTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/ContentEqualsTest.kt similarity index 98% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ContentEqualsTest.kt rename to mirai-core-api/src/commonTest/kotlin/message.data/ContentEqualsTest.kt index 9c4885806..e173767a3 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ContentEqualsTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/ContentEqualsTest.kt @@ -6,8 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -package net.mamoe.mirai.message.data +package net.mamoe.mirai.message.data import kotlin.test.Test import kotlin.test.assertFalse diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ImageTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/ImageTest.kt similarity index 98% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ImageTest.kt rename to mirai-core-api/src/commonTest/kotlin/message.data/ImageTest.kt index 1c492f521..de218d050 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/ImageTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/ImageTest.kt @@ -6,10 +6,9 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("EXPERIMENTAL_API_USAGE") -package net.mamoe.mirai.message.data +package net.mamoe.mirai.message.data import kotlin.test.Test import kotlin.test.assertEquals diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/MessageChainBuilderTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/MessageChainBuilderTest.kt similarity index 97% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/MessageChainBuilderTest.kt rename to mirai-core-api/src/commonTest/kotlin/message.data/MessageChainBuilderTest.kt index 009292a1a..36da61dbd 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/MessageChainBuilderTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/MessageChainBuilderTest.kt @@ -6,8 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -package net.mamoe.mirai.message.data +package net.mamoe.mirai.message.data import kotlin.test.Test import kotlin.test.assertEquals diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/MessageUtilsTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/MessageUtilsTest.kt similarity index 95% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/MessageUtilsTest.kt rename to mirai-core-api/src/commonTest/kotlin/message.data/MessageUtilsTest.kt index 31512df54..1c9ba8969 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/MessageUtilsTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/MessageUtilsTest.kt @@ -6,8 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -package net.mamoe.mirai.message.data +package net.mamoe.mirai.message.data import kotlin.test.Test import kotlin.test.assertTrue diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/TestMessageChainDelegate.kt b/mirai-core-api/src/commonTest/kotlin/message.data/TestMessageChainDelegate.kt similarity index 99% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/TestMessageChainDelegate.kt rename to mirai-core-api/src/commonTest/kotlin/message.data/TestMessageChainDelegate.kt index 8f8908a49..783e68467 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/message.data/TestMessageChainDelegate.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/TestMessageChainDelegate.kt @@ -6,7 +6,6 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - package net.mamoe.mirai.message.data import kotlin.test.Test diff --git a/mirai-core-api/src/commonTest/kotlin/package.kt b/mirai-core-api/src/commonTest/kotlin/package.kt new file mode 100644 index 000000000..a04ac80e4 --- /dev/null +++ b/mirai-core-api/src/commonTest/kotlin/package.kt @@ -0,0 +1,9 @@ +/* + * Copyright 2020 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/master/LICENSE + */ +package net.mamoe.mirai \ No newline at end of file diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/test/TestDSL.kt b/mirai-core-api/src/commonTest/kotlin/test/TestDSL.kt similarity index 99% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/test/TestDSL.kt rename to mirai-core-api/src/commonTest/kotlin/test/TestDSL.kt index 7e503bfbf..980435979 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/test/TestDSL.kt +++ b/mirai-core-api/src/commonTest/kotlin/test/TestDSL.kt @@ -6,7 +6,6 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("NOTHING_TO_INLINE") package net.mamoe.mirai.test diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/platformAndroid.kt b/mirai-core-api/src/commonTest/kotlin/utils/ExternalImageTest.kt similarity index 58% rename from mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/platformAndroid.kt rename to mirai-core-api/src/commonTest/kotlin/utils/ExternalImageTest.kt index b80b6ee7e..d95a68a17 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/platformAndroid.kt +++ b/mirai-core-api/src/commonTest/kotlin/utils/ExternalImageTest.kt @@ -6,14 +6,17 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -@file:Suppress("NOTHING_TO_INLINE") -@file:JvmMultifileClass -@file:JvmName("Utils") - package net.mamoe.mirai.utils -/** - * 时间戳 - */ -actual val currentTimeMillis: Long get() = System.currentTimeMillis() +import kotlin.test.Test +import kotlin.test.assertEquals + +internal class ExternalImageTest { + + @Test + fun testByteArrayGet() { + assertEquals("0F", byteArrayOf(0x0f)[0, 0]) + assertEquals("10", byteArrayOf(0x10)[0, 0]) + assertEquals("0FFE", byteArrayOf(0x0F, 0xFE.toByte())[0, 1]) + } +} \ No newline at end of file diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/utils/TimeTest.kt b/mirai-core-api/src/commonTest/kotlin/utils/TimeTest.kt similarity index 83% rename from mirai-core/src/commonTest/kotlin/net/mamoe/mirai/utils/TimeTest.kt rename to mirai-core-api/src/commonTest/kotlin/utils/TimeTest.kt index ea40ae231..85e63e200 100644 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/utils/TimeTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/utils/TimeTest.kt @@ -1,11 +1,11 @@ /* - * Copyright 2020 Mamoe Technologies and contributors. + * Copyright 2019-2020 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. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - package net.mamoe.mirai.utils import kotlin.test.Test diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/BotFactory.kt b/mirai-core-api/src/jvmMain/kotlin/BotFactory.kt similarity index 96% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/BotFactory.kt rename to mirai-core-api/src/jvmMain/kotlin/BotFactory.kt index 4cbef2656..85dbeccf9 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/BotFactory.kt +++ b/mirai-core-api/src/jvmMain/kotlin/BotFactory.kt @@ -25,10 +25,10 @@ import net.mamoe.mirai.utils.SinceMirai * ### 自动选择协议模块并构造 [Bot] * 在 Kotlin 使用包级函数 [Bot], 在 Java 使用 `BotFactoryJvm.newBot` * - * mirai 通过 [Class.forName] 查找可用的协议实现, 如 `net.mamoe.mirai.qqandroid.QQAndroid` + * mirai 通过 [Class.forName] 查找可用的协议实现, 如 `net.mamoe.mirai.internal.QQAndroid` * * ### 手动选择协议模块并构造 [Bot] - * 引用 `net.mamoe.mirai.qqandroid.QQAndroid` 并使用其成员函数 [Bot] + * 引用 `net.mamoe.mirai.internal.QQAndroid` 并使用其成员函数 [Bot] */ public actual interface BotFactory { /** @@ -159,7 +159,7 @@ internal val factory: BotFactory = run { Class.forName("net.mamoe.mirai.timpc.TIMPC").kotlin.objectInstance as BotFactory }.getOrElse { runCatching { - Class.forName("net.mamoe.mirai.qqandroid.QQAndroid").kotlin.objectInstance as BotFactory + Class.forName("net.mamoe.mirai.internal.QQAndroid").kotlin.objectInstance as BotFactory }.getOrNull() } } ?: error( diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/BotJavaFriendlyAPI.kt b/mirai-core-api/src/jvmMain/kotlin/BotJavaFriendlyAPI.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/BotJavaFriendlyAPI.kt rename to mirai-core-api/src/jvmMain/kotlin/BotJavaFriendlyAPI.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt b/mirai-core-api/src/jvmMain/kotlin/contact/ContactJavaFriendlyAPI.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt rename to mirai-core-api/src/jvmMain/kotlin/contact/ContactJavaFriendlyAPI.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/JvmMethodListeners.kt b/mirai-core-api/src/jvmMain/kotlin/event/JvmMethodListeners.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/JvmMethodListeners.kt rename to mirai-core-api/src/jvmMain/kotlin/event/JvmMethodListeners.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/EventInternalJvm.kt b/mirai-core-api/src/jvmMain/kotlin/event/internal/EventInternalJvm.kt similarity index 99% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/EventInternalJvm.kt rename to mirai-core-api/src/jvmMain/kotlin/event/internal/EventInternalJvm.kt index 73d0527b3..a3a5438e9 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/EventInternalJvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/event/internal/EventInternalJvm.kt @@ -49,7 +49,6 @@ internal fun Class._subscribeEventForJaptOnly(scope: CoroutineSco } - @Suppress("UNCHECKED_CAST") internal fun Method.registerEvent( owner: Any, diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/GlobalEventListeners.kt b/mirai-core-api/src/jvmMain/kotlin/event/internal/GlobalEventListeners.kt similarity index 81% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/GlobalEventListeners.kt rename to mirai-core-api/src/jvmMain/kotlin/event/internal/GlobalEventListeners.kt index 5ab3f8828..87d3c1bdf 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/GlobalEventListeners.kt +++ b/mirai-core-api/src/jvmMain/kotlin/event/internal/GlobalEventListeners.kt @@ -18,13 +18,15 @@ internal actual object GlobalEventListeners { private val ALL_LEVEL_REGISTRIES: Map> init { - val map = EnumMap>(Listener.EventPriority::class.java) + val map = + EnumMap>(Listener.EventPriority::class.java) Listener.EventPriority.values().forEach { map[it] = LockFreeLinkedList() } this.ALL_LEVEL_REGISTRIES = map } - actual operator fun get(priority: Listener.EventPriority): LockFreeLinkedList = ALL_LEVEL_REGISTRIES[priority]!! + actual operator fun get(priority: Listener.EventPriority): LockFreeLinkedList = + ALL_LEVEL_REGISTRIES[priority]!! } diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/MiraiAtomicBoolean.kt b/mirai-core-api/src/jvmMain/kotlin/event/internal/MiraiAtomicBoolean.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/event/internal/MiraiAtomicBoolean.kt rename to mirai-core-api/src/jvmMain/kotlin/event/internal/MiraiAtomicBoolean.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageEventPlatform.kt b/mirai-core-api/src/jvmMain/kotlin/message/MessageEventPlatform.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageEventPlatform.kt rename to mirai-core-api/src/jvmMain/kotlin/message/MessageEventPlatform.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/SendImageUtilsJvm.kt b/mirai-core-api/src/jvmMain/kotlin/message/SendImageUtilsJvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/SendImageUtilsJvm.kt rename to mirai-core-api/src/jvmMain/kotlin/message/SendImageUtilsJvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/data/Image.kt b/mirai-core-api/src/jvmMain/kotlin/message/data/Image.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/data/Image.kt rename to mirai-core-api/src/jvmMain/kotlin/message/data/Image.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/deprecated.kt b/mirai-core-api/src/jvmMain/kotlin/message/deprecated.kt similarity index 99% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/deprecated.kt rename to mirai-core-api/src/jvmMain/kotlin/message/deprecated.kt index 94ed456a5..039c44c16 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/deprecated.kt +++ b/mirai-core-api/src/jvmMain/kotlin/message/deprecated.kt @@ -51,7 +51,6 @@ public suspend fun Input.sendAsImageTo(contact: C): MessageReceipt toExternalImage().sendTo(contact) - /** * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片上传后构造 [Image] * @throws OverFileSizeMaxException diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/BotConfiguration.kt b/mirai-core-api/src/jvmMain/kotlin/utils/BotConfiguration.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/BotConfiguration.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/BotConfiguration.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/Context.kt b/mirai-core-api/src/jvmMain/kotlin/utils/Context.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/Context.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/Context.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/ExternalImageJvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/ExternalImageJvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileCacheStrategy.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/FileCacheStrategy.jvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileCacheStrategy.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/FileCacheStrategy.jvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/FileLogger.kt similarity index 94% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileLogger.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/FileLogger.kt index 93166e6f7..83a5cf6c4 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/FileLogger.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/FileLogger.kt @@ -21,7 +21,10 @@ private val currentDate get() = SimpleDateFormat("yyyy-MM-dd").format(Date()) * * @see PlatformLogger 查看格式信息 */ -public class SingleFileLogger @JvmOverloads constructor(identity: String, file: File = File("$identity-$currentDate.log")) : +public class SingleFileLogger @JvmOverloads constructor( + identity: String, + file: File = File("$identity-$currentDate.log") +) : PlatformLogger(identity, { file.appendText(it + "\n") }, false) { init { diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/HyperLinkLabel.kt b/mirai-core-api/src/jvmMain/kotlin/utils/HyperLinkLabel.kt similarity index 59% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/HyperLinkLabel.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/HyperLinkLabel.kt index af6e2b881..ba0bbd1ee 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/HyperLinkLabel.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/HyperLinkLabel.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2019-2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.utils import java.awt.Desktop @@ -11,7 +20,7 @@ import javax.swing.JLabel */ internal class HyperLinkLabel constructor(url: String, text: String) : JLabel() { init { - super.setText("$text"); + super.setText("$text") addMouseListener(object : MouseAdapter() { override fun mouseClicked(e: MouseEvent) { diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/LoggerAdapters.kt b/mirai-core-api/src/jvmMain/kotlin/utils/LoggerAdapters.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/LoggerAdapters.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/LoggerAdapters.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/LoginSolver.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/LoginSolver.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/LoginSolver.swing.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.swing.jvm.kt similarity index 81% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/LoginSolver.swing.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.swing.jvm.kt index b67bb6702..3972579da 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/LoginSolver.swing.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.swing.jvm.kt @@ -15,36 +15,37 @@ import java.net.URI import javax.imageio.ImageIO import javax.swing.ImageIcon import javax.swing.JLabel -import javax.swing.JTextField /** * @author Karlatemp */ @MiraiExperimentalAPI public object SwingSolver : LoginSolver() { - public override suspend fun onSolvePicCaptcha(bot: Bot, data: ByteArray): String? { + public override suspend fun onSolvePicCaptcha(bot: Bot, data: ByteArray): String? { return openWindow("Mirai PicCaptcha(${bot.id})") { val image = ImageIO.read(data.inputStream()) JLabel(ImageIcon(image)).append() } } - public override suspend fun onSolveSliderCaptcha(bot: Bot, url: String): String? { + public override suspend fun onSolveSliderCaptcha(bot: Bot, url: String): String? { return openWindow("Mirai SliderCaptcha(${bot.id})") { JLabel("需要滑动验证码, 完成后请关闭该窗口").append() Desktop.getDesktop().browse(URI(url)) } } - public override suspend fun onSolveUnsafeDeviceLoginVerify(bot: Bot, url: String): String? { + public override suspend fun onSolveUnsafeDeviceLoginVerify(bot: Bot, url: String): String? { return openWindow("Mirai UnsafeDeviceLoginVerify(${bot.id})") { - JLabel(""" + JLabel( + """ 需要进行账户安全认证
该账户有[设备锁]/[不常用登录地点]/[不常用设备登录]的问题
完成以下账号认证即可成功登录|理论本认证在mirai每个账户中最多出现1次
成功后请关闭该窗口 - """.trimIndent()).append() + """.trimIndent() + ).append() HyperLinkLabel(url, "设备锁验证").last() } } diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/OverFileSizeMaxException.kt b/mirai-core-api/src/jvmMain/kotlin/utils/OverFileSizeMaxException.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/OverFileSizeMaxException.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/OverFileSizeMaxException.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/PlatformLogger.jvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/PlatformLogger.jvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/PlatformUtilsJvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/PlatformUtilsJvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt b/mirai-core-api/src/jvmMain/kotlin/utils/SystemDeviceInfo.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/SystemDeviceInfo.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/WeakRef.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/WeakRef.jvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/WeakRef.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/WeakRef.jvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/WindowHelperJvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/WindowHelperJvm.kt similarity index 99% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/WindowHelperJvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/WindowHelperJvm.kt index 315a438fe..950671986 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/WindowHelperJvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/WindowHelperJvm.kt @@ -23,7 +23,6 @@ import java.awt.event.KeyListener import java.awt.event.WindowAdapter import java.awt.event.WindowEvent import java.awt.image.BufferedImage -import java.io.File import javax.imageio.ImageIO import javax.swing.JFrame import javax.swing.JTextField diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/DeferredReusableInput.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/DeferredReusableInput.jvm.kt similarity index 99% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/DeferredReusableInput.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/internal/DeferredReusableInput.jvm.kt index 861b9d9cd..acc4bea23 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/DeferredReusableInput.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/DeferredReusableInput.jvm.kt @@ -24,7 +24,6 @@ internal actual class DeferredReusableInput actual constructor( ) : ReusableInput { - actual suspend fun init(strategy: FileCacheStrategy) = withContext(Dispatchers.IO) { if (delegate != null) { return@withContext diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/asReusableInput.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/asReusableInput.jvm.kt similarity index 89% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/asReusableInput.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/internal/asReusableInput.jvm.kt index a066a729a..91684ea6d 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/asReusableInput.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/asReusableInput.jvm.kt @@ -30,7 +30,10 @@ internal actual fun ByteArray.asReusableInput(): ReusableInput { override fun chunkedFlow(sizePerPacket: Int): ChunkedFlowSession { return object : ChunkedFlowSession { private val stream = inputStream() - override val flow: Flow = stream.chunkedFlow(sizePerPacket, ByteArray(DEFAULT_REUSABLE_INPUT_BUFFER_SIZE.coerceAtLeast(sizePerPacket))) + override val flow: Flow = stream.chunkedFlow( + sizePerPacket, + ByteArray(DEFAULT_REUSABLE_INPUT_BUFFER_SIZE.coerceAtLeast(sizePerPacket)) + ) override fun close() { stream.close() @@ -59,7 +62,11 @@ internal fun File.asReusableInput(deleteOnClose: Boolean): ReusableInput { override fun chunkedFlow(sizePerPacket: Int): ChunkedFlowSession { val stream = inputStream() return object : ChunkedFlowSession { - override val flow: Flow = stream.chunkedFlow(sizePerPacket, ByteArray(DEFAULT_REUSABLE_INPUT_BUFFER_SIZE.coerceAtLeast(sizePerPacket))) + override val flow: Flow = stream.chunkedFlow( + sizePerPacket, + ByteArray(DEFAULT_REUSABLE_INPUT_BUFFER_SIZE.coerceAtLeast(sizePerPacket)) + ) + override fun close() { stream.close() if (deleteOnClose) this@asReusableInput.delete() @@ -85,7 +92,11 @@ internal fun File.asReusableInput(deleteOnClose: Boolean, md5: ByteArray): Reusa override fun chunkedFlow(sizePerPacket: Int): ChunkedFlowSession { val stream = inputStream() return object : ChunkedFlowSession { - override val flow: Flow = stream.chunkedFlow(sizePerPacket, ByteArray(DEFAULT_REUSABLE_INPUT_BUFFER_SIZE.coerceAtLeast(sizePerPacket))) + override val flow: Flow = stream.chunkedFlow( + sizePerPacket, + ByteArray(DEFAULT_REUSABLE_INPUT_BUFFER_SIZE.coerceAtLeast(sizePerPacket)) + ) + override fun close() { stream.close() if (deleteOnClose) this@asReusableInput.delete() diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/logging/JdkLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/JdkLogger.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/logging/JdkLogger.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/JdkLogger.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/logging/Log4jLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Log4jLogger.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/logging/Log4jLogger.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Log4jLogger.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/logging/Slf4jLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Slf4jLogger.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/logging/Slf4jLogger.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Slf4jLogger.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/md5.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/md5.jvm.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/md5.jvm.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/internal/md5.jvm.kt diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/runBlocking.kt similarity index 100% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt rename to mirai-core-api/src/jvmMain/kotlin/utils/internal/runBlocking.kt diff --git a/mirai-core/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png b/mirai-core-api/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png similarity index 100% rename from mirai-core/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png rename to mirai-core-api/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png diff --git a/mirai-core/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java b/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java similarity index 100% rename from mirai-core/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java rename to mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java diff --git a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/CancelScopeTest.kt b/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt similarity index 89% rename from mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/CancelScopeTest.kt rename to mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt index ab45d1324..949a59b19 100644 --- a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/CancelScopeTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt @@ -6,12 +6,11 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - package net.mamoe.mirai.event import kotlinx.coroutines.* -import net.mamoe.mirai.event.events.MemberJoinEvent -import net.mamoe.mirai.event.events.MemberMuteEvent +import net.mamoe.mirai.event.broadcast +import net.mamoe.mirai.event.subscribeAlways import org.junit.Test import kotlin.test.assertFalse diff --git a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/EventTests.kt b/mirai-core-api/src/jvmTest/kotlin/event/EventTests.kt similarity index 99% rename from mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/EventTests.kt rename to mirai-core-api/src/jvmTest/kotlin/event/EventTests.kt index ece3eb897..5b165f963 100644 --- a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/EventTests.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/EventTests.kt @@ -10,6 +10,7 @@ package net.mamoe.mirai.event import kotlinx.coroutines.* +import net.mamoe.mirai.event.* import net.mamoe.mirai.event.internal.GlobalEventListeners import net.mamoe.mirai.utils.StepUtil import net.mamoe.mirai.utils.internal.runBlocking diff --git a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/JvmMethodEventsTest.kt b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt similarity index 96% rename from mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/JvmMethodEventsTest.kt rename to mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt index e469be97b..d53a8cd24 100644 --- a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/event/JvmMethodEventsTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt @@ -6,13 +6,13 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("RedundantSuspendModifier", "unused", "UNUSED_PARAMETER") package net.mamoe.mirai.event import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.runBlocking +import net.mamoe.mirai.event.* import org.jetbrains.annotations.NotNull import org.junit.Test import java.util.concurrent.atomic.AtomicInteger @@ -108,13 +108,13 @@ internal class JvmMethodEventsTest { fun getCalled() = called.get() @Suppress("unused") - @EventHandler(EventPriority.HIGHEST) + @EventHandler(Listener.EventPriority.HIGHEST) private suspend fun TestEvent.`suspend receiver param Unit`(event: TestEvent) { intercept() called.getAndIncrement() } - @EventHandler(EventPriority.MONITOR) + @EventHandler(Listener.EventPriority.MONITOR) @Suppress("unused") private fun TestEvent.`receiver param LS`(event: TestEvent): ListeningStatus { called.getAndIncrement() diff --git a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/message/SubscribingGetTest.kt b/mirai-core-api/src/jvmTest/kotlin/message/SubscribingGetTest.kt similarity index 94% rename from mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/message/SubscribingGetTest.kt rename to mirai-core-api/src/jvmTest/kotlin/message/SubscribingGetTest.kt index f7692a665..4e0f6d676 100644 --- a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/message/SubscribingGetTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/message/SubscribingGetTest.kt @@ -11,11 +11,9 @@ package net.mamoe.mirai.message import kotlinx.coroutines.* import net.mamoe.mirai.event.TestEvent -import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.syncFromEvent import kotlin.coroutines.CoroutineContext import kotlin.coroutines.EmptyCoroutineContext -import kotlin.coroutines.resume import kotlin.test.Test import kotlin.test.assertFailsWith diff --git a/compatibility-validator/src/main/kotlin/compatibility/testKotlinCompatibility.kt b/mirai-core-api/src/jvmTest/kotlin/package.kt similarity index 91% rename from compatibility-validator/src/main/kotlin/compatibility/testKotlinCompatibility.kt rename to mirai-core-api/src/jvmTest/kotlin/package.kt index 2d8603588..eb9e446d0 100644 --- a/compatibility-validator/src/main/kotlin/compatibility/testKotlinCompatibility.kt +++ b/mirai-core-api/src/jvmTest/kotlin/package.kt @@ -7,8 +7,4 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package compatibility - -fun main() { - -} \ No newline at end of file +package net.mamoe.mirai \ No newline at end of file diff --git a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt b/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt similarity index 98% rename from mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt rename to mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt index 78461fd4d..b6b4eb833 100644 --- a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt @@ -12,6 +12,8 @@ package net.mamoe.mirai.utils import kotlinx.coroutines.* +import net.mamoe.mirai.utils.LockFreeLinkedList +import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.test.shouldBeEqualTo import net.mamoe.mirai.test.shouldBeTrue import kotlin.test.Test diff --git a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/StepUtil.kt b/mirai-core-api/src/jvmTest/kotlin/utils/StepUtil.kt similarity index 94% rename from mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/StepUtil.kt rename to mirai-core-api/src/jvmTest/kotlin/utils/StepUtil.kt index d679ddcbf..d4ee71775 100644 --- a/mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/StepUtil.kt +++ b/mirai-core-api/src/jvmTest/kotlin/utils/StepUtil.kt @@ -1,5 +1,4 @@ /* - * Copyright 2019-2020 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. diff --git a/mirai-core-qqandroid/src/main/AndroidManifest.xml b/mirai-core-api/src/main/AndroidManifest.xml similarity index 65% rename from mirai-core-qqandroid/src/main/AndroidManifest.xml rename to mirai-core-api/src/main/AndroidManifest.xml index 7a4cf1cf2..544a92e64 100644 --- a/mirai-core-qqandroid/src/main/AndroidManifest.xml +++ b/mirai-core-api/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/mirai-core-qqandroid/README.md b/mirai-core-qqandroid/README.md deleted file mode 100644 index f75364fbb..000000000 --- a/mirai-core-qqandroid/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# mirai-core-qqandroid - - -QQ for Android 8.2.7 协议实现. -相较于 `mirai-core`, 此模块仅提供协议和功能的实现, 不提供额外的公开的 API. \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt deleted file mode 100644 index 4413f9d92..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("DEPRECATION_ERROR") - -package net.mamoe.mirai.qqandroid - -import net.mamoe.mirai.Bot -import net.mamoe.mirai.BotFactory -import net.mamoe.mirai.utils.BotConfiguration -import net.mamoe.mirai.utils.Context - -/** - * QQ for Android - */ -@Suppress("INAPPLICABLE_JVM_NAME") -actual object QQAndroid : BotFactory { - @JvmName("newBot") - actual override fun Bot(context: Context, qq: Long, password: String, configuration: BotConfiguration): Bot { - return QQAndroidBot(context, BotAccount(qq, password), configuration) - } - - /** - * 使用指定的 [配置][configuration] 构造 [Bot] 实例 - */ - @JvmName("newBot") - actual override fun Bot( - context: Context, - qq: Long, - passwordMd5: ByteArray, - configuration: BotConfiguration - ): Bot = QQAndroidBot(context, BotAccount(qq, passwordMd5), configuration) -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.android.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.android.kt deleted file mode 100644 index 21ecd2923..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.android.kt +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.qqandroid - -import io.ktor.utils.io.ByteReadChannel -import io.ktor.utils.io.consumeEachBufferRange -import io.ktor.utils.io.core.Input -import io.ktor.utils.io.core.readBytes -import kotlinx.coroutines.io.* -import kotlinx.io.core.* -import kotlinx.io.pool.useInstance -import net.mamoe.mirai.qqandroid.utils.ByteArrayPool -import net.mamoe.mirai.qqandroid.utils.toReadPacket -import java.nio.ByteBuffer - -@Suppress("DEPRECATION") -internal actual fun ByteReadChannel.toKotlinByteReadChannel(): kotlinx.coroutines.io.ByteReadChannel { - return object : kotlinx.coroutines.io.ByteReadChannel { - override val availableForRead: Int - get() = this@toKotlinByteReadChannel.availableForRead - override val isClosedForRead: Boolean - get() = this@toKotlinByteReadChannel.isClosedForRead - override val isClosedForWrite: Boolean - get() = this@toKotlinByteReadChannel.isClosedForWrite - - @Suppress("DEPRECATION_ERROR", "OverridingDeprecatedMember") - override var readByteOrder: ByteOrder - get() = when (this@toKotlinByteReadChannel.readByteOrder) { - io.ktor.utils.io.core.ByteOrder.BIG_ENDIAN -> ByteOrder.BIG_ENDIAN - io.ktor.utils.io.core.ByteOrder.LITTLE_ENDIAN -> ByteOrder.LITTLE_ENDIAN - } - set(value) { - this@toKotlinByteReadChannel.readByteOrder = when (value) { - ByteOrder.BIG_ENDIAN -> io.ktor.utils.io.core.ByteOrder.BIG_ENDIAN - ByteOrder.LITTLE_ENDIAN -> io.ktor.utils.io.core.ByteOrder.LITTLE_ENDIAN - } - } - - @Suppress("DEPRECATION_ERROR", "DEPRECATION", "OverridingDeprecatedMember") - override val totalBytesRead: Long - get() = this@toKotlinByteReadChannel.totalBytesRead - - override fun cancel(cause: Throwable?): Boolean = this@toKotlinByteReadChannel.cancel(cause) - override suspend fun consumeEachBufferRange(visitor: ConsumeEachBufferVisitor) = - this@toKotlinByteReadChannel.consumeEachBufferRange(visitor) - - override suspend fun discard(max: Long): Long = this@toKotlinByteReadChannel.discard(max) - - @Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE") - @ExperimentalIoApi - override fun lookAhead(visitor: LookAheadSession.() -> R): R { - return this@toKotlinByteReadChannel.lookAhead l@{ - visitor(object : LookAheadSession { - override fun consumed(n: Int) { - return this@l.consumed(n) - } - - override fun request(skip: Int, atLeast: Int): ByteBuffer? { - return this@l.request(skip, atLeast) - } - }) - } - } - - @Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE") - @ExperimentalIoApi - override suspend fun lookAheadSuspend(visitor: suspend LookAheadSuspendSession.() -> R): R = - this@toKotlinByteReadChannel.lookAheadSuspend l@{ - visitor(object : LookAheadSuspendSession { - override suspend fun awaitAtLeast(n: Int): Boolean { - return this@l.awaitAtLeast(n) - } - - override fun consumed(n: Int) { - return this@l.consumed(n) - } - - override fun request(skip: Int, atLeast: Int): ByteBuffer? { - return this@l.request(skip, atLeast) - } - - }) - } - - override suspend fun read(min: Int, consumer: (ByteBuffer) -> Unit) = - this@toKotlinByteReadChannel.read(min, consumer) - - override suspend fun readAvailable(dst: ByteBuffer): Int = this@toKotlinByteReadChannel.readAvailable(dst) - override suspend fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int = - this@toKotlinByteReadChannel.readAvailable(dst, offset, length) - - override suspend fun readAvailable(dst: IoBuffer): Int { - ByteArrayPool.useInstance { - val read = this@toKotlinByteReadChannel.readAvailable(it, 0, it.size) - dst.writeFully(it, 0, read) - return read - } - } - - override suspend fun readBoolean(): Boolean = this@toKotlinByteReadChannel.readBoolean() - override suspend fun readByte(): Byte = this@toKotlinByteReadChannel.readByte() - override suspend fun readDouble(): Double = this@toKotlinByteReadChannel.readDouble() - override suspend fun readFloat(): Float = this@toKotlinByteReadChannel.readFloat() - override suspend fun readFully(dst: ByteBuffer): Int { - TODO("not implemented") - } - - override suspend fun readFully(dst: ByteArray, offset: Int, length: Int) = - this@toKotlinByteReadChannel.readFully(dst, offset, length) - - override suspend fun readFully(dst: IoBuffer, n: Int) { - ByteArrayPool.useInstance { - dst.writeFully(it, 0, this.readAvailable(it, 0, it.size)) - } - } - - override suspend fun readInt(): Int = this@toKotlinByteReadChannel.readInt() - override suspend fun readLong(): Long = this@toKotlinByteReadChannel.readLong() - override suspend fun readPacket(size: Int, headerSizeHint: Int): ByteReadPacket { - return this@toKotlinByteReadChannel.readPacket(size, headerSizeHint).readBytes().toReadPacket() - } - - override suspend fun readRemaining(limit: Long, headerSizeHint: Int): ByteReadPacket { - return this@toKotlinByteReadChannel.readRemaining(limit, headerSizeHint).readBytes().toReadPacket() - } - - @OptIn(ExperimentalIoApi::class) - @ExperimentalIoApi - override fun readSession(consumer: ReadSession.() -> Unit) { - @Suppress("DEPRECATION") - this@toKotlinByteReadChannel.readSession lambda@{ - consumer(object : ReadSession { - override val availableForRead: Int - get() = this@lambda.availableForRead - - override fun discard(n: Int): Int = this@lambda.discard(n) - - override fun request(atLeast: Int): IoBuffer? { - val ioBuffer: io.ktor.utils.io.core.IoBuffer = this@lambda.request(atLeast) ?: return null - val buffer = IoBuffer.Pool.borrow() - val bytes = (ioBuffer as Input).readBytes() - buffer.writeFully(bytes) - return buffer - } - }) - } - } - - override suspend fun readShort(): Short = this@toKotlinByteReadChannel.readShort() - - @Suppress("EXPERIMENTAL_OVERRIDE", "EXPERIMENTAL_API_USAGE") - @ExperimentalIoApi - override suspend fun readSuspendableSession(consumer: suspend SuspendableReadSession.() -> Unit) = - this@toKotlinByteReadChannel.readSuspendableSession l@{ - consumer(object : SuspendableReadSession { - override val availableForRead: Int - get() = this@l.availableForRead - - override suspend fun await(atLeast: Int): Boolean = this@l.await(atLeast) - override fun discard(n: Int): Int = this@l.discard(n) - override fun request(atLeast: Int): IoBuffer? { - @Suppress("DuplicatedCode") val ioBuffer: io.ktor.utils.io.core.IoBuffer = - this@l.request(atLeast) ?: return null - val buffer = IoBuffer.Pool.borrow() - val bytes = (ioBuffer as Input).readBytes() - buffer.writeFully(bytes) - return buffer - } - }) - } - - override suspend fun readUTF8Line(limit: Int): String? = this@toKotlinByteReadChannel.readUTF8Line(limit) - override suspend fun readUTF8LineTo(out: A, limit: Int): Boolean = - this@toKotlinByteReadChannel.readUTF8LineTo(out, limit) - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.kt deleted file mode 100644 index 222e0cfac..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.kt +++ /dev/null @@ -1,102 +0,0 @@ -@file:Suppress("unused", "unused", "NOTHING_TO_INLINE") - -package net.mamoe.mirai.qqandroid.utils - -import io.ktor.client.HttpClient -import io.ktor.client.engine.cio.CIO -import io.ktor.util.KtorExperimentalAPI -import kotlinx.io.pool.useInstance -import java.io.ByteArrayOutputStream -import java.io.InputStream -import java.net.Inet4Address -import java.security.MessageDigest -import java.util.zip.Deflater -import java.util.zip.GZIPInputStream -import java.util.zip.GZIPOutputStream -import java.util.zip.Inflater - -internal actual object MiraiPlatformUtils { - actual fun unzip(data: ByteArray, offset: Int, length: Int): ByteArray { - data.checkOffsetAndLength(offset, length) - if (length == 0) return ByteArray(0) - - val inflater = Inflater() - inflater.reset() - ByteArrayOutputStream().use { output -> - inflater.setInput(data, offset, length) - ByteArrayPool.useInstance { - while (!inflater.finished()) { - output.write(it, 0, inflater.inflate(it)) - } - } - - inflater.end() - return output.toByteArray() - } - } - - actual fun zip(data: ByteArray, offset: Int, length: Int): ByteArray { - data.checkOffsetAndLength(offset, length) - if (length == 0) return ByteArray(0) - - val deflater = Deflater() - deflater.setInput(data, offset, length) - deflater.finish() - - ByteArrayPool.useInstance { - return it.take(deflater.deflate(it)).toByteArray().also { deflater.end() } - } - } - - - actual fun md5(data: ByteArray, offset: Int, length: Int): ByteArray { - data.checkOffsetAndLength(offset, length) - return MessageDigest.getInstance("MD5").apply { update(data, offset, length) }.digest() - } - - actual inline fun md5(str: String): ByteArray = md5(str.toByteArray()) - - /** - * Ktor HttpClient. 不同平台使用不同引擎. - */ - @OptIn(KtorExperimentalAPI::class) - actual val Http: HttpClient = HttpClient(CIO) - - /** - * Localhost 解析 - */ - actual fun localIpAddress(): String = runCatching { - Inet4Address.getLocalHost().hostAddress - }.getOrElse { "192.168.1.123" } - - fun md5(stream: InputStream): ByteArray { - val digest = MessageDigest.getInstance("md5") - digest.reset() - stream.readInSequence { - digest.update(it.toByte()) - } - return digest.digest() - } - - - private inline fun InputStream.readInSequence(block: (Int) -> Unit) { - var read: Int - while (this.read().also { read = it } != -1) { - block(read) - } - } - - actual fun gzip(data: ByteArray, offset: Int, length: Int): ByteArray { - ByteArrayOutputStream().use { buf -> - GZIPOutputStream(buf).use { gzip -> - data.inputStream(offset, length).use { t -> t.copyTo(gzip) } - } - buf.flush() - return buf.toByteArray() - } - } - - actual fun ungzip(data: ByteArray, offset: Int, length: Int): ByteArray { - return GZIPInputStream(data.inputStream(offset, length)).use { it.readBytes() } - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformDatagramChannel.android.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformDatagramChannel.android.kt deleted file mode 100644 index b01b128fb..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformDatagramChannel.android.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.qqandroid.utils - -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 -import java.nio.channels.WritableByteChannel - -/** - * 多平台适配的 DatagramChannel. - */ -internal actual class PlatformDatagramChannel actual constructor( - serverHost: String, - serverPort: Short -) : Closeable { - @PublishedApi - internal val channel: DatagramChannel = - DatagramChannel.open().connect(InetSocketAddress(serverHost, serverPort.toInt())) - actual val isOpen: Boolean get() = channel.isOpen - override fun close() = channel.close() - - actual suspend inline fun send(packet: ByteReadPacket): Boolean = withContext(Dispatchers.IO) { - try { - (channel as WritableByteChannel).writePacket(packet) - } catch (e: Throwable) { - throw SendPacketInternalException(e) - } - } - - actual suspend inline fun read(): ByteReadPacket = withContext(Dispatchers.IO) { - try { - (channel as ReadableByteChannel).readPacketAtMost(Long.MAX_VALUE) - } catch (e: Throwable) { - throw ReadPacketInternalException(e) - } - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt deleted file mode 100644 index 530a066c6..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.qqandroid.utils - -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext -import kotlinx.io.core.ByteReadPacket -import kotlinx.io.core.Closeable -import kotlinx.io.core.ExperimentalIoApi -import kotlinx.io.streams.readPacketAtMost -import kotlinx.io.streams.writePacket -import java.io.BufferedInputStream -import java.io.BufferedOutputStream -import java.io.IOException -import java.net.Socket - -/** - * 多平台适配的 TCP Socket. - */ -internal actual class PlatformSocket : Closeable { - private lateinit var socket: Socket - - actual val isOpen: Boolean - get() = - if (::socket.isInitialized) - socket.isConnected - else false - - actual override fun close() { - if (::socket.isInitialized) { - socket.close() - } - } - - @PublishedApi - internal lateinit var writeChannel: BufferedOutputStream - @PublishedApi - internal lateinit var readChannel: BufferedInputStream - - actual suspend fun send(packet: ByteArray, offset: Int, length: Int) { - withContext(Dispatchers.IO) { - writeChannel.write(packet, offset, length) - writeChannel.flush() - } - } - - /** - * @throws SendPacketInternalException - */ - actual suspend fun send(packet: ByteReadPacket) { - withContext(Dispatchers.IO) { - try { - writeChannel.writePacket(packet) - writeChannel.flush() - } catch (e: IOException) { - throw SendPacketInternalException(e) - } - } - } - - /** - * @throws ReadPacketInternalException - */ - actual suspend fun read(): ByteReadPacket { - return withContext(Dispatchers.IO) { - try { - readChannel.readPacketAtMost(Long.MAX_VALUE) - } catch (e: IOException) { - throw ReadPacketInternalException(e) - } - } - } - - @OptIn(ExperimentalIoApi::class) - actual suspend fun connect(serverHost: String, serverPort: Int) { - withContext(Dispatchers.IO) { - socket = Socket(serverHost, serverPort) - readChannel = socket.getInputStream().buffered() - writeChannel = socket.getOutputStream().buffered() - } - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/addSuppressedMirai.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/addSuppressedMirai.kt deleted file mode 100644 index 816beed09..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/addSuppressedMirai.kt +++ /dev/null @@ -1,27 +0,0 @@ -@file:Suppress("DuplicatedCode") - -package net.mamoe.mirai.qqandroid.utils - -import android.os.Build - - -private var isAddSuppressedSupported: Boolean = true - -@PublishedApi -internal actual fun Throwable.addSuppressedMirai(e: Throwable) { - if (this == e) { - return - } - if (!isAddSuppressedSupported) { - return - } - try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - this.addSuppressed(e) - } else { - isAddSuppressedSupported = false - } - } catch (e: Exception) { - isAddSuppressedSupported = false - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHAndroid.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHAndroid.kt deleted file mode 100644 index 42caea241..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHAndroid.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.qqandroid.utils.cryptor - -import android.annotation.SuppressLint -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils.md5 -import net.mamoe.mirai.utils.MiraiLogger -import java.security.* -import java.security.spec.ECGenParameterSpec -import java.security.spec.X509EncodedKeySpec -import javax.crypto.KeyAgreement - - -actual typealias ECDHPrivateKey = PrivateKey -actual typealias ECDHPublicKey = PublicKey - -internal actual class ECDHKeyPairImpl( - private val delegate: KeyPair -) : ECDHKeyPair { - override val privateKey: ECDHPrivateKey get() = delegate.private - override val publicKey: ECDHPublicKey get() = delegate.public - - override val initialShareKey: ByteArray = ECDH.calculateShareKey(privateKey, initialPublicKey) -} - -@Suppress("FunctionName") -internal actual fun ECDH() = ECDH(ECDH.generateKeyPair()) - -internal actual class ECDH actual constructor(actual val keyPair: ECDHKeyPair) { - actual companion object { - @Suppress("ObjectPropertyName") - private var _isECDHAvailable: Boolean = false // because `runCatching` has no contract. - actual val isECDHAvailable: Boolean get() = _isECDHAvailable - - init { - fun testECDH() { - ECDHKeyPairImpl( - KeyPairGenerator.getInstance("ECDH") - .also { it.initialize(ECGenParameterSpec("secp192k1")) } - .genKeyPair()).let { - calculateShareKey(it.privateKey, it.publicKey) - } - } - - @SuppressLint("PrivateApi") - if (kotlin.runCatching { testECDH() }.isFailure) { - kotlin.runCatching { - val providerName = "BC" - - if (Security.getProvider(providerName) != null) { - Security.removeProvider(providerName) - } - @Suppress("SpellCheckingInspection") - Security.addProvider( - Class.forName( - "com.android.org.bouncycastle.jce.provider.BouncyCastleProvider", - true, - ClassLoader.getSystemClassLoader() - ).newInstance() as Provider - ) - testECDH() - _isECDHAvailable = true - }.exceptionOrNull()?.let { - _isECDHAvailable = false - @Suppress("DEPRECATION") - MiraiLogger.error(it) - } - } - } - - actual fun generateKeyPair(): ECDHKeyPair { - if (!isECDHAvailable) { - return ECDHKeyPair.DefaultStub - } - return ECDHKeyPairImpl(KeyPairGenerator.getInstance("ECDH") - .also { it.initialize(ECGenParameterSpec("secp192k1")) } - .genKeyPair()) - } - - actual fun calculateShareKey( - privateKey: ECDHPrivateKey, - publicKey: ECDHPublicKey - ): ByteArray { - val instance = KeyAgreement.getInstance("ECDH", "BC") - instance.init(privateKey) - instance.doPhase(publicKey, true) - return md5(instance.generateSecret()) - } - - actual fun constructPublicKey(key: ByteArray): ECDHPublicKey { - return KeyFactory.getInstance("EC", "BC").generatePublic(X509EncodedKeySpec(key)) - } - } - - actual fun calculateShareKeyByPeerPublicKey(peerPublicKey: ECDHPublicKey): ByteArray { - return calculateShareKey(keyPair.privateKey, peerPublicKey) - } - - actual override fun toString(): String { - return "ECDH(keyPair=$keyPair)" - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt deleted file mode 100644 index 9952fb58a..000000000 --- a/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt +++ /dev/null @@ -1,8 +0,0 @@ -package net.mamoe.mirai.qqandroid.utils - -import kotlin.reflect.KProperty1 -import kotlin.reflect.jvm.javaField - -internal actual fun KProperty1<*, *>.getValueAgainstPermission(receiver: Any): Any? { - return this.javaField?.apply { isAccessible = true }?.get(receiver) -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/SyncingCacheList.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/SyncingCacheList.kt deleted file mode 100644 index 70da8a59f..000000000 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/SyncingCacheList.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * - * * Copyright 2020 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/master/LICENSE - * - */ - -package net.mamoe.mirai.qqandroid.network.protocol - -import net.mamoe.mirai.qqandroid.utils.LinkedList -import kotlin.jvm.Synchronized - -internal class SyncingCacheList(private val size: Int = 50) { - private val packetIdList = LinkedList() - - @Synchronized // faster than suspending Mutex - fun addCache(element: E): Boolean { - if (packetIdList.contains(element)) return false // duplicate - packetIdList.addLast(element) - if (packetIdList.size >= size) packetIdList.removeFirst() - return true - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.kt b/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.kt deleted file mode 100644 index 291206682..000000000 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * - * * Copyright 2020 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/master/LICENSE - * - */ - -package net.mamoe.mirai.qqandroid.utils - -import java.util.LinkedList - -@Suppress("ACTUAL_WITHOUT_EXPECT") -internal actual typealias LinkedList = LinkedList \ No newline at end of file diff --git a/mirai-core/README.md b/mirai-core/README.md index 8488be3e8..f75364fbb 100644 --- a/mirai-core/README.md +++ b/mirai-core/README.md @@ -1,10 +1,5 @@ -# mirai-core +# mirai-core-qqandroid -mirai 的核心公开 API. - -mirai 为多协议设计, `mirai-core` 只提供基础框架和抽象数据类. -具体的各协议实现为 `mirai-core-PROTOCOL`, 这些协议模块都继承自 `mirai-core`. - -可用的协议模块: -- [`mirai-core-qqandroid`](../mirai-core-qqandroid): Android QQ 8.3.0 版本协议实现. +QQ for Android 8.2.7 协议实现. +相较于 `mirai-core`, 此模块仅提供协议和功能的实现, 不提供额外的公开的 API. \ No newline at end of file diff --git a/mirai-core/build.gradle.kts b/mirai-core/build.gradle.kts index a27495b7a..342b7b2ce 100644 --- a/mirai-core/build.gradle.kts +++ b/mirai-core/build.gradle.kts @@ -4,19 +4,17 @@ plugins { kotlin("multiplatform") id("kotlinx-atomicfu") kotlin("plugin.serialization") - id("signing") id("net.mamoe.kotlin-jvm-blocking-bridge") `maven-publish` id("com.jfrog.bintray") + java } -description = "Mirai API module" +description = "Mirai Protocol implementation for QQ Android" val isAndroidSDKAvailable: Boolean by project kotlin { - explicitApi() - if (isAndroidSDKAvailable) { apply(from = rootProject.file("gradle/android.gradle")) android("android") { @@ -37,8 +35,8 @@ kotlin { ) } - jvm { - // withJava() // https://youtrack.jetbrains.com/issue/KT-39991 + jvm("jvm") { + withJava() } sourceSets.apply { @@ -56,50 +54,41 @@ kotlin { languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.UnstableExternalImage") languageSettings.progressiveMode = true + + dependencies { + api(project(":mirai-core-api")) + } } val commonMain by getting { dependencies { - api(kotlin("serialization")) - api(kotlin("reflect")) - api1(kotlinx("serialization-core", Versions.Kotlin.serialization)) - implementation1(kotlinx("serialization-protobuf", Versions.Kotlin.serialization)) - api1(kotlinx("io", Versions.Kotlin.io)) - api1(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo)) api(kotlinx("coroutines-core", Versions.Kotlin.coroutines)) - - implementation1("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}") - - api1(ktor("client-cio")) - api1(ktor("client-core")) - api1(ktor("network")) + implementation1(kotlinx("serialization-protobuf", Versions.Kotlin.serialization)) + api1("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}") + api1(kotlinx("io", Versions.Kotlin.io)) + implementation1(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo)) } } - commonTest { + val commonTest by getting { dependencies { implementation(kotlin("test-annotations-common")) implementation(kotlin("test-common")) + implementation(kotlin("script-runtime")) } } if (isAndroidSDKAvailable) { val androidMain by getting { dependencies { - api(kotlin("reflect")) - - api1(kotlinx("io-jvm", Versions.Kotlin.io)) - api1(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo)) - - api1(ktor("client-android", Versions.Kotlin.ktor)) } } val androidTest by getting { dependencies { - implementation(kotlin("test")) - implementation(kotlin("test-junit")) + implementation(kotlin("test", Versions.Kotlin.compiler)) + implementation(kotlin("test-junit", Versions.Kotlin.compiler)) implementation(kotlin("test-annotations-common")) implementation(kotlin("test-common")) } @@ -108,23 +97,18 @@ kotlin { val jvmMain by getting { dependencies { - api(kotlin("reflect")) - compileOnly("org.apache.logging.log4j:log4j-api:" + Versions.Logging.log4j) - compileOnly("org.slf4j:slf4j-api:" + Versions.Logging.slf4j) - - api1(ktor("client-core-jvm", Versions.Kotlin.ktor)) + implementation("org.bouncycastle:bcprov-jdk15on:1.64") api1(kotlinx("io-jvm", Versions.Kotlin.io)) - api1(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo)) + // api(kotlinx("coroutines-debug", Versions.Kotlin.coroutines)) } } val jvmTest by getting { dependencies { - implementation(kotlin("test")) - implementation(kotlin("test-junit")) + dependsOn(commonTest) + implementation(kotlin("test", Versions.Kotlin.compiler)) + implementation(kotlin("test-junit", Versions.Kotlin.compiler)) implementation("org.pcap4j:pcap4j-distribution:1.8.2") - - runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE } } } @@ -150,6 +134,7 @@ fun org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler.api1(dependencyNo apply(from = rootProject.file("gradle/publish.gradle")) + tasks.withType { doFirst { publishing.publications diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/BotJavaFriendlyAPI.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/BotJavaFriendlyAPI.kt deleted file mode 100644 index f363a4fba..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/BotJavaFriendlyAPI.kt +++ /dev/null @@ -1,220 +0,0 @@ -package net.mamoe.mirai - -import kotlinx.coroutines.* -import net.mamoe.mirai.contact.PermissionDeniedException -import net.mamoe.mirai.contact.recall -import net.mamoe.mirai.data.AddFriendResult -import net.mamoe.mirai.message.data.Image -import net.mamoe.mirai.message.data.MessageChain -import net.mamoe.mirai.message.data.MessageSource -import net.mamoe.mirai.network.LoginFailedException -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import java.util.concurrent.Future -import java.util.concurrent.TimeUnit -import java.util.concurrent.TimeoutException - -/** - * [Bot] 中为了让 Java 使用者调用更方便的 API 列表. - */ -@Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "unused") -internal actual interface BotJavaFriendlyAPI actual constructor() { - init { - @Suppress("LeakingThis") - assert(this is Bot) - } - - private inline fun runBlocking(crossinline block: suspend Bot.() -> R): R { - return kotlinx.coroutines.runBlocking { block(this@BotJavaFriendlyAPI as Bot) } - } - - private inline fun future(crossinline block: suspend Bot.() -> R): Future { - return (this as Bot).run { future { block() } } - } - - /** - * 登录, 或重新登录. - * 这个函数总是关闭一切现有网路任务, 然后重新登录并重新缓存好友列表和群列表. - * - * 一般情况下不需要重新登录. Mirai 能够自动处理掉线情况. - * - * 最终调用 [net.mamoe.mirai.network.BotNetworkHandler.relogin] - * - * @throws LoginFailedException - */ - @JvmName("login") - fun __loginBlockingForJava__() { - runBlocking { login() } - } - - /** - * 撤回这条消息. 可撤回自己 2 分钟内发出的消息, 和任意时间的群成员的消息. - * - * [Bot] 撤回自己的消息不需要权限. - * [Bot] 撤回群员的消息需要管理员权限. - * - * @param source 消息源. 可从 [MessageReceipt.source] 获得, 或从消息事件中的 [MessageChain] 获得. - * - * @throws PermissionDeniedException 当 [Bot] 无权限操作时 - * - * @see Bot.recall (扩展函数) 接受参数 [MessageChain] - */ - @JvmName("recall") - fun __recallBlockingForJava__(source: MessageSource) { - runBlocking { recall(source) } - } - - /** - * 撤回这条消息. - * 根据 [message] 内的 [MessageSource] 进行相关判断. - * - * [Bot] 撤回自己的消息不需要权限. - * [Bot] 撤回群员的消息需要管理员权限. - * - * @throws PermissionDeniedException 当 [Bot] 无权限操作时 - * @see Bot.recall - */ - @JvmName("recall") - fun __recallBlockingForJava__(message: MessageChain) { - runBlocking { recall(message) } - } - - /** - * 在一段时间后撤回这条消息. - * 将根据 [MessageSource.groupId] 判断消息是群消息还是好友消息. - * - * @param millis 延迟的时间, 单位为毫秒 - * @see recall - */ - @JvmName("recallIn") - fun __recallIn_MemberForJava__(source: MessageSource, millis: Long) { - runBlocking { recallIn(source, millis) } - } - - /** - * 在一段时间后撤回这条消息. - * - * @param millis 延迟的时间, 单位为毫秒 - * @see recall - */ - @JvmName("recallIn") - fun __recallIn_MemberForJava__(source: MessageChain, millis: Long) { - runBlocking { recallIn(source, millis) } - } - - /** - * 获取图片下载链接 - */ - @JvmName("queryImageUrl") - fun __queryImageUrlBlockingForJava__(image: Image): String { - return runBlocking { queryImageUrl(image) } - } - - /** - * 阻塞当前线程直到 [Bot] 下线. - */ - @JvmName("join") - fun __joinBlockingForJava__() { - runBlocking { join() } - } - - /** - * 添加一个好友 - * - * @param message 若需要验证请求时的验证消息. - * @param remark 好友备注 - */ - @JvmName("addFriend") - fun __addFriendBlockingForJava__( - id: Long, - message: String? = null, - remark: String? = null - ): AddFriendResult { - - return runBlocking { addFriend(id, message, remark) } - } - - /** - * 异步调用 [__loginBlockingForJava__] - */ - @JvmName("loginAsync") - fun __loginAsyncForJava__(): Future { - return future { login() } - } - - /** - * 异步调用 [__recallBlockingForJava__] - */ - @JvmName("recallAsync") - fun __recallAsyncForJava__(source: MessageSource): Future { - return future { recall(source) } - } - - /** - * 异步调用 [__recallBlockingForJava__] - */ - @JvmName("recallAsync") - fun __recallAsyncForJava__(source: MessageChain): Future { - return future { recall(source) } - } - - /** - * 异步调用 [__queryImageUrlBlockingForJava__] - */ - @JvmName("queryImageUrlAsync") - fun __queryImageUrlAsyncForJava__(image: Image): Future { - return future { queryImageUrl(image) } - } -} - -// !! 不要 crossinline, 会编译失败 -@OptIn(ExperimentalCoroutinesApi::class) -internal fun C.future(block: suspend C.() -> R): Future { - val future = object : Future { - val value: CompletableDeferred = CompletableDeferred() - - override fun isDone(): Boolean { - return value.isCompleted - } - - override fun get(): R { - if (value.isCompleted) { - return value.getCompleted() - } - return runBlocking { value.await() } - } - - override fun get(timeout: Long, unit: TimeUnit): R { - if (value.isCompleted) { - return value.getCompleted() - } - return runBlocking { - withTimeoutOrNull(TimeUnit.MILLISECONDS.convert(timeout, unit)) { value.await() } - ?: throw TimeoutException() - } - } - - override fun cancel(mayInterruptIfRunning: Boolean): Boolean { - if (value.isCompleted || value.isCancelled) { - return false - } - - return if (mayInterruptIfRunning && value.isActive) { - value.cancel() - true - } else { - false - } - } - - override fun isCancelled(): Boolean { - return value.isCancelled - } - } - - launch { - @OptIn(ExperimentalCoroutinesApi::class) - future.value.completeWith(kotlin.runCatching { block() }) - } - - return future -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt deleted file mode 100644 index f21179c07..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/ContactJavaFriendlyAPI.kt +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.contact - -import android.graphics.Bitmap -import kotlinx.coroutines.Dispatchers -import kotlinx.io.core.Input -import net.mamoe.mirai.Bot -import net.mamoe.mirai.JavaFriendlyAPI -import net.mamoe.mirai.event.events.* -import net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent -import net.mamoe.mirai.event.events.MessageSendEvent.GroupMessageSendEvent -import net.mamoe.mirai.future -import net.mamoe.mirai.message.MessageReceipt -import net.mamoe.mirai.message.data.Image -import net.mamoe.mirai.message.data.Message -import net.mamoe.mirai.message.uploadImage -import net.mamoe.mirai.utils.ExternalImage -import net.mamoe.mirai.utils.OverFileSizeMaxException -import java.io.File -import java.io.InputStream -import java.net.URL -import java.util.concurrent.Future - -@JavaFriendlyAPI -@Suppress("INAPPLICABLE_JVM_NAME", "FunctionName", "unused") -internal actual abstract class ContactJavaFriendlyAPI { - - private inline fun runBlocking(crossinline block: suspend Contact.() -> R): R { - @Suppress("CAST_NEVER_SUCCEEDS") - return kotlinx.coroutines.runBlocking { block(this@ContactJavaFriendlyAPI as Contact) } - } - - private inline fun future(crossinline block: suspend Contact.() -> R): Future { - @Suppress("CAST_NEVER_SUCCEEDS") - return (this as Contact).run { future { block() } } - } - - /** - * 向这个对象发送消息. - * - * 单条消息最大可发送 4500 字符或 50 张图片. - * - * @see FriendMessageSendEvent 发送好友信息事件, cancellable - * @see GroupMessageSendEvent 发送群消息事件. cancellable - * - * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 - * @throws MessageTooLargeException 当消息过长时抛出 * @throws MessageTooLargeException 当消息过长时抛出 - - * - * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. - */ - @Throws(EventCancelledException::class, IllegalStateException::class) - @JvmName("sendMessage") - open fun __sendMessageBlockingForJava__(message: Message): MessageReceipt<@JvmWildcard Contact> { - return runBlocking { - sendMessage(message) - } - } - - @JvmName("sendMessage") - open fun __sendMessageBlockingForJava__(message: String): MessageReceipt<@JvmWildcard Contact> { - return runBlocking { sendMessage(message) } - } - - /** - * 上传一个图片以备发送. - * - * @see BeforeImageUploadEvent 图片发送前事件, cancellable - * @see ImageUploadEvent 图片发送完成事件 - * - * @throws EventCancelledException 当发送消息事件被取消 - * @throws OverFileSizeMaxException 当图片文件过大而被服务器拒绝上传时. (最大大小约为 20 MB) - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - open fun __uploadImageBlockingForJava__(image: ExternalImage): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - open fun __uploadImageBlockingForJava__(image: URL): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - open fun __uploadImageBlockingForJava__(image: InputStream): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - open fun __uploadImageBlockingForJava__(image: Input): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将文件作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - open fun __uploadImageBlockingForJava__(image: File): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将图片上传, 但不发送. 不会保存临时文件 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - open fun __uploadImageBlockingForJava__(image: Bitmap): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 发送消息 - * @see Contact.sendMessage - */ - @JvmName("sendMessageAsync") - open fun __sendMessageAsyncForJava__(message: Message): Future> { - return future { sendMessage(message) } - } - - /** - * 发送消息 - * @see Contact.sendMessage - */ - @JvmName("sendMessageAsync") - open fun __sendMessageAsyncForJava__(message: String): Future> { - return future { sendMessage(message) } - } - - /** - * 上传一个图片以备发送. - * - * @see BeforeImageUploadEvent 图片发送前事件, cancellable - * @see ImageUploadEvent 图片发送完成事件 - */ - @JvmName("uploadImageAsync") - open fun __uploadImageAsyncForJava__(image: ExternalImage): Future { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片上传, 但不发送 - */ - @JvmName("uploadImageAsync") - open fun __uploadImageAsyncForJava__(image: URL): Future { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片上传, 但不发送 - */ - @JvmName("uploadImageAsync") - open fun __uploadImageAsyncForJava__(image: InputStream): Future { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片上传, 但不发送 - */ - @JvmName("uploadImageAsync") - open fun __uploadImageAsyncForJava__(image: Input): Future { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将文件作为图片上传, 但不发送 - */ - @JvmName("uploadImageAsync") - open fun __uploadImageAsyncForJava__(image: File): Future { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将图片上传, 但不发送. 不会保存临时文件 - */ - @JvmName("uploadImageAsync") - open fun __uploadImageAsyncForJava__(image: Bitmap): Future { - return future { uploadImage(image) } - } -} - -@Suppress("INAPPLICABLE_JVM_NAME", "FunctionName", "unused", "unused") -@MiraiInternalAPI -@JavaFriendlyAPI -actual abstract class MemberJavaFriendlyAPI : QQ() { - private inline fun runBlocking(crossinline block: suspend Member.() -> R): R { - @Suppress("CAST_NEVER_SUCCEEDS") - return kotlinx.coroutines.runBlocking { block(this@MemberJavaFriendlyAPI as Member) } - } - - private inline fun future(crossinline block: suspend Member.() -> R): Future { - @Suppress("CAST_NEVER_SUCCEEDS") - return (this as Member).run { future { block() } } - } - - - /** - * 禁言. - * - * QQ 中最小操作和显示的时间都是一分钟. - * 机器人可以实现精确到秒, 会被客户端显示为 1 分钟但不影响实际禁言时间. - * - * 管理员可禁言成员, 群主可禁言管理员和群员. - * - * @param durationSeconds 持续时间. 精确到秒. 范围区间表示为 `(0s, 30days]`. 超过范围则会抛出异常. - * @return 机器人无权限时返回 `false` - * - * @see Int.minutesToSeconds - * @see Int.hoursToSeconds - * @see Int.daysToSeconds - * - * @see MemberMuteEvent 成员被禁言事件 - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("mute") - open fun __muteBlockingForJava__(seconds: Int) { - return runBlocking { mute(seconds) } - } - - /** - * 解除禁言. - * - * 管理员可解除成员的禁言, 群主可解除管理员和群员的禁言. - * - * @see MemberUnmuteEvent 成员被取消禁言事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("unmute") - open fun __unmuteBlockingForJava__() { - return runBlocking { unmute() } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kick") - open fun __kickBlockingForJava__(message: String) { - return runBlocking { kick() } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kick") - open fun __kickBlockingForJava__() = __kickBlockingForJava__("") - - - /** - * 禁言. - * - * QQ 中最小操作和显示的时间都是一分钟. - * 机器人可以实现精确到秒, 会被客户端显示为 1 分钟但不影响实际禁言时间. - * - * 管理员可禁言成员, 群主可禁言管理员和群员. - * - * @param durationSeconds 持续时间. 精确到秒. 范围区间表示为 `(0s, 30days]`. 超过范围则会抛出异常. - * @return 机器人无权限时返回 `false` - * - * @see Int.minutesToSeconds - * @see Int.hoursToSeconds - * @see Int.daysToSeconds - * - * @see MemberMuteEvent 成员被禁言事件 - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("muteAsync") - open fun __muteAsyncForJava__(seconds: Int): Future { - return future { mute(seconds) } - } - - /** - * 解除禁言. - * - * 管理员可解除成员的禁言, 群主可解除管理员和群员的禁言. - * - * @see MemberUnmuteEvent 成员被取消禁言事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("unmuteAsync") - open fun __unmuteAsyncForJava__(): Future { - return future { unmute() } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kickAsync") - open fun __kickAsyncForJava__(message: String): Future { - return future { kick() } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kickAsync") - open fun __kickAsyncForJava__(): Future = __kickAsyncForJava__("") -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt deleted file mode 100644 index f25579a33..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.contact - -import kotlinx.coroutines.CoroutineScope -import net.mamoe.mirai.Bot -import net.mamoe.mirai.LowLevelAPI -import net.mamoe.mirai.data.MemberInfo -import net.mamoe.mirai.event.events.* -import net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent -import net.mamoe.mirai.event.events.MessageSendEvent.GroupMessageSendEvent -import net.mamoe.mirai.message.MessageReceipt -import net.mamoe.mirai.message.data.Message -import net.mamoe.mirai.message.data.OfflineGroupImage -import net.mamoe.mirai.utils.ExternalImage -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.OverFileSizeMaxException -import net.mamoe.mirai.utils.SinceMirai - -/** - * 群. 在 QQ Android 中叫做 "Troop" - */ -actual abstract class Group : Contact(), CoroutineScope { - /** - * 群名称. - * - * 在修改时将会异步上传至服务器. - * 频繁修改可能会被服务器拒绝. - * - * @see MemberPermissionChangeEvent - * @throws PermissionDeniedException 无权限修改时将会抛出异常 - */ - actual abstract var name: String - - /** - * 群设置 - */ - actual abstract val settings: GroupSettings - - /** - * 同为 groupCode, 用户看到的群号码. - */ - actual abstract override val id: Long - - /** - * 群主. - * - * @return 若机器人是群主, 返回 [botAsMember]. 否则返回相应的成员 - */ - actual abstract val owner: Member - - /** - * [Bot] 在群内的 [newMember] 实例 - */ - @MiraiExperimentalAPI - actual abstract val botAsMember: Member - - /** - * 机器人被禁言还剩余多少秒 - * - * @see BotMuteEvent 机器人被禁言事件 - * @see isBotMuted 判断机器人是否正在被禁言 - */ - actual abstract val botMuteRemaining: Int - - /** - * 机器人在这个群里的权限 - * - * @see Group.checkBotPermission 检查 [Bot] 在这个群里的权限 - * @see Group.checkBotPermissionOperator 要求 [Bot] 在这个群里的权限为 [管理员或群主][MemberPermission.isOperator] - * - * @see BotGroupPermissionChangeEvent 机器人群员修改 - */ - actual abstract val botPermission: MemberPermission - - /** - * 群头像下载链接. - */ - actual val avatarUrl: String - get() = "https://p.qlogo.cn/gh/$id/${id}_1/640" - - /** - * 群成员列表, 不含机器人自己, 含群主. - * 在 [Group] 实例创建的时候查询一次. 并与事件同步事件更新 - */ - actual abstract val members: ContactList - - /** - * 获取群成员实例. 不存在时抛出 [kotlin.NoSuchElementException] - */ - actual abstract operator fun get(id: Long): Member - - /** - * 获取群成员实例, 不存在则 null - */ - actual abstract fun getOrNull(id: Long): Member? - - /** - * 检查此 id 的群成员是否存在 - */ - actual abstract operator fun contains(id: Long): Boolean - - /** - * 让机器人退出这个群. 机器人必须为非群主才能退出. 否则将会失败 - */ - @MiraiExperimentalAPI("还未支持") - actual abstract suspend fun quit(): Boolean - - /** - * 构造一个 [Member]. - * 非特殊情况请不要使用这个函数. 优先使用 [get]. - */ - @LowLevelAPI - @MiraiExperimentalAPI("dangerous") - actual abstract fun newMember(memberInfo: MemberInfo): Member - - /** - * 向这个对象发送消息. - * - * 单条消息最大可发送 4500 字符或 50 张图片. - * - * @see FriendMessageSendEvent 发送好友信息事件, cancellable - * @see GroupMessageSendEvent 发送群消息事件. cancellable - * - * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 - * @throws MessageTooLargeException 当消息过长时抛出 - * - * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) - */ - @JvmSynthetic - actual abstract override suspend fun sendMessage(message: Message): MessageReceipt - - /** - * 上传一个图片以备发送. - * - * @see BeforeImageUploadEvent 图片发送前事件, cancellable - * @see ImageUploadEvent 图片发送完成事件 - * - * @throws EventCancelledException 当发送消息事件被取消 - * @throws OverFileSizeMaxException 当图片文件过大而被服务器拒绝上传时. (最大大小约为 20 MB) - */ - @JvmSynthetic - actual abstract override suspend fun uploadImage(image: ExternalImage): OfflineGroupImage - - actual companion object { - actual fun calculateGroupUinByGroupCode(groupCode: Long): Long = - CommonGroupCalculations.calculateGroupUinByGroupCode(groupCode) - - actual fun calculateGroupCodeByGroupUin(groupUin: Long): Long = - CommonGroupCalculations.calculateGroupCodeByGroupUin(groupUin) - } - - @MiraiExperimentalAPI - actual fun toFullString(): String { - return "Group(id=${this.id}, name=$name, owner=${owner.id}, members=${members.idContentString})" - } -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt deleted file mode 100644 index 564da8f3a..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ -@file:Suppress("unused") - -package net.mamoe.mirai.contact - -import net.mamoe.mirai.Bot -import net.mamoe.mirai.JavaFriendlyAPI -import net.mamoe.mirai.event.events.* -import net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent -import net.mamoe.mirai.event.events.MessageSendEvent.GroupMessageSendEvent -import net.mamoe.mirai.message.MessageReceipt -import net.mamoe.mirai.message.data.Message -import net.mamoe.mirai.utils.MiraiInternalAPI -import net.mamoe.mirai.utils.WeakRefProperty - -/** - * 群成员. - */ -@Suppress("INAPPLICABLE_JVM_NAME") -actual abstract class Member : MemberJavaFriendlyAPI() { - /** - * 所在的群. - */ - @WeakRefProperty - actual abstract val group: Group - - /** - * 成员的权限, 动态更新. - * - * @see MemberPermissionChangeEvent 权限变更事件. 由群主或机器人的操作触发. - */ - actual abstract val permission: MemberPermission - - /** - * 群名片. 可能为空. - * - * 管理员和群主都可修改任何人(包括群主)的群名片. - * - * 在修改时将会异步上传至服务器. - * - * @see [nameCardOrNick] 获取非空群名片或昵称 - * - * @see MemberCardChangeEvent 群名片被管理员, 自己或 [Bot] 改动事件. 修改时也会触发此事件. - * @throws PermissionDeniedException 无权限修改时 - */ - actual abstract var nameCard: String - - /** - * 群头衔. - * - * 仅群主可以修改群头衔. - * - * 在修改时将会异步上传至服务器. - * - * @see MemberSpecialTitleChangeEvent 群名片被管理员, 自己或 [Bot] 改动事件. 修改时也会触发此事件. - * @throws PermissionDeniedException 无权限修改时 - */ - actual abstract var specialTitle: String - - /** - * 被禁言剩余时长. 单位为秒. - * - * @see isMuted 判断改成员是否处于禁言状态 - * @see mute 设置禁言 - * @see unmute 取消禁言 - */ - actual abstract val muteTimeRemaining: Int - - /** - * 禁言. - * - * QQ 中最小操作和显示的时间都是一分钟. - * 机器人可以实现精确到秒, 会被客户端显示为 1 分钟但不影响实际禁言时间. - * - * 管理员可禁言成员, 群主可禁言管理员和群员. - * - * @param durationSeconds 持续时间. 精确到秒. 范围区间表示为 `(0s, 30days]`. 超过范围则会抛出异常. - * @return 机器人无权限时返回 `false` - * - * @see Int.minutesToSeconds - * @see Int.hoursToSeconds - * @see Int.daysToSeconds - * - * @see MemberMuteEvent 成员被禁言事件 - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmSynthetic - actual abstract suspend fun mute(durationSeconds: Int) - - /** - * 解除禁言. - * - * 管理员可解除成员的禁言, 群主可解除管理员和群员的禁言. - * - * @see MemberUnmuteEvent 成员被取消禁言事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmSynthetic - actual abstract suspend fun unmute() - - /** - * 向这个对象发送消息. - * - * 单条消息最大可发送 4500 字符或 50 张图片. - * - * @see FriendMessageSendEvent 发送好友信息事件, cancellable - * @see GroupMessageSendEvent 发送群消息事件. cancellable - * - * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 - * @throws MessageTooLargeException 当消息过长时抛出 - * - * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) - */ - @JvmSynthetic - actual abstract override suspend fun sendMessage(message: Message): MessageReceipt - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmSynthetic - actual abstract suspend fun kick(message: String) - - /** - * 当且仅当 `[other] is [Member] && [other].id == this.id && [other].group == this.group` 时为 true - */ - actual abstract override fun equals(other: Any?): Boolean - - /** - * @return `bot.hashCode() * 31 + id.hashCode()` - */ - actual abstract override fun hashCode(): Int - -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/PermissionDeniedException.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/PermissionDeniedException.kt deleted file mode 100644 index 8f5320566..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/PermissionDeniedException.kt +++ /dev/null @@ -1,9 +0,0 @@ -package net.mamoe.mirai.contact - -/** - * 权限不足 - */ -actual class PermissionDeniedException : IllegalStateException { - actual constructor() : super("Permission denied") - actual constructor(message: String?) : super(message) -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/QQ.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/QQ.kt deleted file mode 100644 index 63db3304f..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/QQ.kt +++ /dev/null @@ -1,104 +0,0 @@ -@file:Suppress("unused") - -package net.mamoe.mirai.contact - -import kotlinx.coroutines.CoroutineScope -import net.mamoe.mirai.Bot -import net.mamoe.mirai.data.FriendNameRemark -import net.mamoe.mirai.data.PreviousNameList -import net.mamoe.mirai.data.Profile -import net.mamoe.mirai.event.events.BeforeImageUploadEvent -import net.mamoe.mirai.event.events.EventCancelledException -import net.mamoe.mirai.event.events.ImageUploadEvent -import net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent -import net.mamoe.mirai.event.events.MessageSendEvent.GroupMessageSendEvent -import net.mamoe.mirai.message.MessageReceipt -import net.mamoe.mirai.message.data.Message -import net.mamoe.mirai.message.data.OfflineFriendImage -import net.mamoe.mirai.utils.ExternalImage -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.OverFileSizeMaxException - -/** - * QQ 对象. - * 注意: 一个 [QQ] 实例并不是独立的, 它属于一个 [Bot]. - * 它不能被直接构造. 任何时候都应从 [Bot.getFriend] 或事件中获取. - * - * 对于同一个 [Bot] 任何一个人的 [QQ] 实例都是单一的. - * - * A QQ instance helps you to receive event from or sendPacket event to. - * Notice that, one QQ instance belong to one [Bot], that is, QQ instances from different [Bot] are NOT the same. - */ -@Suppress("INAPPLICABLE_JVM_NAME") -actual abstract class QQ : Contact(), CoroutineScope { - /** - * 请求头像下载链接 - */ - // @MiraiExperimentalAPI - //suspend fun queryAvatar(): AvatarLink - /** - * QQ 号码 - */ - actual abstract override val id: Long - /** - * 昵称 - */ - actual abstract val nick: String - - /** - * 查询用户资料 - */ - @MiraiExperimentalAPI("还未支持") - actual abstract suspend fun queryProfile(): Profile - - /** - * 头像下载链接 - */ - actual val avatarUrl: String - get() = "http://q1.qlogo.cn/g?b=qq&nk=$id&s=640" - - /** - * 查询曾用名. - * - * 曾用名可能是: - * - 昵称 - * - 共同群内的群名片 - */ - @MiraiExperimentalAPI("还未支持") - actual abstract suspend fun queryPreviousNameList(): PreviousNameList - - /** - * 查询机器人账号给这个人设置的备注 - */ - @MiraiExperimentalAPI("还未支持") - actual abstract suspend fun queryRemark(): FriendNameRemark - - /** - * 向这个对象发送消息. - * - * 单条消息最大可发送 4500 字符或 50 张图片. - * - * @see FriendMessageSendEvent 发送好友信息事件, cancellable - * @see GroupMessageSendEvent 发送群消息事件. cancellable - * - * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 - * @throws MessageTooLargeException 当消息过长时抛出 - * - * @return 消息回执. 可进行撤回 ([MessageReceipt.recall]) - */ - @JvmSynthetic - actual abstract override suspend fun sendMessage(message: Message): MessageReceipt - - /** - * 上传一个图片以备发送. - * - * @see BeforeImageUploadEvent 图片发送前事件, cancellable - * @see ImageUploadEvent 图片发送完成事件 - * - * @throws EventCancelledException 当发送消息事件被取消 - * @throws OverFileSizeMaxException 当图片文件过大而被服务器拒绝上传时. (最大大小约为 20 MB) - */ - @JvmSynthetic - actual abstract override suspend fun uploadImage(image: ExternalImage): OfflineFriendImage -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/event/events/EventCancelledException.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/event/events/EventCancelledException.kt deleted file mode 100644 index 0e62c4240..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/event/events/EventCancelledException.kt +++ /dev/null @@ -1,9 +0,0 @@ -package net.mamoe.mirai.event.events - -@Suppress("unused") -actual class EventCancelledException : RuntimeException { - actual constructor() : super() - actual constructor(message: String?) : super(message) - actual constructor(message: String?, cause: Throwable?) : super(message, cause) - actual constructor(cause: Throwable?) : super(cause) -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/event/internal/MiraiAtomicBoolean.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/event/internal/MiraiAtomicBoolean.kt deleted file mode 100644 index 2edd1ae6b..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/event/internal/MiraiAtomicBoolean.kt +++ /dev/null @@ -1,42 +0,0 @@ -package net.mamoe.mirai.event.internal - -import net.mamoe.mirai.event.Event -import net.mamoe.mirai.event.Listener -import net.mamoe.mirai.utils.LockFreeLinkedList -import java.util.concurrent.atomic.AtomicBoolean -import kotlin.reflect.KClass - -internal actual class MiraiAtomicBoolean actual constructor(initial: Boolean) { - private val delegate: AtomicBoolean = AtomicBoolean(initial) - - actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean { - return delegate.compareAndSet(expect, update) - } - - actual var value: Boolean - get() = delegate.get() - set(value) { - delegate.set(value) - } -} - -internal actual class EventListeners actual constructor(clazz: KClass) : - LockFreeLinkedList>() { - @Suppress("UNCHECKED_CAST", "UNSUPPORTED", "NO_REFLECTION_IN_CLASS_PATH") - actual val supertypes: Set> by lazy { - val supertypes = mutableSetOf>() - - fun addSupertypes(clazz: KClass) { - clazz.supertypes.forEach { - val classifier = it.classifier as? KClass - if (classifier != null) { - supertypes.add(classifier) - addSupertypes(classifier) - } - } - } - addSupertypes(clazz) - - supertypes - } -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt deleted file mode 100644 index b3412c99e..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("unused") - -package net.mamoe.mirai.message - -import android.graphics.Bitmap -import kotlinx.io.core.Input -import net.mamoe.mirai.contact.Contact -import net.mamoe.mirai.contact.QQ -import net.mamoe.mirai.message.data.Image -import net.mamoe.mirai.utils.MiraiInternalAPI -import java.io.File -import java.io.InputStream -import java.net.URL - -/** - * 平台相关扩展 - */ -@Suppress("DEPRECATION") -@Deprecated( - message = "use ContactMessage", - replaceWith = ReplaceWith("ContactMessage", "net.mamoe.mirai.message.ContactMessage") -) -actual abstract class MessagePacket actual constructor() : - MessagePacketBase() { - - @JvmSynthetic - suspend inline fun uploadImage(image: Bitmap): Image = subject.uploadImage(image) - - @JvmSynthetic - suspend inline fun uploadImage(image: URL): Image = subject.uploadImage(image) - - @JvmSynthetic - suspend inline fun uploadImage(image: Input): Image = subject.uploadImage(image) - - @JvmSynthetic - suspend inline fun uploadImage(image: InputStream): Image = subject.uploadImage(image) - - @JvmSynthetic - suspend inline fun uploadImage(image: File): Image = subject.uploadImage(image) - - @JvmSynthetic - suspend inline fun sendImage(image: Bitmap): MessageReceipt = subject.sendImage(image) - - @JvmSynthetic - suspend inline fun sendImage(image: URL): MessageReceipt = subject.sendImage(image) - - @JvmSynthetic - suspend inline fun sendImage(image: Input): MessageReceipt = subject.sendImage(image) - - @JvmSynthetic - suspend inline fun sendImage(image: InputStream): MessageReceipt = subject.sendImage(image) - - @JvmSynthetic - suspend inline fun sendImage(image: File): MessageReceipt = subject.sendImage(image) - - @JvmSynthetic - suspend inline fun Bitmap.upload(): Image = upload(subject) - - @JvmSynthetic - suspend inline fun URL.uploadAsImage(): Image = uploadAsImage(subject) - - @JvmSynthetic - suspend inline fun Input.uploadAsImage(): Image = uploadAsImage(subject) - - @JvmSynthetic - suspend inline fun InputStream.uploadAsImage(): Image = uploadAsImage(subject) - - @JvmSynthetic - suspend inline fun File.uploadAsImage(): Image = uploadAsImage(subject) - - @JvmSynthetic - suspend inline fun Bitmap.send(): MessageReceipt = sendTo(subject) - - @JvmSynthetic - suspend inline fun URL.sendAsImage(): MessageReceipt = sendAsImageTo(subject) - - @JvmSynthetic - suspend inline fun Input.sendAsImage(): MessageReceipt = sendAsImageTo(subject) - - @JvmSynthetic - suspend inline fun InputStream.sendAsImage(): MessageReceipt = sendAsImageTo(subject) - - @JvmSynthetic - suspend inline fun File.sendAsImage(): MessageReceipt = sendAsImageTo(subject) -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/SendImageUtilsAndroid.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/SendImageUtilsAndroid.kt deleted file mode 100644 index 40d9d0e77..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/SendImageUtilsAndroid.kt +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("unused") - -package net.mamoe.mirai.message - -import android.graphics.Bitmap -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext -import kotlinx.io.core.Input -import net.mamoe.mirai.contact.Contact -import net.mamoe.mirai.message.data.Image -import net.mamoe.mirai.utils.OverFileSizeMaxException -import net.mamoe.mirai.utils.sendTo -import net.mamoe.mirai.utils.toExternalImage -import net.mamoe.mirai.utils.upload -import java.io.File -import java.io.InputStream -import java.net.URL - -/* - * 发送图片的一些扩展函数. - */ - -// region IMAGE.sendAsImageTo(Contact) - -/** - * 在 [Dispatchers.IO] 中将图片发送到指定联系人. 不会创建临时文件 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun Bitmap.sendTo(contact: C): MessageReceipt = - withContext(Dispatchers.IO) { toExternalImage() }.sendTo(contact) - -/** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun URL.sendAsImageTo(contact: C): MessageReceipt = - withContext(Dispatchers.IO) { toExternalImage() }.sendTo(contact) - -/** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun Input.sendAsImageTo(contact: C): MessageReceipt = - withContext(Dispatchers.IO) { toExternalImage() }.sendTo(contact) - -/** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun InputStream.sendAsImageTo(contact: C): MessageReceipt = - withContext(Dispatchers.IO) { toExternalImage() }.sendTo(contact) - -/** - * 在 [Dispatchers.IO] 中将文件作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun File.sendAsImageTo(contact: C): MessageReceipt { - require(this.exists() && this.canRead()) - return withContext(Dispatchers.IO) { toExternalImage() }.sendTo(contact) -} - -// endregion - -// region IMAGE.Upload(Contact): Image - -/** - * 在 [Dispatchers.IO] 中将图片上传后构造 [Image]. 不会创建临时文件 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun Bitmap.upload(contact: Contact): Image = withContext(Dispatchers.IO) { toExternalImage() }.upload(contact) - -/** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片上传后构造 [Image] - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun URL.uploadAsImage(contact: Contact): Image = - withContext(Dispatchers.IO) { toExternalImage() }.upload(contact) - -/** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片上传后构造 [Image] - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun Input.uploadAsImage(contact: Contact): Image = - withContext(Dispatchers.IO) { toExternalImage() }.upload(contact) - -/** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片上传后构造 [Image] - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun InputStream.uploadAsImage(contact: Contact): Image = - withContext(Dispatchers.IO) { toExternalImage() }.upload(contact) - -/** - * 在 [Dispatchers.IO] 中将文件作为图片上传后构造 [Image] - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend fun File.uploadAsImage(contact: Contact): Image { - require(this.exists() && this.canRead()) - return withContext(Dispatchers.IO) { toExternalImage() }.upload(contact) -} - -// endregion - -// region Contact.sendImage(IMAGE) - -/** - * 在 [Dispatchers.IO] 中将图片发送到指定联系人. 不会保存临时文件 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun C.sendImage(bufferedImage: Bitmap): MessageReceipt = bufferedImage.sendTo(this) - -/** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun C.sendImage(imageUrl: URL): MessageReceipt = imageUrl.sendAsImageTo(this) - -/** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun C.sendImage(imageInput: Input): MessageReceipt = imageInput.sendAsImageTo(this) - -/** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun C.sendImage(imageStream: InputStream): MessageReceipt = - imageStream.sendAsImageTo(this) - -/** - * 在 [Dispatchers.IO] 中将文件作为图片发送到指定联系人 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun C.sendImage(file: File): MessageReceipt = file.sendAsImageTo(this) - -// endregion - -// region Contact.uploadImage(IMAGE) - -/** - * 在 [Dispatchers.IO] 中将图片上传, 但不发送. 不会保存临时文件 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun Contact.uploadImage(bufferedImage: Bitmap): Image = bufferedImage.upload(this) - -/** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun Contact.uploadImage(imageUrl: URL): Image = imageUrl.uploadAsImage(this) - -/** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun Contact.uploadImage(imageInput: Input): Image = imageInput.uploadAsImage(this) - -/** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun Contact.uploadImage(imageStream: InputStream): Image = imageStream.uploadAsImage(this) - -/** - * 在 [Dispatchers.IO] 中将文件作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ -@Throws(OverFileSizeMaxException::class) -suspend inline fun Contact.uploadImage(file: File): Image = file.uploadAsImage(this) - -// endregion \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/ExternalImage.android.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/ExternalImage.android.kt deleted file mode 100644 index 3b8b7ab4a..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/ExternalImage.android.kt +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("EXPERIMENTAL_API_USAGE", "unused") - -package net.mamoe.mirai.utils -import android.graphics.Bitmap -import android.graphics.BitmapFactory -import kotlinx.coroutines.Dispatchers.IO -import kotlinx.coroutines.withContext -import kotlinx.io.core.Input -import kotlinx.io.core.IoBuffer -import kotlinx.io.core.copyTo -import kotlinx.io.errors.IOException -import kotlinx.io.streams.asInput -import kotlinx.io.streams.asOutput -import net.mamoe.mirai.utils.internal.md5 -import java.io.File -import java.io.InputStream -import java.net.URL - -/* - * 将各类型图片容器转为 [ExternalImage] - */ - -/** - * 读取 [Bitmap] 的属性, 然后构造 [ExternalImage] - */ -@Suppress("UNUSED_PARAMETER") -@Throws(IOException::class) -fun Bitmap.toExternalImage(formatName: String = "gif"): ExternalImage { - TODO() -} - -// suspend inline fun BufferedImage.suspendToExternalImage(): ExternalImage = withContext(IO) { toExternalImage() } - -/** - * 读取文件头识别图片属性, 然后构造 [ExternalImage] - */ -@Throws(IOException::class) -fun File.toExternalImage(): ExternalImage { - val input = BitmapFactory.decodeFile(this.absolutePath) - checkNotNull(input) { "Unable to read file(path=${this.path}), BitmapFactory.decodeFile returned null" } - - return ExternalImage( - width = input.width, - height = input.height, - md5 = this.inputStream().use { it.md5() }, - imageFormat = this.nameWithoutExtension, - input = this.inputStream().asInput(IoBuffer.Pool), - inputSize = this.length(), - filename = this.name - ) -} - -/** - * 在 [IO] 中进行 [File.toExternalImage] - */ -suspend inline fun File.suspendToExternalImage(): ExternalImage = withContext(IO) { toExternalImage() } - -/** - * 下载文件到临时目录然后调用 [File.toExternalImage] - */ -@Throws(IOException::class) -fun URL.toExternalImage(): ExternalImage { - val file = createTempFile().apply { deleteOnExit() } - file.outputStream().asOutput().use { output -> - openStream().asInput().use { input -> - input.copyTo(output) - } - output.flush() - } - return file.toExternalImage() -} - -/** - * 在 [IO] 中进行 [URL.toExternalImage] - */ -suspend inline fun URL.suspendToExternalImage(): ExternalImage = withContext(IO) { toExternalImage() } - -/** - * 保存为临时文件然后调用 [File.toExternalImage] - */ -@Throws(IOException::class) -fun InputStream.toExternalImage(): ExternalImage { - val file = createTempFile().apply { deleteOnExit() } - file.outputStream().use { - this.copyTo(it) - it.flush() - } - this.close() - return file.toExternalImage() -} - -/** - * 在 [IO] 中进行 [InputStream.toExternalImage] - */ -suspend inline fun InputStream.suspendToExternalImage(): ExternalImage = withContext(IO) { toExternalImage() } - -/** - * 保存为临时文件然后调用 [File.toExternalImage]. - * - * 需要函数调用者 close [this] - */ -@Throws(IOException::class) -fun Input.toExternalImage(): ExternalImage { - val file = createTempFile().apply { deleteOnExit() } - file.outputStream().asOutput().use { - this.copyTo(it) - it.flush() - } - return file.toExternalImage() -} - -/** - * 在 [IO] 中进行 [Input.toExternalImage] - */ -suspend inline fun Input.suspendToExternalImage(): ExternalImage = withContext(IO) { toExternalImage() } - -/* -/** - * 保存为临时文件然后调用 [File.toExternalImage]. - */ -suspend fun ByteReadChannel.toExternalImage(): ExternalImage { - val file = createTempFile().apply { deleteOnExit() } - file.outputStream().use { - withContext(IO) { copyTo(it) } - it.flush() - } - - return file.suspendToExternalImage() -}*/ \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/LoginSolver.android.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/LoginSolver.android.kt deleted file mode 100644 index 617edf2a9..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/LoginSolver.android.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.utils - -import net.mamoe.mirai.Bot -import java.io.File - -actual typealias Throws = kotlin.jvm.Throws - -/** - * 验证码, 设备锁解决器 - */ -actual abstract class LoginSolver { - actual abstract suspend fun onSolvePicCaptcha(bot: Bot, data: ByteArray): String? - actual abstract suspend fun onSolveSliderCaptcha(bot: Bot, url: String): String? - actual abstract suspend fun onSolveUnsafeDeviceLoginVerify(bot: Bot, url: String): String? - - actual companion object { - actual val Default: LoginSolver - get() = object : LoginSolver() { - override suspend fun onSolvePicCaptcha(bot: Bot, data: ByteArray): String? { - error("should be implemented manually by you") - } - - override suspend fun onSolveSliderCaptcha(bot: Bot, url: String): String? { - error("should be implemented manually by you") - } - - override suspend fun onSolveUnsafeDeviceLoginVerify(bot: Bot, url: String): String? { - error("should be implemented manually by you") - } - } - } - -} - -internal actual fun getFileBasedDeviceInfoSupplier(filename: String): ((Context) -> DeviceInfo)? { - return { - File(filename).loadAsDeviceInfo(it) - } -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/OverFileSizeMaxException.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/OverFileSizeMaxException.kt deleted file mode 100644 index 4a31ad010..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/OverFileSizeMaxException.kt +++ /dev/null @@ -1,6 +0,0 @@ -package net.mamoe.mirai.utils - -/** - * 图片文件过大 - */ -actual class OverFileSizeMaxException : IllegalStateException() \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.android.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.android.kt deleted file mode 100644 index 7d615c46b..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/PlatformLogger.android.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -package net.mamoe.mirai.utils - -import android.util.Log - -/** - * Android 平台的默认的日志记录器, 使用 [Log] - * 不应该直接构造这个类的实例. 需使用 [DefaultLogger] - */ -actual open class PlatformLogger actual constructor(override val identity: String?) : MiraiLoggerPlatformBase() { - override fun verbose0(message: String?) { - Log.v(identity, message ?: "") - } - - override fun verbose0(message: String?, e: Throwable?) { - Log.v(identity, message ?: "", e) - } - - override fun debug0(message: String?) { - Log.d(identity, message ?: "") - } - - override fun debug0(message: String?, e: Throwable?) { - Log.d(identity, message ?: "", e) - } - - override fun info0(message: String?) { - Log.i(identity, message ?: "") - } - - override fun info0(message: String?, e: Throwable?) { - Log.i(identity, message ?: "", e) - } - - override fun warning0(message: String?) { - Log.w(identity, message ?: "") - } - - override fun warning0(message: String?, e: Throwable?) { - Log.w(identity, message ?: "", e) - } - - override fun error0(message: String?) { - Log.e(identity, message ?: "") - } - - override fun error0(message: String?, e: Throwable?) { - Log.e(identity, message ?: "", e) - } -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.android.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.android.kt deleted file mode 100644 index 2bec88cd7..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.android.kt +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("unused") - -package net.mamoe.mirai.utils - -import android.annotation.SuppressLint -import android.net.wifi.WifiManager -import android.os.Build -import android.telephony.TelephonyManager -import kotlinx.io.core.toByteArray -import kotlinx.serialization.Serializable -import kotlinx.serialization.Transient -import kotlinx.serialization.UnstableDefault -import kotlinx.serialization.json.Json -import net.mamoe.mirai.utils.internal.md5 -import java.io.File - -/** - * 加载一个设备信息. 若文件不存在或为空则随机并创建一个设备信息保存. - */ -@OptIn(UnstableDefault::class) -fun File.loadAsDeviceInfo(context: Context): DeviceInfo { - if (!this.exists() || this.length() == 0L) { - return SystemDeviceInfo(context).also { - this.writeText(JSON.stringify(SystemDeviceInfo.serializer(), it)) - } - } - return JSON.parse(DeviceInfoData.serializer(), this.readText()).also { - it.context = context - } -} - -@OptIn(UnstableDefault::class) -private val JSON = Json { - isLenient = true - ignoreUnknownKeys = true -} - -/** - * 部分引用指向 [Build]. - * 部分需要权限, 若无权限则会使用默认值. - */ -@Serializable -actual open class SystemDeviceInfo actual constructor() : DeviceInfo() { - actual constructor(context: Context) : this() { - this.context = context - } - - @Transient - final override lateinit var context: Context - - override val display: ByteArray get() = Build.DISPLAY.orEmpty().toByteArray() - override val product: ByteArray get() = Build.PRODUCT.orEmpty().toByteArray() - override val device: ByteArray get() = Build.DEVICE.orEmpty().toByteArray() - override val board: ByteArray get() = Build.BOARD.orEmpty().toByteArray() - override val brand: ByteArray get() = Build.BRAND.orEmpty().toByteArray() - override val model: ByteArray get() = Build.MODEL.orEmpty().toByteArray() - override val bootloader: ByteArray get() = Build.BOOTLOADER.orEmpty().toByteArray() - - override val baseBand: ByteArray - @SuppressLint("PrivateApi") - @Suppress("SpellCheckingInspection") - get() = kotlin.runCatching { - Class.forName("android.os.SystemProperties").let { clazz -> - clazz.getMethod("get", String::class.java, String::class.java) - .invoke(clazz.newInstance(), "gsm.version.baseband", "no message") - ?.toString().orEmpty() - } - }.getOrElse { "" }.toByteArray() - - override val fingerprint: ByteArray get() = Build.FINGERPRINT.toByteArray() - override val procVersion: ByteArray - get() = kotlin.runCatching { File("/proc/version").useLines { it.firstOrNull().orEmpty() }.toByteArray() } - .getOrElse { byteArrayOf() } - override val bootId: ByteArray - get() = kotlin.runCatching { - File("/proc/sys/kernel/random/boot_id").useLines { it.firstOrNull().orEmpty() }.toByteArray() - }.getOrEmpty() - override val version: DeviceInfo.Version get() = Version - - override val simInfo: ByteArray - get() = kotlin.runCatching { - val telephonyManager = - context.applicationContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager - if (telephonyManager.simState == 5) { - telephonyManager.simOperatorName.orEmpty().toByteArray() - } else byteArrayOf() - }.getOrEmpty() - - override val osType: ByteArray = "android".toByteArray() - override val macAddress: ByteArray get() = "02:00:00:00:00:00".toByteArray() - override val wifiBSSID: ByteArray? - get() = kotlin.runCatching { - (context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager).connectionInfo.bssid.orEmpty() - .toByteArray() - }.getOrEmpty() - - override val wifiSSID: ByteArray? - get() = kotlin.runCatching { - (context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager).connectionInfo.ssid.orEmpty() - .toByteArray() - }.getOrEmpty() - override val imsiMd5: ByteArray - @SuppressLint("HardwareIds") - get() = kotlin.runCatching { - (context.applicationContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).subscriberId.orEmpty() - .toByteArray() - }.getOrEmpty().md5() - - override val imei: String - @SuppressLint("HardwareIds") - get() = kotlin.runCatching { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - (context.applicationContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).imei - } else { - @Suppress("DEPRECATION") - (context.applicationContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager).deviceId - }.orEmpty() - }.getOrElse { "" } - - override val androidId: ByteArray get() = Build.ID.toByteArray() - override val apn: ByteArray get() = "wifi".toByteArray() - - @Serializable - actual object Version : DeviceInfo.Version { - override val incremental: ByteArray get() = Build.VERSION.INCREMENTAL.orEmpty().toByteArray() - override val release: ByteArray get() = Build.VERSION.RELEASE.orEmpty().toByteArray() - override val codename: ByteArray get() = Build.VERSION.CODENAME.orEmpty().toByteArray() - override val sdk: Int get() = Build.VERSION.SDK_INT - } -} - -private val EMPTY_BYTE_ARRAY: ByteArray = ByteArray(0) - -@Suppress("NOTHING_TO_INLINE") -private inline fun Result.getOrEmpty() = this.getOrNull() ?: EMPTY_BYTE_ARRAY \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/addSuppressed.android.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/addSuppressed.android.kt deleted file mode 100644 index ab617e14d..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/addSuppressed.android.kt +++ /dev/null @@ -1,26 +0,0 @@ -@file:Suppress("DuplicatedCode") - -package net.mamoe.mirai.utils.internal - -import android.os.Build - -private var isAddSuppressedSupported: Boolean = true - -@PublishedApi -internal actual fun Throwable.addSuppressedMirai(e: Throwable) { - if (this == e) { - return - } - if (!isAddSuppressedSupported) { - return - } - try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - this.addSuppressed(e) - } else { - isAddSuppressedSupported = false - } - } catch (e: Exception) { - isAddSuppressedSupported = false - } -} \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/md5.android.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/md5.android.kt deleted file mode 100644 index 13db2be72..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/md5.android.kt +++ /dev/null @@ -1,22 +0,0 @@ -@file:Suppress("EXPERIMENTAL_API_USAGE", "unused") - -package net.mamoe.mirai.utils.internal - -import java.io.InputStream -import java.security.MessageDigest - -internal actual fun ByteArray.md5(offset: Int, length: Int): ByteArray { - this.checkOffsetAndLength(offset, length) - return MessageDigest.getInstance("MD5").apply { update(this@md5, offset, length) }.digest() -} - -internal actual fun InputStream.md5(): ByteArray { - val digest = MessageDigest.getInstance("md5") - digest.reset() - this.readInSequence { - digest.update(it.toByte()) - } - return digest.digest() -} - -internal actual typealias InputStream = InputStream \ No newline at end of file diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt deleted file mode 100644 index c080aaeb3..000000000 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/internal/runBlocking.kt +++ /dev/null @@ -1,12 +0,0 @@ -package net.mamoe.mirai.utils.internal - -import kotlinx.coroutines.CoroutineScope -import kotlin.coroutines.CoroutineContext - -/** - * Mirror of `runBlocking` from `kotlinx.serialization` on JVM - */ -internal actual fun runBlocking( - context: CoroutineContext, - block: suspend CoroutineScope.() -> T -): T = kotlinx.coroutines.runBlocking(context, block) \ No newline at end of file diff --git a/mirai-core/src/androidTest/kotlin/net/mamoe/mirai/test/runBlocking.kt b/mirai-core/src/androidTest/kotlin/net/mamoe/mirai/test/runBlocking.kt deleted file mode 100644 index e954e0e5b..000000000 --- a/mirai-core/src/androidTest/kotlin/net/mamoe/mirai/test/runBlocking.kt +++ /dev/null @@ -1,9 +0,0 @@ -package net.mamoe.mirai.test - -import kotlinx.coroutines.CoroutineScope -import kotlin.coroutines.CoroutineContext - -internal actual fun runBlocking( - context: CoroutineContext, - block: suspend CoroutineScope.() -> R -): R = kotlinx.coroutines.runBlocking(context, block) \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotAccount.kt b/mirai-core/src/commonMain/kotlin/BotAccount.kt similarity index 93% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotAccount.kt rename to mirai-core/src/commonMain/kotlin/BotAccount.kt index 7e1bf8be2..9c457ab81 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotAccount.kt +++ b/mirai-core/src/commonMain/kotlin/BotAccount.kt @@ -6,13 +6,12 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") -package net.mamoe.mirai.qqandroid +package net.mamoe.mirai.internal import kotlinx.io.core.toByteArray -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils import net.mamoe.mirai.utils.MiraiExperimentalAPI import kotlin.jvm.JvmSynthetic diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotFactory.kt b/mirai-core/src/commonMain/kotlin/BotFactory.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotFactory.kt rename to mirai-core/src/commonMain/kotlin/BotFactory.kt index c67ad7c14..87640c0e3 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotFactory.kt +++ b/mirai-core/src/commonMain/kotlin/BotFactory.kt @@ -6,17 +6,16 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith", "OverridingDeprecatedMember" ) -package net.mamoe.mirai.qqandroid +package net.mamoe.mirai.internal import net.mamoe.mirai.Bot import net.mamoe.mirai.BotFactory -import net.mamoe.mirai.qqandroid.QQAndroid.Bot +import net.mamoe.mirai.internal.QQAndroid.Bot import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.Context import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotImpl.kt b/mirai-core/src/commonMain/kotlin/BotImpl.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotImpl.kt rename to mirai-core/src/commonMain/kotlin/BotImpl.kt index da52de868..d00791d40 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/BotImpl.kt +++ b/mirai-core/src/commonMain/kotlin/BotImpl.kt @@ -6,7 +6,6 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress( "EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR", @@ -15,7 +14,7 @@ "INVISIBLE_MEMBER" ) -package net.mamoe.mirai.qqandroid +package net.mamoe.mirai.internal import kotlinx.coroutines.* import net.mamoe.mirai.Bot @@ -24,11 +23,11 @@ import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.BotOfflineEvent import net.mamoe.mirai.event.events.BotReloginEvent import net.mamoe.mirai.event.subscribeAlways +import net.mamoe.mirai.internal.network.BotNetworkHandler +import net.mamoe.mirai.internal.network.DefaultServerList +import net.mamoe.mirai.internal.network.closeAndJoin import net.mamoe.mirai.network.ForceOfflineException import net.mamoe.mirai.network.LoginFailedException -import net.mamoe.mirai.qqandroid.network.BotNetworkHandler -import net.mamoe.mirai.qqandroid.network.DefaultServerList -import net.mamoe.mirai.qqandroid.network.closeAndJoin import net.mamoe.mirai.supervisorJob import net.mamoe.mirai.utils.* import net.mamoe.mirai.utils.internal.retryCatching diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt b/mirai-core/src/commonMain/kotlin/QQAndroidBot.common.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt rename to mirai-core/src/commonMain/kotlin/QQAndroidBot.common.kt index 0af5a5bd0..ee7376a05 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt +++ b/mirai-core/src/commonMain/kotlin/QQAndroidBot.common.kt @@ -6,10 +6,9 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("EXPERIMENTAL_API_USAGE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package net.mamoe.mirai.qqandroid +package net.mamoe.mirai.internal import io.ktor.client.request.* import io.ktor.client.request.forms.* @@ -31,27 +30,27 @@ import net.mamoe.mirai.event.events.MessageRecallEvent import net.mamoe.mirai.event.events.NewFriendRequestEvent import net.mamoe.mirai.event.internal.MiraiAtomicBoolean import net.mamoe.mirai.getGroupOrNull +import net.mamoe.mirai.internal.contact.FriendImpl +import net.mamoe.mirai.internal.contact.GroupImpl +import net.mamoe.mirai.internal.contact.MemberInfoImpl +import net.mamoe.mirai.internal.contact.checkIsGroupImpl +import net.mamoe.mirai.internal.message.* +import net.mamoe.mirai.internal.network.QQAndroidBotNetworkHandler +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.highway.HighwayHelper +import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopNum +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.LongMsg +import net.mamoe.mirai.internal.network.protocol.packet.chat.* +import net.mamoe.mirai.internal.network.protocol.packet.chat.voice.PttStore +import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.encodeToString +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.action.Nudge import net.mamoe.mirai.message.data.* import net.mamoe.mirai.network.LoginFailedException -import net.mamoe.mirai.qqandroid.contact.FriendImpl -import net.mamoe.mirai.qqandroid.contact.GroupImpl -import net.mamoe.mirai.qqandroid.contact.MemberInfoImpl -import net.mamoe.mirai.qqandroid.contact.checkIsGroupImpl -import net.mamoe.mirai.qqandroid.message.* -import net.mamoe.mirai.qqandroid.network.QQAndroidBotNetworkHandler -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.highway.HighwayHelper -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.StTroopNum -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.LongMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.* -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.voice.PttStore -import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils.encodeToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray import net.mamoe.mirai.utils.* import kotlin.collections.asSequence import kotlin.contracts.contract @@ -60,7 +59,7 @@ import kotlin.jvm.JvmField import kotlin.jvm.JvmSynthetic import kotlin.math.absoluteValue import kotlin.random.Random -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FriendInfo as JceFriendInfo +import net.mamoe.mirai.internal.network.protocol.data.jce.FriendInfo as JceFriendInfo internal fun Bot.asQQAndroidBot(): QQAndroidBot { contract { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/FriendImpl.kt b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt similarity index 91% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/FriendImpl.kt rename to mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt index fa12f0ac8..6e8e1f9b9 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/FriendImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt @@ -16,7 +16,7 @@ "INVISIBLE_REFERENCE" ) -package net.mamoe.mirai.qqandroid.contact +package net.mamoe.mirai.internal.contact import kotlinx.atomicfu.AtomicInt import kotlinx.atomicfu.atomic @@ -30,17 +30,17 @@ import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.BeforeImageUploadEvent import net.mamoe.mirai.event.events.EventCancelledException import net.mamoe.mirai.event.events.ImageUploadEvent +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.highway.postImage +import net.mamoe.mirai.internal.network.highway.sizeToString +import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x352 +import net.mamoe.mirai.internal.network.protocol.packet.chat.image.LongConn +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.toUHexString import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.data.Image import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.isContentNotEmpty -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.highway.postImage -import net.mamoe.mirai.qqandroid.network.highway.sizeToString -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Cmd0x352 -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image.LongConn -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils.toUHexString import net.mamoe.mirai.utils.ExternalImage import net.mamoe.mirai.utils.getValue import net.mamoe.mirai.utils.unsafeWeakRef @@ -54,7 +54,7 @@ import kotlin.math.roundToInt import kotlin.time.measureTime internal class FriendInfoImpl( - @JvmField private val jceFriendInfo: net.mamoe.mirai.qqandroid.network.protocol.data.jce.FriendInfo + @JvmField private val jceFriendInfo: net.mamoe.mirai.internal.network.protocol.data.jce.FriendInfo ) : FriendInfo { @JvmField internal var cachedNick: String? = null override val nick: String get() = cachedNick ?: jceFriendInfo.nick.also { cachedNick = it } diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt rename to mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt index c0bb87d5f..918a8896b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt @@ -10,7 +10,7 @@ @file:Suppress("INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @file:OptIn(LowLevelAPI::class) -package net.mamoe.mirai.qqandroid.contact +package net.mamoe.mirai.internal.contact import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob @@ -22,22 +22,22 @@ import net.mamoe.mirai.data.GroupInfo import net.mamoe.mirai.data.MemberInfo import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.* +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.message.MessageSourceToGroupImpl +import net.mamoe.mirai.internal.message.ensureSequenceIdAvailable +import net.mamoe.mirai.internal.message.firstIsInstanceOrNull +import net.mamoe.mirai.internal.network.highway.HighwayHelper +import net.mamoe.mirai.internal.network.protocol.packet.chat.TroopManagement +import net.mamoe.mirai.internal.network.protocol.packet.chat.image.ImgStore +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.MessageSvcPbSendMsg +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.createToGroup +import net.mamoe.mirai.internal.network.protocol.packet.chat.voice.PttStore +import net.mamoe.mirai.internal.network.protocol.packet.list.ProfileService +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.estimateLength +import net.mamoe.mirai.internal.utils.toUHexString import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.data.* -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.message.MessageSourceToGroupImpl -import net.mamoe.mirai.qqandroid.message.ensureSequenceIdAvailable -import net.mamoe.mirai.qqandroid.message.firstIsInstanceOrNull -import net.mamoe.mirai.qqandroid.network.highway.HighwayHelper -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.TroopManagement -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image.ImgStore -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvcPbSendMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.createToGroup -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.voice.PttStore -import net.mamoe.mirai.qqandroid.network.protocol.packet.list.ProfileService -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils.estimateLength -import net.mamoe.mirai.qqandroid.utils.toUHexString import net.mamoe.mirai.utils.* import java.io.InputStream import kotlin.contracts.contract diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt b/mirai-core/src/commonMain/kotlin/contact/MemberImpl.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt rename to mirai-core/src/commonMain/kotlin/contact/MemberImpl.kt index 613ce5b91..9af748cd4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/MemberImpl.kt @@ -9,7 +9,7 @@ @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -package net.mamoe.mirai.qqandroid.contact +package net.mamoe.mirai.internal.contact import kotlinx.atomicfu.AtomicInt import kotlinx.atomicfu.atomic @@ -19,16 +19,16 @@ import net.mamoe.mirai.contact.* import net.mamoe.mirai.data.MemberInfo import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.* +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.message.MessageSourceToTempImpl +import net.mamoe.mirai.internal.message.ensureSequenceIdAvailable +import net.mamoe.mirai.internal.message.firstIsInstanceOrNull +import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopMemberInfo +import net.mamoe.mirai.internal.network.protocol.packet.chat.TroopManagement +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.MessageSvcPbSendMsg +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.createToTemp import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.data.* -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.message.MessageSourceToTempImpl -import net.mamoe.mirai.qqandroid.message.ensureSequenceIdAvailable -import net.mamoe.mirai.qqandroid.message.firstIsInstanceOrNull -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.StTroopMemberInfo -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.TroopManagement -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvcPbSendMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.createToTemp import net.mamoe.mirai.utils.ExternalImage import net.mamoe.mirai.utils.currentTimeSeconds import net.mamoe.mirai.utils.getValue diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/util.kt b/mirai-core/src/commonMain/kotlin/contact/util.kt similarity index 90% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/util.kt rename to mirai-core/src/commonMain/kotlin/contact/util.kt index a40c93c07..b254a8837 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/util.kt +++ b/mirai-core/src/commonMain/kotlin/contact/util.kt @@ -9,7 +9,7 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -package net.mamoe.mirai.qqandroid.contact +package net.mamoe.mirai.internal.contact import net.mamoe.mirai.contact.Contact import net.mamoe.mirai.contact.Friend @@ -18,16 +18,16 @@ import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.EventCancelledException import net.mamoe.mirai.event.events.FriendMessagePostSendEvent import net.mamoe.mirai.event.events.FriendMessagePreSendEvent +import net.mamoe.mirai.internal.asQQAndroidBot +import net.mamoe.mirai.internal.message.MessageSourceToFriendImpl +import net.mamoe.mirai.internal.message.ensureSequenceIdAvailable +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.MessageSvcPbSendMsg +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.createToFriend import net.mamoe.mirai.message.* import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.QuoteReply import net.mamoe.mirai.message.data.asMessageChain import net.mamoe.mirai.message.data.firstIsInstanceOrNull -import net.mamoe.mirai.qqandroid.asQQAndroidBot -import net.mamoe.mirai.qqandroid.message.MessageSourceToFriendImpl -import net.mamoe.mirai.qqandroid.message.ensureSequenceIdAvailable -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvcPbSendMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.createToFriend import net.mamoe.mirai.utils.verbose import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/FlashImageImpl.kt b/mirai-core/src/commonMain/kotlin/message/FlashImageImpl.kt similarity index 86% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/FlashImageImpl.kt rename to mirai-core/src/commonMain/kotlin/message/FlashImageImpl.kt index 429471ae7..81e23b104 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/FlashImageImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/FlashImageImpl.kt @@ -9,14 +9,14 @@ @file:Suppress("DEPRECATION_ERROR", "UnusedImport") -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message +import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray import net.mamoe.mirai.message.data.FriendFlashImage import net.mamoe.mirai.message.data.GroupFlashImage import net.mamoe.mirai.message.data.md5 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.HummerCommelem -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray internal fun GroupFlashImage.toJceData() = ImMsgBody.Elem( diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/atImpl.kt b/mirai-core/src/commonMain/kotlin/message/atImpl.kt similarity index 92% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/atImpl.kt rename to mirai-core/src/commonMain/kotlin/message/atImpl.kt index e90d58cd2..89189cd92 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/atImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/atImpl.kt @@ -7,13 +7,13 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message import kotlinx.io.core.buildPacket import kotlinx.io.core.readBytes +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody import net.mamoe.mirai.message.data.At import net.mamoe.mirai.message.data.AtAll -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody internal fun At.toJceData(): ImMsgBody.Text { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/conversions.kt b/mirai-core/src/commonMain/kotlin/message/conversions.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/conversions.kt rename to mirai-core/src/commonMain/kotlin/message/conversions.kt index 9d96f1617..34c407767 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/conversions.kt +++ b/mirai-core/src/commonMain/kotlin/message/conversions.kt @@ -10,7 +10,7 @@ @file:OptIn(LowLevelAPI::class) @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message import kotlinx.io.core.String import kotlinx.io.core.discardExact @@ -18,13 +18,13 @@ import kotlinx.io.core.readUInt import kotlinx.io.core.toByteArray import net.mamoe.mirai.Bot import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.utils.* +import net.mamoe.mirai.internal.utils.io.serialization.loadAs +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray import net.mamoe.mirai.message.data.* -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.HummerCommelem -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.utils.* -import net.mamoe.mirai.qqandroid.utils.io.serialization.loadAs -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray import kotlin.contracts.ExperimentalContracts import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/faceImpl.kt b/mirai-core/src/commonMain/kotlin/message/faceImpl.kt similarity index 76% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/faceImpl.kt rename to mirai-core/src/commonMain/kotlin/message/faceImpl.kt index 13fc34193..48cf715d6 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/faceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/faceImpl.kt @@ -7,12 +7,12 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.utils.hexToBytes +import net.mamoe.mirai.internal.utils.toByteArray import net.mamoe.mirai.message.data.Face -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.utils.hexToBytes -import net.mamoe.mirai.qqandroid.utils.toByteArray internal val FACE_BUF = "00 01 00 04 52 CC F5 D0".hexToBytes() diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/imagesImpl.kt b/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/imagesImpl.kt rename to mirai-core/src/commonMain/kotlin/message/imagesImpl.kt index 013faf93d..2bc01a59d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/imagesImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt @@ -9,11 +9,11 @@ @file:Suppress("DEPRECATION_ERROR") -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.utils.hexToBytes import net.mamoe.mirai.message.data.* -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.utils.hexToBytes import net.mamoe.mirai.utils.ExternalImage internal class OnlineGroupImageImpl( diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/incomingSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/incomingSourceImpl.kt similarity index 92% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/incomingSourceImpl.kt rename to mirai-core/src/commonMain/kotlin/message/incomingSourceImpl.kt index 1b579ff5f..769d234a4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/incomingSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/incomingSourceImpl.kt @@ -9,24 +9,24 @@ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message import net.mamoe.mirai.Bot import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Member import net.mamoe.mirai.event.internal.MiraiAtomicBoolean +import net.mamoe.mirai.internal.contact.GroupImpl +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.network.protocol.data.proto.SourceMsg +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils._miraiContentToString +import net.mamoe.mirai.internal.utils.encodeToString +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.MessageSource import net.mamoe.mirai.message.data.OnlineMessageSource -import net.mamoe.mirai.qqandroid.contact.GroupImpl -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.SourceMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils._miraiContentToString -import net.mamoe.mirai.qqandroid.utils.encodeToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray internal interface MessageSourceInternal { val sequenceId: Int diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/offlineSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/offlineSourceImpl.kt similarity index 91% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/offlineSourceImpl.kt rename to mirai-core/src/commonMain/kotlin/message/offlineSourceImpl.kt index 07ab60e71..822487a0e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/offlineSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/offlineSourceImpl.kt @@ -9,17 +9,17 @@ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message import net.mamoe.mirai.Bot import net.mamoe.mirai.event.internal.MiraiAtomicBoolean +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.network.protocol.data.proto.SourceMsg +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.serialization.loadAs import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.OfflineMessageSource -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.SourceMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.serialization.loadAs internal class OfflineMessageSourceImplByMsg( diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/outgoingSourceImpl.kt similarity index 93% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt rename to mirai-core/src/commonMain/kotlin/message/outgoingSourceImpl.kt index 6f2446372..6e31f1bd8 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/outgoingSourceImpl.kt @@ -9,7 +9,7 @@ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package net.mamoe.mirai.qqandroid.message +package net.mamoe.mirai.internal.message import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Deferred @@ -20,14 +20,14 @@ import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.Member import net.mamoe.mirai.event.asyncFromEventOrNull import net.mamoe.mirai.event.internal.MiraiAtomicBoolean +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.network.protocol.data.proto.SourceMsg +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.OnlinePushPbPushGroupMsg.SendGroupMessageReceipt +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.MessageSource import net.mamoe.mirai.message.data.OnlineMessageSource -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.SourceMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.OnlinePushPbPushGroupMsg.SendGroupMessageReceipt -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray private fun T.toJceDataImpl(): ImMsgBody.SourceMsg diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/Serializable.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/Serializable.kt deleted file mode 100644 index a0f045ac0..000000000 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/java.bindings/io/Serializable.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * * Copyright 2020 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/master/LICENSE - * - */ - -@file:Suppress( - "unused", - "NO_ACTUAL_FOR_EXPECT", - "PackageDirectoryMismatch", - "NON_FINAL_MEMBER_IN_FINAL_CLASS", - "VIRTUAL_MEMBER_HIDDEN" -) - -/** - * Bindings for JDK. - * - * All the sources are copied from OpenJDK. Copyright OpenJDK authors. - */ - -package java.io - -public expect interface Serializable \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/BotNetworkHandler.kt b/mirai-core/src/commonMain/kotlin/network/BotNetworkHandler.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/BotNetworkHandler.kt rename to mirai-core/src/commonMain/kotlin/network/BotNetworkHandler.kt index c4cc3fb52..0f9b6ba7a 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/BotNetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/network/BotNetworkHandler.kt @@ -9,7 +9,7 @@ @file:Suppress("EXPERIMENTAL_API_USAGE") -package net.mamoe.mirai.qqandroid.network +package net.mamoe.mirai.internal.network import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CompletableJob diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Packet.kt b/mirai-core/src/commonMain/kotlin/network/Packet.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Packet.kt rename to mirai-core/src/commonMain/kotlin/network/Packet.kt index ce6a12693..e994dc53e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Packet.kt +++ b/mirai-core/src/commonMain/kotlin/network/Packet.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network +package net.mamoe.mirai.internal.network /* diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt b/mirai-core/src/commonMain/kotlin/network/QQAndroidBotNetworkHandler.kt similarity index 95% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt rename to mirai-core/src/commonMain/kotlin/network/QQAndroidBotNetworkHandler.kt index 46263e461..c5e5ffbea 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/network/QQAndroidBotNetworkHandler.kt @@ -9,7 +9,7 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -package net.mamoe.mirai.qqandroid.network +package net.mamoe.mirai.internal.network import kotlinx.atomicfu.AtomicRef import kotlinx.atomicfu.atomic @@ -23,27 +23,27 @@ import net.mamoe.mirai.event.* import net.mamoe.mirai.event.events.BotOfflineEvent import net.mamoe.mirai.event.events.BotOnlineEvent import net.mamoe.mirai.event.events.BotReloginEvent +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.contact.* +import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopNum +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgSvc +import net.mamoe.mirai.internal.network.protocol.packet.* +import net.mamoe.mirai.internal.network.protocol.packet.KnownPacketFactories.PacketFactoryIllegalState10008Exception +import net.mamoe.mirai.internal.network.protocol.packet.chat.GroupInfoImpl +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.MessageSvcPbGetMsg +import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList +import net.mamoe.mirai.internal.network.protocol.packet.login.ConfigPushSvc +import net.mamoe.mirai.internal.network.protocol.packet.login.Heartbeat +import net.mamoe.mirai.internal.network.protocol.packet.login.StatSvc +import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin +import net.mamoe.mirai.internal.utils.* +import net.mamoe.mirai.internal.utils.io.readPacketExact +import net.mamoe.mirai.internal.utils.io.useBytes import net.mamoe.mirai.message.MessageEvent import net.mamoe.mirai.network.ForceOfflineException import net.mamoe.mirai.network.RetryLaterException import net.mamoe.mirai.network.UnsupportedSMSLoginException import net.mamoe.mirai.network.WrongPasswordException -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.contact.* -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.StTroopNum -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.* -import net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories.PacketFactoryIllegalState10008Exception -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.MessageSvcPbGetMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.ConfigPushSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.Heartbeat -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.WtLogin -import net.mamoe.mirai.qqandroid.utils.* -import net.mamoe.mirai.qqandroid.utils.io.readPacketExact -import net.mamoe.mirai.qqandroid.utils.io.useBytes import net.mamoe.mirai.utils.* import kotlin.coroutines.CoroutineContext import kotlin.jvm.JvmField diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt b/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt similarity index 95% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt rename to mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt index 4d53d7606..acb2c5a13 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt +++ b/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt @@ -9,25 +9,25 @@ @file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") -package net.mamoe.mirai.qqandroid.network +package net.mamoe.mirai.internal.network import kotlinx.atomicfu.AtomicBoolean import kotlinx.atomicfu.AtomicInt import kotlinx.atomicfu.atomic import kotlinx.io.core.* import net.mamoe.mirai.data.OnlineStatus +import net.mamoe.mirai.internal.BotAccount +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.protocol.SyncingCacheList +import net.mamoe.mirai.internal.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.network.protocol.packet.PacketLogger +import net.mamoe.mirai.internal.network.protocol.packet.Tlv +import net.mamoe.mirai.internal.utils.* +import net.mamoe.mirai.internal.utils.cryptor.ECDH +import net.mamoe.mirai.internal.utils.cryptor.TEA import net.mamoe.mirai.network.LoginFailedException import net.mamoe.mirai.network.NoServerAvailableException -import net.mamoe.mirai.qqandroid.BotAccount -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.protocol.SyncingCacheList -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketLogger -import net.mamoe.mirai.qqandroid.network.protocol.packet.Tlv -import net.mamoe.mirai.qqandroid.utils.* -import net.mamoe.mirai.qqandroid.utils.cryptor.ECDH -import net.mamoe.mirai.qqandroid.utils.cryptor.TEA import net.mamoe.mirai.utils.* import kotlin.jvm.Volatile import kotlin.random.Random @@ -39,7 +39,7 @@ internal val DeviceInfo.guid: ByteArray get() = generateGuid(androidId, macAddre */ @Suppress("RemoveRedundantQualifierName") // bug private fun generateGuid(androidId: ByteArray, macAddress: ByteArray): ByteArray = - net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils.md5(androidId + macAddress) + net.mamoe.mirai.internal.utils.MiraiPlatformUtils.md5(androidId + macAddress) /** * 生成长度为 [length], 元素为随机 `0..255` 的 [ByteArray] @@ -308,7 +308,7 @@ internal open class QQAndroidClient( @Suppress("RemoveRedundantQualifierName") // bug internal fun generateTgtgtKey(guid: ByteArray): ByteArray = - net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils.md5(getRandomByteArray(16) + guid) + net.mamoe.mirai.internal.utils.MiraiPlatformUtils.md5(getRandomByteArray(16) + guid) internal class ReserveUinInfo( diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Ticket.kt b/mirai-core/src/commonMain/kotlin/network/Ticket.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Ticket.kt rename to mirai-core/src/commonMain/kotlin/network/Ticket.kt index 1aaa550d3..be06d29c1 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Ticket.kt +++ b/mirai-core/src/commonMain/kotlin/network/Ticket.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network +package net.mamoe.mirai.internal.network internal class Ticket( val id: Int, diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt b/mirai-core/src/commonMain/kotlin/network/highway/HighwayHelper.kt similarity index 95% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt rename to mirai-core/src/commonMain/kotlin/network/highway/HighwayHelper.kt index e13737f94..ced1b329f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt +++ b/mirai-core/src/commonMain/kotlin/network/highway/HighwayHelper.kt @@ -9,7 +9,7 @@ @file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") -package net.mamoe.mirai.qqandroid.network.highway +package net.mamoe.mirai.internal.network.highway import io.ktor.client.* import io.ktor.client.request.* @@ -23,12 +23,12 @@ import kotlinx.coroutines.isActive import kotlinx.coroutines.withTimeoutOrNull import kotlinx.io.core.discardExact import kotlinx.io.core.use -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead -import net.mamoe.mirai.qqandroid.utils.* -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.withUse +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.CSDataHighwayHead +import net.mamoe.mirai.internal.utils.* +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.withUse import net.mamoe.mirai.utils.internal.ReusableInput import net.mamoe.mirai.utils.verbose import kotlin.coroutines.EmptyCoroutineContext diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt b/mirai-core/src/commonMain/kotlin/network/highway/highway.kt similarity index 88% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt rename to mirai-core/src/commonMain/kotlin/network/highway/highway.kt index cece26549..bd7a98e5e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt +++ b/mirai-core/src/commonMain/kotlin/network/highway/highway.kt @@ -9,17 +9,17 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -package net.mamoe.mirai.qqandroid.network.highway +package net.mamoe.mirai.internal.network.highway import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.buildPacket import kotlinx.io.core.writeFully -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.ByteArrayPool -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.CSDataHighwayHead +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.ByteArrayPool +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray import net.mamoe.mirai.utils.internal.ChunkedFlowSession import net.mamoe.mirai.utils.internal.ChunkedInput import net.mamoe.mirai.utils.internal.ReusableInput diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/LoginType.kt b/mirai-core/src/commonMain/kotlin/network/protocol/LoginType.kt similarity index 93% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/LoginType.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/LoginType.kt index 337fb9318..f7beda74d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/LoginType.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/LoginType.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol +package net.mamoe.mirai.internal.network.protocol internal inline class LoginType( val value: Int diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/SyncingCacheList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/SyncingCacheList.kt new file mode 100644 index 000000000..366a629c8 --- /dev/null +++ b/mirai-core/src/commonMain/kotlin/network/protocol/SyncingCacheList.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2019-2020 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ +package net.mamoe.mirai.internal.network.protocol + +import net.mamoe.mirai.internal.utils.LinkedList +import kotlin.jvm.Synchronized + +internal class SyncingCacheList(private val size: Int = 50) { + private val packetIdList = LinkedList() + + @Synchronized // faster than suspending Mutex + fun addCache(element: E): Boolean { + if (packetIdList.contains(element)) return false // duplicate + packetIdList.addLast(element) + if (packetIdList.size >= size) packetIdList.removeFirst() + return true + } +} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/ConfigPush.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/ConfigPush.kt index 6f43566e3..e68276f81 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/ConfigPush.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/FriendList.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendList.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/FriendList.kt index 3f493efdc..d556cd2ac 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/FriendList.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/GroupMngReq.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/GroupMngReq.kt similarity index 90% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/GroupMngReq.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/GroupMngReq.kt index 5fd921d74..9c61b603b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/GroupMngReq.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/GroupMngReq.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/MsgType0x210.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/MsgType0x210.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/MsgType0x210.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/MsgType0x210.kt index 63960a5cb..fc0f76193 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/MsgType0x210.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/MsgType0x210.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/OnlinePushPack.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/OnlinePushPack.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/OnlinePushPack.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/OnlinePushPack.kt index 4e0e6bfd6..7ea01f2b5 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/OnlinePushPack.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/OnlinePushPack.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField internal class OnlinePushPack { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/PushNotifyPack.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/PushNotifyPack.kt index 8ae5e7725..c6b9da922 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/PushNotifyPack.kt @@ -1,10 +1,10 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Suppress("ArrayInDataClass") diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestMSFForceOffline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestMSFForceOffline.kt similarity index 80% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestMSFForceOffline.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestMSFForceOffline.kt index 763e37c49..34f6dd9da 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestMSFForceOffline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestMSFForceOffline.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPacket.kt similarity index 83% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPacket.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPacket.kt index 5213de074..e1b57c435 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPacket.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField private val EMPTY_MAP = mapOf() diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPushForceOffline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPushForceOffline.kt similarity index 64% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPushForceOffline.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPushForceOffline.kt index 41becb63a..1ed8759a0 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/RequestPushForceOffline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPushForceOffline.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/SvcReqRegister.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/SvcReqRegister.kt similarity index 92% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/SvcReqRegister.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/SvcReqRegister.kt index cbfd9362c..f5cc87441 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/SvcReqRegister.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/SvcReqRegister.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/TroopList.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/jce/TroopList.kt index 5eb587bab..53400b573 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/TroopList.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.jce +package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x352.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x352.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x352.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x352.kt index 285c8f854..e8c969828 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x352.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x352.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x388.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x388.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt index 8174dd523..6ad0d6e68 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x388.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x857.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x857.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x857.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x857.kt index a092966d1..7b000abd4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x857.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x857.kt @@ -1,13 +1,13 @@ @file:Suppress("SpellCheckingInspection") -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoIntegerType import kotlinx.serialization.protobuf.ProtoNumber import kotlinx.serialization.protobuf.ProtoType -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class GroupOpenSysMsg : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x858.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x858.kt similarity index 95% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x858.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x858.kt index 87b8fe022..9e544c4ac 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Cmd0x858.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x858.kt @@ -1,13 +1,13 @@ @file:Suppress("SpellCheckingInspection") -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoIntegerType import kotlinx.serialization.protobuf.ProtoNumber import kotlinx.serialization.protobuf.ProtoType -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Define.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Define.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Define.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Define.kt index 0f65443f2..69b3b9d00 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Define.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Define.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class Common : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/FriendListCommon.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/FriendListCommon.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/FriendListCommon.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/FriendListCommon.kt index 42ba5954d..480568c01 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/FriendListCommon.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/FriendListCommon.kt @@ -1,11 +1,11 @@ @file:Suppress("SpellCheckingInspection") -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable @@ -68,6 +68,6 @@ internal class Vec0xd6b : ProtoBuf { internal class MutualMarkData( @ProtoNumber(1) @JvmField val frdUin: Long = 0L, @ProtoNumber(2) @JvmField val result: Int = 0 - // @SerialId(11) @JvmField val mutualmarkInfo: List? = null + // @SerialId(11) @JvmField val mutualmarkInfo: List? = null ) : ProtoBuf } \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Group.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Group.kt similarity index 91% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Group.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Group.kt index 5e1affba7..d054d85fb 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Group.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Group.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Highway.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Highway.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Highway.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Highway.kt index 2e0b1802d..bf1c168b2 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Highway.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Highway.kt @@ -1,11 +1,11 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoIntegerType import kotlinx.serialization.protobuf.ProtoNumber import kotlinx.serialization.protobuf.ProtoType -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/HummerCommelem.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/HummerCommelem.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/HummerCommelem.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/HummerCommelem.kt index 94f4e73ef..885c1b46f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/HummerCommelem.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/HummerCommelem.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class HummerCommelem : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/ImageRequest.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImageRequest.kt similarity index 92% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/ImageRequest.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImageRequest.kt index 5bde38c11..5d3532674 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/ImageRequest.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImageRequest.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.ProtoBuf import net.mamoe.mirai.utils.currentTimeSeconds import kotlin.jvm.JvmField diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/LongMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/LongMsg.kt similarity index 93% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/LongMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/LongMsg.kt index 16cc90192..2d68e9814 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/LongMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/LongMsg.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class LongMsg : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Msg.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Msg.kt index c3b8b732f..35ff35b4f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Msg.kt @@ -1,12 +1,12 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoIntegerType import kotlinx.serialization.protobuf.ProtoNumber import kotlinx.serialization.protobuf.ProtoType -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgCommon.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgCommon.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgCommon.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgCommon.kt index cb83908af..422add782 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgCommon.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgCommon.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField /** diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgRevokeUserDef.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgRevokeUserDef.kt similarity index 90% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgRevokeUserDef.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgRevokeUserDef.kt index 85733e881..354f52b2c 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgRevokeUserDef.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgRevokeUserDef.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class MsgRevokeUserDef : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgSvc.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgSvc.kt index f357e0af6..c32202fb7 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgSvc.kt @@ -1,10 +1,10 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgTransmit.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgTransmit.kt similarity index 79% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgTransmit.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgTransmit.kt index f70500332..67a94e8bc 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgTransmit.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgTransmit.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class MsgTransmit : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MultiMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MultiMsg.kt similarity index 95% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MultiMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MultiMsg.kt index c85829b3b..428a9385a 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MultiMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MultiMsg.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OIDB.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OIDB.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OIDB.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OIDB.kt index ad51169fb..6a74d4d1f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OIDB.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OIDB.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Oidb0x769.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Oidb0x769.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Oidb0x769.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Oidb0x769.kt index 4df1a17d9..936940226 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Oidb0x769.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Oidb0x769.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class Oidb0x769 { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OnlinePush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OnlinePush.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OnlinePush.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OnlinePush.kt index b22ac70ac..018c0a006 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OnlinePush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OnlinePush.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/PbReserve.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/PbReserve.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/PbReserve.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/PbReserve.kt index 146366bfd..a30a1fd87 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/PbReserve.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/PbReserve.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class Generalflags : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/StatSvcGetOnline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StatSvcGetOnline.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/StatSvcGetOnline.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StatSvcGetOnline.kt index f5f113f74..7d83d0a35 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/StatSvcGetOnline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StatSvcGetOnline.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class StatSvcGetOnline { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/StructMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StructMsg.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/StructMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StructMsg.kt index 43de46657..78be7d4a0 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/StructMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StructMsg.kt @@ -1,9 +1,9 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField internal class QPayReminderMsg : ProtoBuf { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/SyncCookie.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/SyncCookie.kt similarity index 93% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/SyncCookie.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/SyncCookie.kt index 917c5d919..832451894 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/SyncCookie.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/SyncCookie.kt @@ -1,8 +1,8 @@ -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField import kotlin.math.absoluteValue import kotlin.random.Random diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/msgType0x210.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/data/proto/msgType0x210.kt index a96ed5b48..dd0d64307 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/msgType0x210.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/msgType0x210.kt @@ -1,13 +1,13 @@ @file:Suppress("unused", "SpellCheckingInspection") -package net.mamoe.mirai.qqandroid.network.protocol.data.proto +package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoIntegerType import kotlinx.serialization.protobuf.ProtoNumber import kotlinx.serialization.protobuf.ProtoType -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.utils.io.ProtoBuf import kotlin.jvm.JvmField @Serializable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt similarity index 90% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt index 2d3d26203..24d0f58ab 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt @@ -7,17 +7,17 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet +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 net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.utils.cryptor.ECDH -import net.mamoe.mirai.qqandroid.utils.cryptor.ECDHKeyPair -import net.mamoe.mirai.qqandroid.utils.io.encryptAndWrite -import net.mamoe.mirai.qqandroid.utils.io.writeShortLVByteArray +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.utils.cryptor.ECDH +import net.mamoe.mirai.internal.utils.cryptor.ECDHKeyPair +import net.mamoe.mirai.internal.utils.io.encryptAndWrite +import net.mamoe.mirai.internal.utils.io.writeShortLVByteArray internal interface EncryptMethod { val id: Int diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacketAndroid.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacketAndroid.kt index c77d83880..772ab4ed7 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacketAndroid.kt @@ -7,17 +7,17 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet +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 net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.utils.io.encryptAndWrite -import net.mamoe.mirai.qqandroid.utils.io.writeHex -import net.mamoe.mirai.qqandroid.utils.io.writeIntLVPacket +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.utils.io.encryptAndWrite +import net.mamoe.mirai.internal.utils.io.writeHex +import net.mamoe.mirai.internal.utils.io.writeIntLVPacket internal class OutgoingPacket constructor( name: String?, diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt similarity index 91% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt index 25333a7d0..d6bbcf4e9 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt @@ -7,31 +7,31 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet +package net.mamoe.mirai.internal.network.protocol.packet import kotlinx.io.core.* import net.mamoe.mirai.event.Event -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.* -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image.ImgStore -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image.LongConn -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive.* -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.voice.PttStore -import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList -import net.mamoe.mirai.qqandroid.network.protocol.packet.list.ProfileService -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.ConfigPushSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.Heartbeat -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.login.WtLogin -import net.mamoe.mirai.qqandroid.network.readUShortLVByteArray -import net.mamoe.mirai.qqandroid.utils.* -import net.mamoe.mirai.qqandroid.utils.cryptor.TEA -import net.mamoe.mirai.qqandroid.utils.cryptor.adjustToPublicKey -import net.mamoe.mirai.qqandroid.utils.io.readPacketExact -import net.mamoe.mirai.qqandroid.utils.io.readString -import net.mamoe.mirai.qqandroid.utils.io.useBytes -import net.mamoe.mirai.qqandroid.utils.io.withUse +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.protocol.packet.chat.* +import net.mamoe.mirai.internal.network.protocol.packet.chat.image.ImgStore +import net.mamoe.mirai.internal.network.protocol.packet.chat.image.LongConn +import net.mamoe.mirai.internal.network.protocol.packet.chat.receive.* +import net.mamoe.mirai.internal.network.protocol.packet.chat.voice.PttStore +import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList +import net.mamoe.mirai.internal.network.protocol.packet.list.ProfileService +import net.mamoe.mirai.internal.network.protocol.packet.login.ConfigPushSvc +import net.mamoe.mirai.internal.network.protocol.packet.login.Heartbeat +import net.mamoe.mirai.internal.network.protocol.packet.login.StatSvc +import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin +import net.mamoe.mirai.internal.network.readUShortLVByteArray +import net.mamoe.mirai.internal.utils.* +import net.mamoe.mirai.internal.utils.cryptor.TEA +import net.mamoe.mirai.internal.utils.cryptor.adjustToPublicKey +import net.mamoe.mirai.internal.utils.io.readPacketExact +import net.mamoe.mirai.internal.utils.io.readString +import net.mamoe.mirai.internal.utils.io.useBytes +import net.mamoe.mirai.internal.utils.io.withUse import net.mamoe.mirai.utils.* import kotlin.jvm.JvmName import kotlin.jvm.JvmOverloads diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt index 39ce8370c..93bac6fa3 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt @@ -9,17 +9,17 @@ @file:Suppress("NOTHING_TO_INLINE") -package net.mamoe.mirai.qqandroid.network.protocol.packet +package net.mamoe.mirai.internal.network.protocol.packet import kotlinx.io.core.BytePacketBuilder import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.toByteArray import kotlinx.io.core.writeFully -import net.mamoe.mirai.qqandroid.network.protocol.LoginType -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils.NetworkType -import net.mamoe.mirai.qqandroid.utils.io.* -import net.mamoe.mirai.qqandroid.utils.toByteArray +import net.mamoe.mirai.internal.network.protocol.LoginType +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.NetworkType +import net.mamoe.mirai.internal.utils.io.* +import net.mamoe.mirai.internal.utils.toByteArray import net.mamoe.mirai.utils.currentTimeMillis import kotlin.random.Random diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/ChatType.kt similarity index 91% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/ChatType.kt index e5ae71c56..80f60100f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/ChatType.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat +package net.mamoe.mirai.internal.network.protocol.packet.chat internal enum class ChatType(val internalID: Int) { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/MultiMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt similarity index 81% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/MultiMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt index 8133fde99..ae8b21fad 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/MultiMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt @@ -9,28 +9,28 @@ @file:Suppress("EXPERIMENTAL_API_USAGE") -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat +package net.mamoe.mirai.internal.network.protocol.packet.chat import kotlinx.io.core.ByteReadPacket +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.message.toRichTextElems +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgTransmit +import net.mamoe.mirai.internal.network.protocol.data.proto.MultiMsg +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.PacketLogger +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils._miraiContentToString +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf import net.mamoe.mirai.message.data.ForwardMessage import net.mamoe.mirai.message.data.asMessageChain -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.message.toRichTextElems -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgTransmit -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MultiMsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketLogger -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils._miraiContentToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf internal class MessageValidationData( val data: ByteArray, diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NewContact.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NewContact.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt index 4cb016810..ecdb29218 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NewContact.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt @@ -9,7 +9,7 @@ @file:Suppress("INVISIBLE_MEMBER") -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat +package net.mamoe.mirai.internal.network.protocol.packet.chat import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.readBytes @@ -18,16 +18,16 @@ import net.mamoe.mirai.event.events.BotLeaveEvent import net.mamoe.mirai.event.events.MemberJoinRequestEvent import net.mamoe.mirai.event.events.NewFriendRequestEvent import net.mamoe.mirai.getGroupOrNull -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.message.contextualBugReportException -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Structmsg -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils._miraiContentToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.loadAs -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.message.contextualBugReportException +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.Structmsg +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils._miraiContentToString +import net.mamoe.mirai.internal.utils.io.serialization.loadAs +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf internal class NewContact { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NudgePacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt similarity index 74% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NudgePacket.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt index a4c602a7a..363ae5938 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NudgePacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt @@ -7,21 +7,21 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat +package net.mamoe.mirai.internal.network.protocol.packet.chat import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.readBytes -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Cmd0xed3 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.OidbSso -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.loadAs -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0xed3 +import net.mamoe.mirai.internal.network.protocol.data.proto.OidbSso +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.loadAs +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf internal object NudgePacket : OutgoingPacketFactory("OidbSvc.0xed3") { override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/PbMessageSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt similarity index 88% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/PbMessageSvc.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt index 8795efdab..b19d335ae 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/PbMessageSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt @@ -9,21 +9,21 @@ @file:Suppress("EXPERIMENTAL_API_USAGE") -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat +package net.mamoe.mirai.internal.network.protocol.packet.chat import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgRevokeUserDef -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.hexToBytes -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgRevokeUserDef +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgSvc +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.hexToBytes +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf internal class PbMessageSvc { object PbMsgWithDraw : OutgoingPacketFactory( diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt similarity index 95% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt index c2d75eaf2..31f9a463b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat +package net.mamoe.mirai.internal.network.protocol.packet.chat import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.buildPacket @@ -15,18 +15,18 @@ import kotlinx.io.core.readBytes import kotlinx.io.core.toByteArray import net.mamoe.mirai.LowLevelAPI import net.mamoe.mirai.contact.Member -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.ModifyGroupCardReq -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.StTroopNum -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.stUinInfo -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.* -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.* +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.jce.ModifyGroupCardReq +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPacket +import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopNum +import net.mamoe.mirai.internal.network.protocol.data.jce.stUinInfo +import net.mamoe.mirai.internal.network.protocol.data.proto.* +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.* import net.mamoe.mirai.utils.daysToSeconds import net.mamoe.mirai.data.GroupInfo as MiraiGroupInfo diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImgStore.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt similarity index 85% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImgStore.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt index c62b7c480..19a0f534d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImgStore.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt @@ -7,19 +7,19 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image +package net.mamoe.mirai.internal.network.protocol.packet.chat.image import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Cmd0x388 -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.toLongUnsigned -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x388 +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.network.protocol.packet.chat.toLongUnsigned +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf import kotlin.random.Random import kotlin.random.nextInt diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/LongConn.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt similarity index 81% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/LongConn.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt index 4e49557e9..f6eb833e8 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/LongConn.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt @@ -7,19 +7,19 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image +package net.mamoe.mirai.internal.network.protocol.packet.chat.image import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Cmd0x352 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.GetImgUrlReq -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x352 +import net.mamoe.mirai.internal.network.protocol.data.proto.GetImgUrlReq +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf internal class LongConn { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt similarity index 76% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt index a64edb515..316c9765b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt @@ -7,19 +7,19 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.toList import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgSvc +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf internal object MessageSvcPbDeleteMsg : OutgoingPacketFactory("MessageSvc.PbDeleteMsg") { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt similarity index 93% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt index 719a09dde..2d063ca50 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt @@ -9,7 +9,7 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive import kotlinx.atomicfu.loop import kotlinx.coroutines.CoroutineName @@ -28,30 +28,30 @@ import net.mamoe.mirai.event.Event import net.mamoe.mirai.event.events.BotJoinGroupEvent import net.mamoe.mirai.event.events.MemberJoinEvent import net.mamoe.mirai.getFriendOrNull +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.contact.GroupImpl +import net.mamoe.mirai.internal.contact.checkIsFriendImpl +import net.mamoe.mirai.internal.contact.checkIsMemberImpl +import net.mamoe.mirai.internal.message.toMessageChain +import net.mamoe.mirai.internal.network.MultiPacket +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgSvc +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.network.protocol.packet.chat.GroupInfoImpl +import net.mamoe.mirai.internal.network.protocol.packet.chat.NewContact +import net.mamoe.mirai.internal.network.protocol.packet.chat.toLongUnsigned +import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.utils.read +import net.mamoe.mirai.internal.utils.toInt +import net.mamoe.mirai.internal.utils.toUHexString import net.mamoe.mirai.message.FriendMessageEvent import net.mamoe.mirai.message.TempMessageEvent -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.contact.GroupImpl -import net.mamoe.mirai.qqandroid.contact.checkIsFriendImpl -import net.mamoe.mirai.qqandroid.contact.checkIsMemberImpl -import net.mamoe.mirai.qqandroid.message.toMessageChain -import net.mamoe.mirai.qqandroid.network.MultiPacket -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.NewContact -import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.toLongUnsigned -import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf -import net.mamoe.mirai.qqandroid.utils.read -import net.mamoe.mirai.qqandroid.utils.toInt -import net.mamoe.mirai.qqandroid.utils.toUHexString import net.mamoe.mirai.utils.debug import net.mamoe.mirai.utils.warning import kotlin.random.Random diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt similarity index 87% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt index 0dda51956..45a5e68ec 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt @@ -7,34 +7,34 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive 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 +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.contact.GroupImpl +import net.mamoe.mirai.internal.message.MessageSourceToFriendImpl +import net.mamoe.mirai.internal.message.MessageSourceToGroupImpl +import net.mamoe.mirai.internal.message.MessageSourceToTempImpl +import net.mamoe.mirai.internal.message.toRichTextElems +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgCtrl +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgSvc +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.PttMessage import net.mamoe.mirai.message.data.firstOrNull -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.contact.GroupImpl -import net.mamoe.mirai.qqandroid.message.MessageSourceToFriendImpl -import net.mamoe.mirai.qqandroid.message.MessageSourceToGroupImpl -import net.mamoe.mirai.qqandroid.message.MessageSourceToTempImpl -import net.mamoe.mirai.qqandroid.message.toRichTextElems -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgCtrl -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf import net.mamoe.mirai.utils.currentTimeSeconds import kotlin.contracts.InvocationKind import kotlin.contracts.contract diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt similarity index 73% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt index f8d663c49..120c311a8 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt @@ -7,14 +7,14 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive import kotlinx.io.core.ByteReadPacket import net.mamoe.mirai.event.events.BotOfflineEvent -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushForceOffline -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.utils.io.serialization.readUniPacket +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPushForceOffline +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.utils.io.serialization.readUniPacket /** diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt similarity index 75% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt index aba9e662a..479920c2c 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt @@ -7,17 +7,17 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive import kotlinx.atomicfu.loop import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.discardExact -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushNotify -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc -import net.mamoe.mirai.qqandroid.network.protocol.packet.IncomingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.readUniPacket +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPushNotify +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgSvc +import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.utils.io.serialization.readUniPacket /** diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt similarity index 88% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt index c86400d4e..f47ff8393 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt @@ -9,7 +9,7 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive import kotlinx.io.core.ByteReadPacket import net.mamoe.mirai.contact.MemberPermission @@ -19,20 +19,20 @@ import net.mamoe.mirai.event.Event import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.MemberCardChangeEvent import net.mamoe.mirai.getGroupOrNull +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.contact.GroupImpl +import net.mamoe.mirai.internal.contact.MemberImpl +import net.mamoe.mirai.internal.message.toMessageChain +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody +import net.mamoe.mirai.internal.network.protocol.data.proto.MsgOnlinePush +import net.mamoe.mirai.internal.network.protocol.data.proto.Oidb0x8fc +import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory +import net.mamoe.mirai.internal.utils._miraiContentToString +import net.mamoe.mirai.internal.utils.encodeToString +import net.mamoe.mirai.internal.utils.io.serialization.loadAs +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf import net.mamoe.mirai.message.GroupMessageEvent -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.contact.GroupImpl -import net.mamoe.mirai.qqandroid.contact.MemberImpl -import net.mamoe.mirai.qqandroid.message.toMessageChain -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgOnlinePush -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Oidb0x8fc -import net.mamoe.mirai.qqandroid.network.protocol.packet.IncomingPacketFactory -import net.mamoe.mirai.qqandroid.utils._miraiContentToString -import net.mamoe.mirai.qqandroid.utils.encodeToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.loadAs -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf import net.mamoe.mirai.utils.warning /** diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt similarity index 92% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt index ffc1de153..809a01592 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt @@ -10,7 +10,7 @@ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @file:OptIn(JavaFriendlyAPI::class) -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive import kotlinx.coroutines.CancellationException import kotlinx.coroutines.cancel @@ -22,21 +22,21 @@ import net.mamoe.mirai.JavaFriendlyAPI import net.mamoe.mirai.contact.MemberPermission import net.mamoe.mirai.data.MemberInfo import net.mamoe.mirai.event.events.* -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.contact.GroupImpl -import net.mamoe.mirai.qqandroid.contact.MemberImpl -import net.mamoe.mirai.qqandroid.contact.checkIsMemberImpl -import net.mamoe.mirai.qqandroid.message.contextualBugReportException -import net.mamoe.mirai.qqandroid.network.MultiPacketByIterable -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.OnlinePushTrans -import net.mamoe.mirai.qqandroid.network.protocol.packet.IncomingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildResponseUniPacket -import net.mamoe.mirai.qqandroid.utils._miraiContentToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.read +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.contact.GroupImpl +import net.mamoe.mirai.internal.contact.MemberImpl +import net.mamoe.mirai.internal.contact.checkIsMemberImpl +import net.mamoe.mirai.internal.message.contextualBugReportException +import net.mamoe.mirai.internal.network.MultiPacketByIterable +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.OnlinePushTrans +import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.buildResponseUniPacket +import net.mamoe.mirai.internal.utils._miraiContentToString +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.read internal object OnlinePushPbPushTransMsg : diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt index e850ba189..8ed39980a 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt @@ -12,7 +12,7 @@ JavaFriendlyAPI::class ) -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive +package net.mamoe.mirai.internal.network.protocol.packet.chat.receive import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.discardExact @@ -27,31 +27,31 @@ import net.mamoe.mirai.data.FriendInfo import net.mamoe.mirai.event.events.* import net.mamoe.mirai.getFriendOrNull import net.mamoe.mirai.getGroupOrNull -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.contact.* -import net.mamoe.mirai.qqandroid.network.MultiPacketBySequence -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.MsgInfo -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.MsgType0x210 -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.OnlinePushPack -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0x115 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0x122 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0x27.SubMsgType0x27.* -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0x44.Submsgtype0x44 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Submsgtype0xb3 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.TroopTips0x857 -import net.mamoe.mirai.qqandroid.network.protocol.packet.IncomingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildResponseUniPacket -import net.mamoe.mirai.qqandroid.utils._miraiContentToString -import net.mamoe.mirai.qqandroid.utils.encodeToString -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.readString -import net.mamoe.mirai.qqandroid.utils.io.serialization.* -import net.mamoe.mirai.qqandroid.utils.read -import net.mamoe.mirai.qqandroid.utils.toUHexString +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.contact.* +import net.mamoe.mirai.internal.network.MultiPacketBySequence +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.jce.MsgInfo +import net.mamoe.mirai.internal.network.protocol.data.jce.MsgType0x210 +import net.mamoe.mirai.internal.network.protocol.data.jce.OnlinePushPack +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPacket +import net.mamoe.mirai.internal.network.protocol.data.proto.Submsgtype0x115 +import net.mamoe.mirai.internal.network.protocol.data.proto.Submsgtype0x122 +import net.mamoe.mirai.internal.network.protocol.data.proto.Submsgtype0x27.SubMsgType0x27.* +import net.mamoe.mirai.internal.network.protocol.data.proto.Submsgtype0x44.Submsgtype0x44 +import net.mamoe.mirai.internal.network.protocol.data.proto.Submsgtype0xb3 +import net.mamoe.mirai.internal.network.protocol.data.proto.TroopTips0x857 +import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.buildResponseUniPacket +import net.mamoe.mirai.internal.utils._miraiContentToString +import net.mamoe.mirai.internal.utils.encodeToString +import net.mamoe.mirai.internal.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.readString +import net.mamoe.mirai.internal.utils.io.serialization.* +import net.mamoe.mirai.internal.utils.read +import net.mamoe.mirai.internal.utils.toUHexString import net.mamoe.mirai.utils.currentTimeSeconds import net.mamoe.mirai.utils.debug diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/voice/PttStore.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt similarity index 87% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/voice/PttStore.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt index eab0e436a..4cf3a62f9 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/voice/PttStore.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt @@ -1,17 +1,17 @@ -package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.voice +package net.mamoe.mirai.internal.network.protocol.packet.chat.voice import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Cmd0x388 -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.encodeToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf +import net.mamoe.mirai.internal.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x388 +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.encodeToString +import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.writeProtoBuf internal class PttStore { object GroupPttUp : OutgoingPacketFactory("PttStore.GroupPttUp") { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendList.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt index c21c75fe3..ef519e527 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt @@ -7,22 +7,22 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.list +package net.mamoe.mirai.internal.network.protocol.packet.list import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.* -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Vec0xd50 -import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.jceRequestSBuffer -import net.mamoe.mirai.qqandroid.utils.io.serialization.readUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeJceStruct +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.jce.* +import net.mamoe.mirai.internal.network.protocol.data.proto.Vec0xd50 +import net.mamoe.mirai.internal.network.protocol.packet.EMPTY_BYTE_ARRAY +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.jceRequestSBuffer +import net.mamoe.mirai.internal.utils.io.serialization.readUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.toByteArray +import net.mamoe.mirai.internal.utils.io.serialization.writeJceStruct internal class FriendList { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/ProfileService.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt similarity index 66% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/ProfileService.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt index a1bad3585..2c8858ca2 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/ProfileService.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt @@ -7,22 +7,22 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.list +package net.mamoe.mirai.internal.network.protocol.packet.list import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.GroupMngReqJce -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.GroupMngRes -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.jceRequestSBuffer -import net.mamoe.mirai.qqandroid.utils.io.serialization.readUniPacket -import net.mamoe.mirai.qqandroid.utils.io.serialization.writeJceStruct -import net.mamoe.mirai.qqandroid.utils.toByteArray +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.data.jce.GroupMngReqJce +import net.mamoe.mirai.internal.network.protocol.data.jce.GroupMngRes +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.jceRequestSBuffer +import net.mamoe.mirai.internal.utils.io.serialization.readUniPacket +import net.mamoe.mirai.internal.utils.io.serialization.writeJceStruct +import net.mamoe.mirai.internal.utils.toByteArray internal class ProfileService { object GroupMngReq : OutgoingPacketFactory("ProfileService.GroupMngReq") { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/ConfigPushSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/ConfigPushSvc.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt index 7743d0f56..cc2473eb1 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/ConfigPushSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.login +package net.mamoe.mirai.internal.network.protocol.packet.login import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.use @@ -15,22 +15,22 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.Event -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.PushResp -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.IncomingPacketFactory -import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket -import net.mamoe.mirai.qqandroid.network.protocol.packet.buildResponseUniPacket -import net.mamoe.mirai.qqandroid.utils.ByteArrayPool -import net.mamoe.mirai.qqandroid.utils.hexToBytes -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.serialization.* -import net.mamoe.mirai.qqandroid.utils.io.withUse -import net.mamoe.mirai.qqandroid.utils.toReadPacket +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.protocol.data.jce.FileStoragePushFSSvcListFuckKotlin +import net.mamoe.mirai.internal.network.protocol.data.jce.PushResp +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPacket +import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory +import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket +import net.mamoe.mirai.internal.network.protocol.packet.buildResponseUniPacket +import net.mamoe.mirai.internal.utils.ByteArrayPool +import net.mamoe.mirai.internal.utils.hexToBytes +import net.mamoe.mirai.internal.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.serialization.* +import net.mamoe.mirai.internal.utils.io.withUse +import net.mamoe.mirai.internal.utils.toReadPacket import net.mamoe.mirai.utils.verbose -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.PushReq as PushReqJceStruct +import net.mamoe.mirai.internal.network.protocol.data.jce.PushReq as PushReqJceStruct internal class ConfigPushSvc { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Heartbeat.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt similarity index 79% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Heartbeat.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt index cff8ba106..d155f7b87 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Heartbeat.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt @@ -7,13 +7,13 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.login +package net.mamoe.mirai.internal.network.protocol.packet.login import kotlinx.io.core.ByteReadPacket -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.protocol.packet.* +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.protocol.packet.* internal class Heartbeat { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/StatSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/StatSvc.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt index 5df66dc25..4e045b184 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/StatSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt @@ -7,27 +7,27 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.login +package net.mamoe.mirai.internal.network.protocol.packet.login import kotlinx.io.core.ByteReadPacket import kotlinx.serialization.protobuf.ProtoBuf import net.mamoe.mirai.event.events.BotOfflineEvent -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.Packet -import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.qqandroid.network.guid -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestMSFForceOffline -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RspMSFForceOffline -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.SvcReqRegister -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.Oidb0x769 -import net.mamoe.mirai.qqandroid.network.protocol.data.proto.StatSvcGetOnline -import net.mamoe.mirai.qqandroid.network.protocol.packet.* -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils -import net.mamoe.mirai.qqandroid.utils.NetworkType -import net.mamoe.mirai.qqandroid.utils.encodeToString -import net.mamoe.mirai.qqandroid.utils.io.serialization.* -import net.mamoe.mirai.qqandroid.utils.toReadPacket +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.Packet +import net.mamoe.mirai.internal.network.QQAndroidClient +import net.mamoe.mirai.internal.network.guid +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestMSFForceOffline +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPacket +import net.mamoe.mirai.internal.network.protocol.data.jce.RspMSFForceOffline +import net.mamoe.mirai.internal.network.protocol.data.jce.SvcReqRegister +import net.mamoe.mirai.internal.network.protocol.data.proto.Oidb0x769 +import net.mamoe.mirai.internal.network.protocol.data.proto.StatSvcGetOnline +import net.mamoe.mirai.internal.network.protocol.packet.* +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.NetworkType +import net.mamoe.mirai.internal.utils.encodeToString +import net.mamoe.mirai.internal.utils.io.serialization.* +import net.mamoe.mirai.internal.utils.toReadPacket @Suppress("EnumEntryName", "unused") internal enum class RegPushReason { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt rename to mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt index 3d31b9e59..adaf4cf5e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt @@ -7,18 +7,18 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.network.protocol.packet.login +package net.mamoe.mirai.internal.network.protocol.packet.login import kotlinx.io.core.* -import net.mamoe.mirai.qqandroid.QQAndroidBot -import net.mamoe.mirai.qqandroid.network.* -import net.mamoe.mirai.qqandroid.network.protocol.LoginType -import net.mamoe.mirai.qqandroid.network.protocol.packet.* -import net.mamoe.mirai.qqandroid.utils.* -import net.mamoe.mirai.qqandroid.utils.cryptor.TEA -import net.mamoe.mirai.qqandroid.utils.guidFlag -import net.mamoe.mirai.qqandroid.utils.io.* +import net.mamoe.mirai.internal.QQAndroidBot +import net.mamoe.mirai.internal.network.* +import net.mamoe.mirai.internal.network.protocol.LoginType +import net.mamoe.mirai.internal.network.protocol.packet.* +import net.mamoe.mirai.internal.utils.* +import net.mamoe.mirai.internal.utils.cryptor.TEA +import net.mamoe.mirai.internal.utils.guidFlag +import net.mamoe.mirai.internal.utils.io.* import net.mamoe.mirai.utils.currentTimeSeconds import net.mamoe.mirai.utils.error diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/AtomicResizeCacheList.kt b/mirai-core/src/commonMain/kotlin/utils/AtomicResizeCacheList.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/AtomicResizeCacheList.kt rename to mirai-core/src/commonMain/kotlin/utils/AtomicResizeCacheList.kt index 888371f49..9deb0a6be 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/AtomicResizeCacheList.kt +++ b/mirai-core/src/commonMain/kotlin/utils/AtomicResizeCacheList.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.atomicfu.AtomicLong import kotlinx.atomicfu.atomic diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/ByteArrayPool.kt b/mirai-core/src/commonMain/kotlin/utils/ByteArrayPool.kt similarity index 93% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/ByteArrayPool.kt rename to mirai-core/src/commonMain/kotlin/utils/ByteArrayPool.kt index e6455f4d4..8b1b136b8 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/ByteArrayPool.kt +++ b/mirai-core/src/commonMain/kotlin/utils/ByteArrayPool.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.io.pool.ObjectPool diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/GuidSource.kt b/mirai-core/src/commonMain/kotlin/utils/GuidSource.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/GuidSource.kt rename to mirai-core/src/commonMain/kotlin/utils/GuidSource.kt index 9e268a2e6..3afd02b6d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/GuidSource.kt +++ b/mirai-core/src/commonMain/kotlin/utils/GuidSource.kt @@ -10,7 +10,7 @@ @file:JvmName("Utils") @file:JvmMultifileClass -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.common.kt b/mirai-core/src/commonMain/kotlin/utils/LinkedList.common.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.common.kt rename to mirai-core/src/commonMain/kotlin/utils/LinkedList.common.kt index fb869d01e..a7e069d2a 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/LinkedList.common.kt +++ b/mirai-core/src/commonMain/kotlin/utils/LinkedList.common.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils // We target JVM and Android only. internal expect class LinkedList() : List, Queue, Deque diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.common.kt b/mirai-core/src/commonMain/kotlin/utils/MiraiPlatformUtils.common.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.common.kt rename to mirai-core/src/commonMain/kotlin/utils/MiraiPlatformUtils.common.kt index 40634374a..7dcd6826d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.common.kt +++ b/mirai-core/src/commonMain/kotlin/utils/MiraiPlatformUtils.common.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import io.ktor.client.* diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/NetworkType.kt b/mirai-core/src/commonMain/kotlin/utils/NetworkType.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/NetworkType.kt rename to mirai-core/src/commonMain/kotlin/utils/NetworkType.kt index f8e39ee47..0e520fc8c 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/NetworkType.kt +++ b/mirai-core/src/commonMain/kotlin/utils/NetworkType.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils /** * 连接类型 diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformDatagramChannel.kt b/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformDatagramChannel.kt rename to mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt index 4348b2a07..a4704bbe8 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformDatagramChannel.kt +++ b/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.Closeable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt b/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt rename to mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt index 834e8ab73..b5d90a02b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt +++ b/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.Closeable diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/byteArrays.kt b/mirai-core/src/commonMain/kotlin/utils/byteArrays.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/byteArrays.kt rename to mirai-core/src/commonMain/kotlin/utils/byteArrays.kt index dc0586349..f0bdd7612 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/byteArrays.kt +++ b/mirai-core/src/commonMain/kotlin/utils/byteArrays.kt @@ -11,7 +11,7 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.io.charsets.Charset import kotlinx.io.charsets.Charsets diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/contentToString.kt b/mirai-core/src/commonMain/kotlin/utils/contentToString.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/contentToString.kt rename to mirai-core/src/commonMain/kotlin/utils/contentToString.kt index 7969eea49..bb1ad1c7d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/contentToString.kt +++ b/mirai-core/src/commonMain/kotlin/utils/contentToString.kt @@ -9,7 +9,7 @@ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "NO_REFLECTION_IN_CLASS_PATH") -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.serialization.Transient import net.mamoe.mirai.utils.DefaultLogger diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/conversion.kt b/mirai-core/src/commonMain/kotlin/utils/conversion.kt similarity index 99% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/conversion.kt rename to mirai-core/src/commonMain/kotlin/utils/conversion.kt index 57478676c..89467f4b4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/conversion.kt +++ b/mirai-core/src/commonMain/kotlin/utils/conversion.kt @@ -9,7 +9,7 @@ @file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "EXPERIMENTAL_API_USAGE", "unused") -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils /* * 类型转换 Utils. diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDH.kt b/mirai-core/src/commonMain/kotlin/utils/cryptor/ECDH.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDH.kt rename to mirai-core/src/commonMain/kotlin/utils/cryptor/ECDH.kt index 4927d1fb8..c4dc7eecd 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDH.kt +++ b/mirai-core/src/commonMain/kotlin/utils/cryptor/ECDH.kt @@ -7,9 +7,9 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.cryptor +package net.mamoe.mirai.internal.utils.cryptor -import net.mamoe.mirai.qqandroid.utils.chunkedHexToBytes +import net.mamoe.mirai.internal.utils.chunkedHexToBytes internal expect interface ECDHPrivateKey { fun getEncoded(): ByteArray diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/TEA.kt b/mirai-core/src/commonMain/kotlin/utils/cryptor/TEA.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/TEA.kt rename to mirai-core/src/commonMain/kotlin/utils/cryptor/TEA.kt index 3d0d3ae32..01d646599 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/TEA.kt +++ b/mirai-core/src/commonMain/kotlin/utils/cryptor/TEA.kt @@ -7,13 +7,13 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.cryptor +package net.mamoe.mirai.internal.utils.cryptor import kotlinx.io.core.ByteReadPacket import kotlinx.io.pool.useInstance -import net.mamoe.mirai.qqandroid.utils.ByteArrayPool -import net.mamoe.mirai.qqandroid.utils.toByteArray -import net.mamoe.mirai.qqandroid.utils.toUHexString +import net.mamoe.mirai.internal.utils.ByteArrayPool +import net.mamoe.mirai.internal.utils.toByteArray +import net.mamoe.mirai.internal.utils.toUHexString import kotlin.experimental.and import kotlin.experimental.xor import kotlin.jvm.JvmStatic diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/flags.kt b/mirai-core/src/commonMain/kotlin/utils/flags.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/flags.kt rename to mirai-core/src/commonMain/kotlin/utils/flags.kt index b8c9de84e..9802b1a59 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/flags.kt +++ b/mirai-core/src/commonMain/kotlin/utils/flags.kt @@ -10,7 +10,7 @@ @file:JvmName("Utils") @file:JvmMultifileClass -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/JceStruct.kt b/mirai-core/src/commonMain/kotlin/utils/io/JceStruct.kt similarity index 90% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/JceStruct.kt rename to mirai-core/src/commonMain/kotlin/utils/io/JceStruct.kt index f08ffa06f..88a4362d0 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/JceStruct.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/JceStruct.kt @@ -7,6 +7,6 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.io +package net.mamoe.mirai.internal.utils.io internal interface JceStruct \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/ProtoBuf.kt b/mirai-core/src/commonMain/kotlin/utils/io/ProtoBuf.kt similarity index 91% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/ProtoBuf.kt rename to mirai-core/src/commonMain/kotlin/utils/io/ProtoBuf.kt index b2be70da0..6a4f94561 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/ProtoBuf.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/ProtoBuf.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.io +package net.mamoe.mirai.internal.utils.io /** * 仅有标示作用 diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/input.kt b/mirai-core/src/commonMain/kotlin/utils/io/input.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/input.kt rename to mirai-core/src/commonMain/kotlin/utils/io/input.kt index f41e32151..c539ca818 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/input.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/input.kt @@ -11,14 +11,14 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.qqandroid.utils.io +package net.mamoe.mirai.internal.utils.io import kotlinx.io.charsets.Charset import kotlinx.io.charsets.Charsets import kotlinx.io.core.* -import net.mamoe.mirai.qqandroid.utils.ByteArrayPool -import net.mamoe.mirai.qqandroid.utils.toReadPacket -import net.mamoe.mirai.qqandroid.utils.toUHexString +import net.mamoe.mirai.internal.utils.ByteArrayPool +import net.mamoe.mirai.internal.utils.toReadPacket +import net.mamoe.mirai.internal.utils.toUHexString import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.jvm.JvmMultifileClass diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/output.kt b/mirai-core/src/commonMain/kotlin/utils/io/output.kt similarity index 94% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/output.kt rename to mirai-core/src/commonMain/kotlin/utils/io/output.kt index 9241893dd..ca8e07036 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/output.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/output.kt @@ -11,11 +11,11 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.qqandroid.utils.io +package net.mamoe.mirai.internal.utils.io import kotlinx.io.core.* -import net.mamoe.mirai.qqandroid.utils.coerceAtMostOrFail -import net.mamoe.mirai.qqandroid.utils.cryptor.TEA +import net.mamoe.mirai.internal.utils.coerceAtMostOrFail +import net.mamoe.mirai.internal.utils.cryptor.TEA import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/ProtoBufWithNullableSupport.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/ProtoBufWithNullableSupport.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt index e3d8ffa36..ef89b9a55 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/ProtoBufWithNullableSupport.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt @@ -7,7 +7,7 @@ @file:Suppress("DEPRECATION_ERROR") -package net.mamoe.mirai.qqandroid.utils.io.serialization +package net.mamoe.mirai.internal.utils.io.serialization import kotlinx.serialization.* import kotlinx.serialization.builtins.ByteArraySerializer @@ -24,8 +24,8 @@ import kotlinx.serialization.modules.SerializersModule import kotlinx.serialization.protobuf.ProtoBuf import kotlinx.serialization.protobuf.ProtoIntegerType import kotlinx.serialization.protobuf.ProtoType -import net.mamoe.mirai.qqandroid.utils.io.serialization.ProtoBufWithNullableSupport.Varint.encodeVarint -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.serialization.ProtoBufWithNullableSupport.Varint.encodeVarint +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId import java.io.ByteArrayOutputStream import java.nio.ByteBuffer import java.nio.ByteOrder diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/Tars.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/Tars.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt index d807aea97..2e13cd405 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/Tars.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt @@ -9,7 +9,7 @@ @file:Suppress("MemberVisibilityCanBePrivate", "unused") -package net.mamoe.mirai.qqandroid.utils.io.serialization.tars +package net.mamoe.mirai.internal.utils.io.serialization.tars import kotlinx.io.charsets.Charset import kotlinx.io.charsets.Charsets @@ -17,9 +17,9 @@ import kotlinx.io.core.* import kotlinx.serialization.* import kotlinx.serialization.modules.EmptySerializersModule import kotlinx.serialization.modules.SerializersModule -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.internal.TarsDecoder -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.internal.TarsInput -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.internal.TarsOld +import net.mamoe.mirai.internal.utils.io.serialization.tars.internal.TarsDecoder +import net.mamoe.mirai.internal.utils.io.serialization.tars.internal.TarsInput +import net.mamoe.mirai.internal.utils.io.serialization.tars.internal.TarsOld import kotlin.jvm.JvmStatic /** diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/TarsId.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/TarsId.kt similarity index 91% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/TarsId.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/TarsId.kt index c954a2d82..f8268aed1 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/TarsId.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/TarsId.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.io.serialization.tars +package net.mamoe.mirai.internal.utils.io.serialization.tars import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.SerialInfo diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsDecoder.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsDecoder.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt index 79b3c4a53..bdec63ab4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsDecoder.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt @@ -9,7 +9,7 @@ @file:Suppress("PrivatePropertyName") -package net.mamoe.mirai.qqandroid.utils.io.serialization.tars.internal +package net.mamoe.mirai.internal.utils.io.serialization.tars.internal import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.InternalSerializationApi @@ -18,8 +18,8 @@ import kotlinx.serialization.encoding.AbstractDecoder import kotlinx.serialization.encoding.CompositeDecoder import kotlinx.serialization.internal.TaggedDecoder import kotlinx.serialization.modules.SerializersModule -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsInput.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsInput.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt index ffd87070b..7317f5d90 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsInput.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt @@ -7,11 +7,11 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.io.serialization.tars.internal +package net.mamoe.mirai.internal.utils.io.serialization.tars.internal import kotlinx.io.charsets.Charset import kotlinx.io.core.* -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars /** diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsOld.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt similarity index 89% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsOld.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt index dabaf056c..337e8f57e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsOld.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.io.serialization.tars.internal +package net.mamoe.mirai.internal.utils.io.serialization.tars.internal import kotlinx.io.charsets.Charset import kotlinx.io.charsets.Charsets @@ -24,22 +24,22 @@ import kotlinx.serialization.internal.MapLikeSerializer import kotlinx.serialization.internal.TaggedEncoder import kotlinx.serialization.modules.EmptySerializersModule import kotlinx.serialization.modules.SerializersModule -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.BYTE -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.DOUBLE -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.FLOAT -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.INT -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.LIST -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.LONG -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.MAP -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.SHORT -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.SIMPLE_LIST -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.STRING1 -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.STRING4 -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.STRUCT_BEGIN -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.STRUCT_END -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.Tars_MAX_STRING_LENGTH -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars.Companion.ZERO_TYPE -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.TarsId +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.BYTE +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.DOUBLE +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.FLOAT +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.INT +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.LIST +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.LONG +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.MAP +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.SHORT +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.SIMPLE_LIST +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.STRING1 +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.STRING4 +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.STRUCT_BEGIN +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.STRUCT_END +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.Tars_MAX_STRING_LENGTH +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars.Companion.ZERO_TYPE +import net.mamoe.mirai.internal.utils.io.serialization.tars.TarsId @OptIn(ExperimentalSerializationApi::class) internal inline fun SerialDescriptor.findAnnotation(elementIndex: Int): A? { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsTag.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt similarity index 95% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsTag.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt index 17f2527ee..a5a7ff6f0 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/tars/internal/TarsTag.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt @@ -7,12 +7,12 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.io.serialization.tars.internal +package net.mamoe.mirai.internal.utils.io.serialization.tars.internal import kotlinx.io.core.Output import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.descriptors.SerialDescriptor -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars internal abstract class TarsTag { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/utils.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt similarity index 90% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/utils.kt rename to mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt index a9462735e..edf37132e 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/serialization/utils.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt @@ -10,20 +10,20 @@ @file:JvmName("SerializationUtils") @file:JvmMultifileClass -package net.mamoe.mirai.qqandroid.utils.io.serialization +package net.mamoe.mirai.internal.utils.io.serialization import kotlinx.io.core.* import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.descriptors.SerialDescriptor -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestDataVersion2 -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestDataVersion3 -import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket -import net.mamoe.mirai.qqandroid.utils.io.JceStruct -import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf -import net.mamoe.mirai.qqandroid.utils.io.readPacketExact -import net.mamoe.mirai.qqandroid.utils.io.serialization.tars.Tars -import net.mamoe.mirai.qqandroid.utils.read +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestDataVersion2 +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestDataVersion3 +import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPacket +import net.mamoe.mirai.internal.utils.io.JceStruct +import net.mamoe.mirai.internal.utils.io.ProtoBuf +import net.mamoe.mirai.internal.utils.io.readPacketExact +import net.mamoe.mirai.internal.utils.io.serialization.tars.Tars +import net.mamoe.mirai.internal.utils.read import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/numbers.kt b/mirai-core/src/commonMain/kotlin/utils/numbers.kt similarity index 96% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/numbers.kt rename to mirai-core/src/commonMain/kotlin/utils/numbers.kt index 18c81b5ab..d34bef4a4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/numbers.kt +++ b/mirai-core/src/commonMain/kotlin/utils/numbers.kt @@ -10,7 +10,7 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/tryNTimes.kt b/mirai-core/src/commonMain/kotlin/utils/tryNTimes.kt similarity index 97% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/tryNTimes.kt rename to mirai-core/src/commonMain/kotlin/utils/tryNTimes.kt index 772b73187..7fd6d05a2 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/tryNTimes.kt +++ b/mirai-core/src/commonMain/kotlin/utils/tryNTimes.kt @@ -12,7 +12,7 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt b/mirai-core/src/commonMain/kotlin/utils/type.kt similarity index 98% rename from mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt rename to mirai-core/src/commonMain/kotlin/utils/type.kt index 16cf73835..ef98579a7 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/type.kt +++ b/mirai-core/src/commonMain/kotlin/utils/type.kt @@ -10,7 +10,7 @@ @file:JvmName("Utils") @file:JvmMultifileClass -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import net.mamoe.mirai.message.data.* import net.mamoe.mirai.message.data.AtAll.display diff --git a/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid/utils/PlatformUtilsTest.kt b/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt similarity index 95% rename from mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid/utils/PlatformUtilsTest.kt rename to mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt index bf8daa258..8787af920 100644 --- a/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid/utils/PlatformUtilsTest.kt +++ b/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt @@ -6,8 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.io.core.toByteArray import kotlin.test.Test diff --git a/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid/utils/TypeConversionTest.kt b/mirai-core/src/commonTest/kotlin/TypeConversionTest.kt similarity index 96% rename from mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid/utils/TypeConversionTest.kt rename to mirai-core/src/commonTest/kotlin/TypeConversionTest.kt index 0e3e75805..2b383c996 100644 --- a/mirai-core-qqandroid/src/commonTest/kotlin/net.mamoe.mirai.qqandroid/utils/TypeConversionTest.kt +++ b/mirai-core/src/commonTest/kotlin/TypeConversionTest.kt @@ -6,8 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlin.test.Test import kotlin.test.assertEquals diff --git a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/utils/ExternalImageTest.kt b/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/utils/ExternalImageTest.kt deleted file mode 100644 index 04888bb88..000000000 --- a/mirai-core/src/commonTest/kotlin/net/mamoe/mirai/utils/ExternalImageTest.kt +++ /dev/null @@ -1,14 +0,0 @@ -package net.mamoe.mirai.utils - -import kotlin.test.Test -import kotlin.test.assertEquals - -internal class ExternalImageTest { - - @Test - fun testByteArrayGet() { - assertEquals("0F", byteArrayOf(0x0f)[0, 0]) - assertEquals("10", byteArrayOf(0x10)[0, 0]) - assertEquals("0FFE", byteArrayOf(0x0F, 0xFE.toByte())[0, 1]) - } -} \ No newline at end of file diff --git a/mirai-core-qqandroid/src/commonTest/kotlin/samples/CustomMessageSamples.kt b/mirai-core/src/commonTest/kotlin/samples/CustomMessageSamples.kt similarity index 100% rename from mirai-core-qqandroid/src/commonTest/kotlin/samples/CustomMessageSamples.kt rename to mirai-core/src/commonTest/kotlin/samples/CustomMessageSamples.kt diff --git a/mirai-core-qqandroid/src/commonTest/kotlin/test/printing.kt b/mirai-core/src/commonTest/kotlin/test/printing.kt similarity index 91% rename from mirai-core-qqandroid/src/commonTest/kotlin/test/printing.kt rename to mirai-core/src/commonTest/kotlin/test/printing.kt index efeef9bf3..63f3c05e0 100644 --- a/mirai-core-qqandroid/src/commonTest/kotlin/test/printing.kt +++ b/mirai-core/src/commonTest/kotlin/test/printing.kt @@ -16,9 +16,9 @@ import kotlinx.io.core.Input import kotlinx.io.core.readAvailable import kotlinx.io.core.use import kotlinx.io.pool.useInstance -import net.mamoe.mirai.qqandroid.utils.ByteArrayPool -import net.mamoe.mirai.qqandroid.utils.toReadPacket -import net.mamoe.mirai.qqandroid.utils.toUHexString +import net.mamoe.mirai.internal.utils.ByteArrayPool +import net.mamoe.mirai.internal.utils.toReadPacket +import net.mamoe.mirai.internal.utils.toUHexString import net.mamoe.mirai.utils.DefaultLogger import net.mamoe.mirai.utils.MiraiLoggerWithSwitch import net.mamoe.mirai.utils.withSwitch diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt b/mirai-core/src/jvmMain/kotlin/QQAndroid.kt similarity index 96% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt rename to mirai-core/src/jvmMain/kotlin/QQAndroid.kt index 8d6117362..d798e4d71 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt +++ b/mirai-core/src/jvmMain/kotlin/QQAndroid.kt @@ -6,14 +6,13 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - @file:Suppress("FunctionName", "OverridingDeprecatedMember") -package net.mamoe.mirai.qqandroid +package net.mamoe.mirai.internal import net.mamoe.mirai.Bot import net.mamoe.mirai.BotFactory -import net.mamoe.mirai.qqandroid.QQAndroid.Bot +import net.mamoe.mirai.internal.QQAndroid.Bot import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.Context diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.jvm.kt b/mirai-core/src/jvmMain/kotlin/QQAndroidBot.jvm.kt similarity index 95% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.jvm.kt rename to mirai-core/src/jvmMain/kotlin/QQAndroidBot.jvm.kt index c814c4713..2d2610f14 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.jvm.kt +++ b/mirai-core/src/jvmMain/kotlin/QQAndroidBot.jvm.kt @@ -6,8 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ - -package net.mamoe.mirai.qqandroid +package net.mamoe.mirai.internal import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.ContextImpl diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/Context.android.kt b/mirai-core/src/jvmMain/kotlin/utils/LinkedList.kt similarity index 71% rename from mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/Context.android.kt rename to mirai-core/src/jvmMain/kotlin/utils/LinkedList.kt index 3c0eb2e70..c0cc2637e 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/Context.android.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/LinkedList.kt @@ -6,7 +6,9 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ +package net.mamoe.mirai.internal.utils -package net.mamoe.mirai.utils +import java.util.LinkedList -actual typealias Context = android.content.Context \ No newline at end of file +@Suppress("ACTUAL_WITHOUT_EXPECT") +internal actual typealias LinkedList = LinkedList \ No newline at end of file diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.kt b/mirai-core/src/jvmMain/kotlin/utils/MiraiPlatformUtils.kt similarity index 98% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.kt rename to mirai-core/src/jvmMain/kotlin/utils/MiraiPlatformUtils.kt index 96cc7f423..cb48a01e7 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/MiraiPlatformUtils.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/MiraiPlatformUtils.kt @@ -9,7 +9,7 @@ @file:Suppress("NOTHING_TO_INLINE") -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import io.ktor.client.* import io.ktor.client.engine.cio.* diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocket.kt similarity index 98% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt rename to mirai-core/src/jvmMain/kotlin/utils/PlatformSocket.kt index 78a9ca73f..7b0a82250 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocket.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocket.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.suspendCancellableCoroutine @@ -112,7 +112,7 @@ internal actual typealias SocketException = SocketException * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import io.ktor.network.selector.ActorSelectorManager import io.ktor.network.sockets.* @@ -126,7 +126,7 @@ import kotlinx.io.core.Closeable import kotlinx.io.core.ExperimentalIoApi import kotlinx.io.core.buildPacket import kotlinx.io.errors.IOException -import net.mamoe.mirai.qqandroid.utils.io.useBytes +import useBytes import java.net.InetSocketAddress import java.net.SocketException import kotlin.coroutines.CoroutineContext diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocketJvm.kt b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocketJvm.kt similarity index 98% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocketJvm.kt rename to mirai-core/src/jvmMain/kotlin/utils/PlatformSocketJvm.kt index a6a8e5404..fc51d9817 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/PlatformSocketJvm.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocketJvm.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/addSuppressedMirai.kt b/mirai-core/src/jvmMain/kotlin/utils/addSuppressedMirai.kt similarity index 93% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/addSuppressedMirai.kt rename to mirai-core/src/jvmMain/kotlin/utils/addSuppressedMirai.kt index e68c3e23d..c21ab4440 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/addSuppressedMirai.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/addSuppressedMirai.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils @PublishedApi internal actual fun Throwable.addSuppressedMirai(e: Throwable) { diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHJvm.kt b/mirai-core/src/jvmMain/kotlin/utils/cryptor/ECDHJvm.kt similarity index 96% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHJvm.kt rename to mirai-core/src/jvmMain/kotlin/utils/cryptor/ECDHJvm.kt index 0a0a0ca52..8e307762b 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHJvm.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/cryptor/ECDHJvm.kt @@ -7,9 +7,9 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils.cryptor +package net.mamoe.mirai.internal.utils.cryptor -import net.mamoe.mirai.qqandroid.utils.MiraiPlatformUtils +import net.mamoe.mirai.internal.utils.MiraiPlatformUtils import org.bouncycastle.jce.provider.BouncyCastleProvider import java.security.* import java.security.spec.ECGenParameterSpec diff --git a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt b/mirai-core/src/jvmMain/kotlin/utils/setVisible.kt similarity index 96% rename from mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt rename to mirai-core/src/jvmMain/kotlin/utils/setVisible.kt index 3e61d3761..741d9252c 100644 --- a/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/setVisible.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils +package net.mamoe.mirai.internal.utils import java.lang.reflect.Modifier import kotlin.reflect.KProperty diff --git a/java-test/src/test/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java b/mirai-core/src/jvmTest/java/SimpleListenerHostTest.java similarity index 100% rename from java-test/src/test/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java rename to mirai-core/src/jvmTest/java/SimpleListenerHostTest.java diff --git a/mirai-core-qqandroid/src/jvmTest/kotlin/net/mamoe/mirai/qqandroid/utils/AtomicResizeCacheListTest.kt b/mirai-core/src/jvmTest/kotlin/AtomicResizeCacheListTest.kt similarity index 96% rename from mirai-core-qqandroid/src/jvmTest/kotlin/net/mamoe/mirai/qqandroid/utils/AtomicResizeCacheListTest.kt rename to mirai-core/src/jvmTest/kotlin/AtomicResizeCacheListTest.kt index 7ebbdfc6a..8fe377528 100644 --- a/mirai-core-qqandroid/src/jvmTest/kotlin/net/mamoe/mirai/qqandroid/utils/AtomicResizeCacheListTest.kt +++ b/mirai-core/src/jvmTest/kotlin/AtomicResizeCacheListTest.kt @@ -7,8 +7,6 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.qqandroid.utils - /* internal class AtomicResizeCacheListTest { diff --git a/mirai-core/src/main/AndroidManifest.xml b/mirai-core/src/main/AndroidManifest.xml index 544a92e64..b1d2174fb 100644 --- a/mirai-core/src/main/AndroidManifest.xml +++ b/mirai-core/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/mirai-serialization/README.md b/mirai-serialization/README.md deleted file mode 100644 index bb1a7ed6c..000000000 --- a/mirai-serialization/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# mirai-serialization - -mirai-core 的序列化支持模块. 提供 `Message` 类型的序列化支持与相关 [mirai 码](../docs/mirai-code-specification.md) 支持. - -- 状态: 在 `1.1.0` 起为实验性 -- 版本: 自 mirai-core `1.1.0` 起随 mirai-core 以同版本号发布 - -## 依赖配置 - -### Maven - -```xml - - - jcenter - https://jcenter.bintray.com/ - - -``` - -```xml - - - net.mamoe - mirai-serialization - 0.23.0 - - -``` - -### Gradle (推荐) - -```kotlin -repositories{ - jcenter() -} -``` - -#### Java / Kotlin JVM: -- Android: -**注意**: 在 [KT-37152](https://youtrack.jetbrains.com/issue/KT-37152) 修复前, mirai 无法支持 Android 平台目标, 请使用普通 JVM. -```kotlin -implementation("net.mamoe:mirai-serialization-android:VERSION") -``` -- 其他 JVM: -```kotlin -implementation("net.mamoe:mirai-serialization:VERSION") -``` - -#### Kotlin Multi-platform: -**注意**: 在 [KT-37152](https://youtrack.jetbrains.com/issue/KT-37152) 修复前, mirai 无法支持 Android 平台目标, 请使用普通 JVM. -```kotlin -implementation("net.mamoe:mirai-serialization:VERSION") // jvm -implementation("net.mamoe:mirai-serialization-common:VERSION") // common -implementation("net.mamoe:mirai-serialization-android:VERSION") // android -``` - - -## 使用 - -本模块包含两部分功能, 'mirai 码' 和 '序列化' - -### mirai 码 -- 状态: 在 `1.1.0` 实现, 处于实验性阶段 - -- [mirai 码规范](../docs/mirai-code-specification.md) - -#### 将消息转换为 mirai 码 -实现了 [CodableMessage](../mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/CodableMessage.kt#L36) 接口的 [Message](../mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Message.kt#L78) 支持转换为 mirai 码表示. - -[`CodableMessage.toMiraiCode(): String`](../mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/code/CodableMessage.kt#L43) - -#### 将 mirai 码转换为消息 -[`fun String.parseMiraiCode(): MessageChain`](../mirai-serialization/src/commonMain/kotlin/net/mamoe/mirai/message/code/MiraiCode.kt#L26) - -### 序列化 -- 状态: 待实现 -- 相关 issue: [#219](https://github.com/mamoe/mirai/issues/219), [#201](https://github.com/mamoe/mirai/issues/219) diff --git a/mirai-serialization/build.gradle.kts b/mirai-serialization/build.gradle.kts deleted file mode 100644 index d7c28a645..000000000 --- a/mirai-serialization/build.gradle.kts +++ /dev/null @@ -1,97 +0,0 @@ -@file:Suppress("UNUSED_VARIABLE") - -plugins { - kotlin("multiplatform") - id("kotlinx-atomicfu") - kotlin("plugin.serialization") - id("signing") - `maven-publish` - id("com.jfrog.bintray") -} - -description = "Mirai serialization module" - -val isAndroidSDKAvailable: Boolean by project - -kotlin { - explicitApi() - - if (isAndroidSDKAvailable) { - apply(from = rootProject.file("gradle/android.gradle")) - android("android") { - publishAllLibraryVariants() - } - } else { - println( - """Android SDK 可能未安装. - $name 的 Android 目标编译将不会进行. - 这不会影响 Android 以外的平台的编译. - """.trimIndent() - ) - println( - """Android SDK might not be installed. - Android target of $name will not be compiled. - It does no influence on the compilation of other platforms. - """.trimIndent() - ) - } - - jvm() - - sourceSets.apply { - all { - languageSettings.enableLanguageFeature("InlineClasses") - languageSettings.useExperimentalAnnotation("kotlin.Experimental") - languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiInternalAPI") - languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.MiraiExperimentalAPI") - languageSettings.useExperimentalAnnotation("net.mamoe.mirai.LowLevelAPI") - languageSettings.useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes") - languageSettings.useExperimentalAnnotation("kotlin.experimental.ExperimentalTypeInference") - languageSettings.useExperimentalAnnotation("kotlin.time.ExperimentalTime") - languageSettings.useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts") - - languageSettings.progressiveMode = true - } - - val commonMain by getting { - dependencies { - api(project(":mirai-core")) - } - } - val commonTest by getting { - dependencies { - api(kotlin("test-annotations-common")) - api(kotlin("test-common")) - } - } - - if (isAndroidSDKAvailable) { - val androidMain by getting { - dependencies { - } - } - - val androidTest by getting { - dependencies { - } - } - } - - val jvmMain by getting { - dependencies { - runtimeOnly(files("build/classes/kotlin/jvm/main")) // classpath is not properly set by IDE - } - } - - val jvmTest by getting { - dependencies { - implementation(kotlin("test")) - implementation(kotlin("test-junit")) - - runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE - } - } - } -} - -apply(from = rootProject.file("gradle/publish.gradle")) diff --git a/mirai-serialization/src/commonTest/kotlin/net/mamoe/mirai/message/code/MiraiCodeParserTest.kt b/mirai-serialization/src/commonTest/kotlin/net/mamoe/mirai/message/code/MiraiCodeParserTest.kt deleted file mode 100644 index 59d3bd04d..000000000 --- a/mirai-serialization/src/commonTest/kotlin/net/mamoe/mirai/message/code/MiraiCodeParserTest.kt +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2019-2020 Mamoe Technologies and contributors. - * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link. - * - * https://github.com/mamoe/mirai/blob/master/LICENSE - */ - -@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") - -package net.mamoe.mirai.message.code - -import net.mamoe.mirai.message.data.* -import net.mamoe.mirai.message.data.VipFace.Companion.AiXin -import kotlin.test.Test -import kotlin.test.assertEquals - -internal class MiraiCodeParserTest { - - @Test - fun testSplit() { - val str = "sadvass][ [mirai:at:1,test]]vdsavs [mirai:atall]" - assertEquals(str, str.parseMiraiCode().toString()) - } - - @Test - fun testAfter() { - val str = "sadvass][ [mirai:at:1,test]]vdsavs [mirai:atall]last" - val parse = str.parseMiraiCode() - assertEquals(str, parse.toString()) - assertEquals("last", (parse.last() as? PlainText)?.content) - } - - @Test - fun testBefore() { - val str = "sadvass][ [mirai:at:1,test]]vdsavs [mirai:atall]last" - val parse = str.parseMiraiCode() - assertEquals(str, parse.toString()) - assertEquals("sadvass][ ", (parse.first() as? PlainText)?.content) - } - - @Test - fun at() { - val str = "[mirai:at:1,test]" - assertEquals(At._lowLevelConstructAtInstance(1, "test"), str.parseMiraiCode()[0]) - - fun testPlain(str: String) { - assertEquals(str, (str.parseMiraiCode()[0] as PlainText).content) - } - testPlain("[mirai:at:bad,test]") - testPlain("[mirai:at:bad]") - testPlain("[mirai:at:]") - testPlain("[mirai:at]") - } - - @Test - fun atAll() { - val str = "[mirai:atall]" - assertEquals(AtAll, str.parseMiraiCode()[0]) - } - - @Test - fun poke() { - assertEquals(PokeMessage.Poke, PokeMessage.Poke.toString().parseMiraiCode()[0]) - } - - @Test - fun vipFace() { - val instance = VipFace(AiXin, 1) - assertEquals(instance, instance.toString().parseMiraiCode()[0]) - } - - @Test - fun image() { - val instance = Image("{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai") - assertEquals(instance, instance.toString().parseMiraiCode()[0]) - } - - @Test - fun flash() { - val instance = Image("{01E9451B-70ED-EAE3-B37C-101F1EEBF5B5}.mirai").flash() - assertEquals(instance, instance.toString().parseMiraiCode()[0]) - } -} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 2745d3c68..000000000 --- a/settings.gradle +++ /dev/null @@ -1,36 +0,0 @@ -pluginManagement { - resolutionStrategy { - eachPlugin { - switch (requested.id.id) { - case "org.jetbrains.kotlin.multiplatform": useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}"); break - case "com.android.library": useModule("com.android.tools.build:gradle:${requested.version}"); break - case "com.jfrog.bintray": useModule("com.jfrog.bintray.gradle:gradle-bintray-plugin:${requested.version}") - } - } - } - - repositories { - mavenLocal() - gradlePluginPortal() - jcenter() - google() - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" } - maven { url "https://kotlin.bintray.com/kotlinx" } - } -} - -rootProject.name = 'mirai' - -include(':mirai-core') -include(':mirai-core-qqandroid') -include(':mirai-serialization') -include(':mirai-core-all') -include(':java-test') - -//include(':compatibility-validator') // THIS WILL CAUSE A DEPENDENCY RESOLUTION BUG -//include(':java-compatibility-validator') - -// include(':mirai-api-http') -enableFeaturePreview('GRADLE_METADATA') \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..fb3abcb78 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,17 @@ +pluginManagement { + repositories { + mavenLocal() + gradlePluginPortal() + mavenCentral() + jcenter() + google() + maven(url = "https://dl.bintray.com/jetbrains/kotlin-native-dependencies") + maven(url = "https://kotlin.bintray.com/kotlinx") + } +} + +rootProject.name = "mirai" + +include(":mirai-core-api") +include(":mirai-core") +include(":mirai-core-all") \ No newline at end of file