Rearrange module structure:

- Rename mirai-core to mirai-core-api
- Rename mirai-core-qqandroid to mirai-core
- Rename package net.mamoe.mirai.qqandroid to net.mamoe.mirai.internal
- Delete old android targets
- Configure default packages correctly
- Update licenses
This commit is contained in:
Him188 2020-10-03 12:42:13 +08:00
parent fb2f437a21
commit a9d4d14576
378 changed files with 991 additions and 4016 deletions

View File

@ -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

View File

@ -31,7 +31,7 @@ mirai 欢迎一切形式的代码贡献。你可以通过以下几种途径向 m
### 注意事项 ### 注意事项
- 尽量不要引用新的库 - 尽量不要引用新的库
- 遵守 Kotlin 官方代码规范(提交前使用 IDE 格式化代码 (commit 时勾选 'Reformat code') - 遵守 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 数据.
## 社区 ## 社区

View File

@ -1 +0,0 @@
theme: jekyll-theme-cayman

View File

@ -273,19 +273,19 @@ subprojects {
suppress = true suppress = true
} }
perPackageOption { perPackageOption {
prefix = "net.mamoe.mirai.qqandroid.utils" prefix = "net.mamoe.mirai.internal.utils"
suppress = true suppress = true
} }
perPackageOption { perPackageOption {
prefix = "net.mamoe.mirai.qqandroid.contact" prefix = "net.mamoe.mirai.internal.contact"
suppress = true suppress = true
} }
perPackageOption { perPackageOption {
prefix = "net.mamoe.mirai.qqandroid.message" prefix = "net.mamoe.mirai.internal.message"
suppress = true suppress = true
} }
perPackageOption { perPackageOption {
prefix = "net.mamoe.mirai.qqandroid.network" prefix = "net.mamoe.mirai.internal.network"
suppress = true suppress = true
} }
} }

View File

@ -3,16 +3,13 @@ import java.io.OutputStream
import java.security.MessageDigest 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 AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link.
* * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* *
* * https://github.com/mamoe/mirai/blob/master/LICENSE
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@OptIn(ExperimentalUnsignedTypes::class) @OptIn(ExperimentalUnsignedTypes::class)
fun ByteArray.toUHexString( fun ByteArray.toUHexString(
separator: String = " ", separator: String = " ",

View File

@ -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<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@ -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("");
}
}

View File

@ -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 <T> Iterator<T>.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 <T, A : Appendable> Iterator<T>.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 <T> 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())
}
}

View File

@ -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"))
}
}

View File

@ -20,9 +20,9 @@
mirai 项目整体由 核心 (`mirai-core`) 与 控制台(`mirai-console`) 组成. 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` 设计为一个 **`支持库`**, 意味着它可以被独立依赖, 在任意项目中使用. 详见下文. `mirai-core` 设计为一个 **`支持库`**, 意味着它可以被独立依赖, 在任意项目中使用. 详见下文.

View File

@ -5,9 +5,9 @@ apiValidation {
] ]
ignoredPackages += [ ignoredPackages += [
"net.mamoe.mirai.qqandroid.contact", "net.mamoe.mirai.internal.contact",
"net.mamoe.mirai.qqandroid.message", "net.mamoe.mirai.internal.message",
"net.mamoe.mirai.qqandroid.network", "net.mamoe.mirai.internal.network",
"net.mamoe.mirai.qqandroid.utils" "net.mamoe.mirai.internal.utils"
] ]
} }

View File

@ -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<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@ -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("");
}
}

View File

@ -54,7 +54,7 @@ kotlin {
dependencies { dependencies {
api(project(":mirai-core")) api(project(":mirai-core"))
api(project(":mirai-core-qqandroid")) api(project(":mirai-core-api"))
} }
setupPublishing("mirai-core-all") setupPublishing("mirai-core-all")

10
mirai-core-api/README.md Normal file
View File

@ -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 版本协议实现.

View File

@ -4,16 +4,19 @@ plugins {
kotlin("multiplatform") kotlin("multiplatform")
id("kotlinx-atomicfu") id("kotlinx-atomicfu")
kotlin("plugin.serialization") kotlin("plugin.serialization")
id("signing")
id("net.mamoe.kotlin-jvm-blocking-bridge") id("net.mamoe.kotlin-jvm-blocking-bridge")
`maven-publish` `maven-publish`
id("com.jfrog.bintray") id("com.jfrog.bintray")
} }
description = "Mirai Protocol implementation for QQ Android" description = "Mirai API module"
val isAndroidSDKAvailable: Boolean by project val isAndroidSDKAvailable: Boolean by project
kotlin { kotlin {
explicitApi()
if (isAndroidSDKAvailable) { if (isAndroidSDKAvailable) {
apply(from = rootProject.file("gradle/android.gradle")) apply(from = rootProject.file("gradle/android.gradle"))
android("android") { android("android") {
@ -34,7 +37,8 @@ kotlin {
) )
} }
jvm("jvm") { jvm {
// withJava() // https://youtrack.jetbrains.com/issue/KT-39991
} }
sourceSets.apply { sourceSets.apply {
@ -52,41 +56,50 @@ kotlin {
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.UnstableExternalImage") languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.UnstableExternalImage")
languageSettings.progressiveMode = true languageSettings.progressiveMode = true
dependencies {
api(project(":mirai-core"))
}
} }
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api(kotlin("serialization"))
api(kotlin("reflect"))
api1(kotlinx("serialization-core", Versions.Kotlin.serialization)) api1(kotlinx("serialization-core", Versions.Kotlin.serialization))
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
implementation1(kotlinx("serialization-protobuf", Versions.Kotlin.serialization)) implementation1(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
api1("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}")
api1(kotlinx("io", Versions.Kotlin.io)) 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 { dependencies {
implementation(kotlin("test-annotations-common")) implementation(kotlin("test-annotations-common"))
implementation(kotlin("test-common")) implementation(kotlin("test-common"))
implementation(kotlin("script-runtime"))
} }
} }
if (isAndroidSDKAvailable) { if (isAndroidSDKAvailable) {
val androidMain by getting { val androidMain by getting {
dependencies { 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 { val androidTest by getting {
dependencies { dependencies {
implementation(kotlin("test", Versions.Kotlin.compiler)) implementation(kotlin("test"))
implementation(kotlin("test-junit", Versions.Kotlin.compiler)) implementation(kotlin("test-junit"))
implementation(kotlin("test-annotations-common")) implementation(kotlin("test-annotations-common"))
implementation(kotlin("test-common")) implementation(kotlin("test-common"))
} }
@ -95,18 +108,23 @@ kotlin {
val jvmMain by getting { val jvmMain by getting {
dependencies { 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)) 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 { val jvmTest by getting {
dependencies { dependencies {
dependsOn(commonTest) implementation(kotlin("test"))
implementation(kotlin("test", Versions.Kotlin.compiler)) implementation(kotlin("test-junit"))
implementation(kotlin("test-junit", Versions.Kotlin.compiler))
implementation("org.pcap4j:pcap4j-distribution:1.8.2") 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")) apply(from = rootProject.file("gradle/publish.gradle"))
tasks.withType<com.jfrog.bintray.gradle.tasks.BintrayUploadTask> { tasks.withType<com.jfrog.bintray.gradle.tasks.BintrayUploadTask> {
doFirst { doFirst {
publishing.publications publishing.publications

View File

@ -6,7 +6,6 @@
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress( @file:Suppress(
"EXPERIMENTAL_API_USAGE", "unused", "FunctionName", "NOTHING_TO_INLINE", "UnusedImport", "EXPERIMENTAL_API_USAGE", "unused", "FunctionName", "NOTHING_TO_INLINE", "UnusedImport",
"EXPERIMENTAL_OVERRIDE", "CanBeParameter", "MemberVisibilityCanBePrivate" "EXPERIMENTAL_OVERRIDE", "CanBeParameter", "MemberVisibilityCanBePrivate"
@ -236,7 +235,7 @@ public abstract class Bot internal constructor(
@PlannedRemoval("1.2.0") @PlannedRemoval("1.2.0")
@Deprecated( @Deprecated(
"use extension.", "use extension.",
replaceWith = ReplaceWith("image.queryUrl()", imports = ["net.mamoe.mirai.message.data.queryUrl"]), replaceWith = ReplaceWith("image.queryUrl()", imports = ["queryUrl"]),
level = DeprecationLevel.ERROR level = DeprecationLevel.ERROR
) )
@JvmSynthetic @JvmSynthetic

View File

@ -6,7 +6,6 @@
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") @file:Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
package net.mamoe.mirai package net.mamoe.mirai

View File

@ -1,6 +1,9 @@
package net.mamoe.mirai.data 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.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor

View File

@ -37,7 +37,7 @@ import kotlin.jvm.JvmName
// //
// //
//// ////
//// 此文件存放所有 `net.mamoe.mirai.event.subscribeMessages` 已弃用的函数. //// 此文件存放所有 `subscribeMessages` 已弃用的函数.
//// ////
// //
// //

View File

@ -16,8 +16,8 @@ package net.mamoe.mirai.event.events
import net.mamoe.mirai.Bot import net.mamoe.mirai.Bot
import net.mamoe.mirai.contact.User import net.mamoe.mirai.contact.User
import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.AbstractEvent
import net.mamoe.mirai.internal.network.Packet
import net.mamoe.mirai.message.action.Nudge 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.MiraiExperimentalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.SinceMirai

View File

@ -20,7 +20,7 @@ import net.mamoe.mirai.contact.Group
import net.mamoe.mirai.contact.User import net.mamoe.mirai.contact.User
import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.AbstractEvent
import net.mamoe.mirai.event.internal.MiraiAtomicBoolean 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.SinceMirai
import net.mamoe.mirai.utils.internal.runBlocking import net.mamoe.mirai.utils.internal.runBlocking
import kotlin.jvm.* import kotlin.jvm.*

View File

@ -22,8 +22,8 @@ import net.mamoe.mirai.contact.MemberPermission
import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.AbstractEvent
import net.mamoe.mirai.event.BroadcastControllable import net.mamoe.mirai.event.BroadcastControllable
import net.mamoe.mirai.event.internal.MiraiAtomicBoolean 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.message.action.Nudge
import net.mamoe.mirai.qqandroid.network.Packet
import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.utils.MiraiExperimentalAPI
import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.SinceMirai
import net.mamoe.mirai.utils.internal.runBlocking import net.mamoe.mirai.utils.internal.runBlocking

View File

@ -19,12 +19,12 @@ import net.mamoe.mirai.event.AbstractEvent
import net.mamoe.mirai.event.CancellableEvent import net.mamoe.mirai.event.CancellableEvent
import net.mamoe.mirai.event.events.ImageUploadEvent.Failed import net.mamoe.mirai.event.events.ImageUploadEvent.Failed
import net.mamoe.mirai.event.events.ImageUploadEvent.Succeed 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.MessageReceipt
import net.mamoe.mirai.message.data.Image import net.mamoe.mirai.message.data.Image
import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.Message
import net.mamoe.mirai.message.data.MessageChain import net.mamoe.mirai.message.data.MessageChain
import net.mamoe.mirai.message.data.MessageSource 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.ExternalImage
import net.mamoe.mirai.utils.PlannedRemoval import net.mamoe.mirai.utils.PlannedRemoval
import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.SinceMirai
@ -403,7 +403,7 @@ public sealed class ImageUploadEvent : BotEvent, BotActiveEvent, AbstractEvent()
message = """ message = """
MessagePreSendEvent MessagePostSendEvent 替换. MessagePreSendEvent MessagePostSendEvent 替换.
""", """,
replaceWith = ReplaceWith("MessagePreSendEvent", "net.mamoe.mirai.event.events.MessagePreSendEvent"), replaceWith = ReplaceWith("MessagePreSendEvent", "MessagePreSendEvent"),
level = DeprecationLevel.WARNING level = DeprecationLevel.WARNING
) )
public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent() { public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent() {
@ -415,7 +415,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent()
message = """ message = """
GroupMessagePreSendEvent GroupMessagePostSendEvent 替换. GroupMessagePreSendEvent GroupMessagePostSendEvent 替换.
""", """,
replaceWith = ReplaceWith("GroupMessagePreSendEvent", "net.mamoe.mirai.event.events.GroupMessagePreSendEvent"), replaceWith = ReplaceWith("GroupMessagePreSendEvent", "GroupMessagePreSendEvent"),
level = DeprecationLevel.WARNING level = DeprecationLevel.WARNING
) )
public data class GroupMessageSendEvent internal constructor( public data class GroupMessageSendEvent internal constructor(
@ -429,7 +429,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent()
""", """,
replaceWith = ReplaceWith( replaceWith = ReplaceWith(
"FriendMessagePreSendEvent", "FriendMessagePreSendEvent",
"net.mamoe.mirai.event.events.FriendMessagePreSendEvent" "FriendMessagePreSendEvent"
), ),
level = DeprecationLevel.WARNING level = DeprecationLevel.WARNING
) )
@ -442,7 +442,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent()
message = """ message = """
TempMessagePreSendEvent TempMessagePostSendEvent 替换. TempMessagePreSendEvent TempMessagePostSendEvent 替换.
""", """,
replaceWith = ReplaceWith("TempMessagePreSendEvent", "net.mamoe.mirai.event.events.TempMessagePreSendEvent"), replaceWith = ReplaceWith("TempMessagePreSendEvent", "TempMessagePreSendEvent"),
level = DeprecationLevel.WARNING level = DeprecationLevel.WARNING
) )
public data class TempMessageSendEvent internal constructor( public data class TempMessageSendEvent internal constructor(

View File

@ -6,7 +6,6 @@
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai package net.mamoe.mirai
/** /**

View File

@ -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 AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link.
* * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
* *
* * https://github.com/mamoe/mirai/blob/master/LICENSE
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
package net.mamoe.mirai.message.action package net.mamoe.mirai.message.action
import net.mamoe.kjbb.JvmBlockingBridge import net.mamoe.kjbb.JvmBlockingBridge

View File

@ -52,7 +52,7 @@ public data class PlainText(
*/ */
@Deprecated( @Deprecated(
"为和 mirai code 区分, 请使用 PlainText(this)", "为和 mirai code 区分, 请使用 PlainText(this)",
ReplaceWith("PlainText(this)", "net.mamoe.mirai.message.data.PlainText"), ReplaceWith("PlainText(this)", "PlainText"),
level = DeprecationLevel.WARNING level = DeprecationLevel.WARNING
) )
@JvmSynthetic @JvmSynthetic

View File

@ -48,7 +48,7 @@ internal const val ONLINE_OFFLINE_DEPRECATION_MESSAGE = """
@Deprecated( @Deprecated(
ONLINE_OFFLINE_DEPRECATION_MESSAGE, ONLINE_OFFLINE_DEPRECATION_MESSAGE,
level = DeprecationLevel.ERROR, level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") replaceWith = ReplaceWith("Image", "Image")
) )
@Suppress("EXPOSED_SUPER_INTERFACE") @Suppress("EXPOSED_SUPER_INTERFACE")
public interface OnlineImage : Image, ConstOriginUrlAware { public interface OnlineImage : Image, ConstOriginUrlAware {
@ -69,7 +69,7 @@ public interface OnlineImage : Image, ConstOriginUrlAware {
@Deprecated( @Deprecated(
ONLINE_OFFLINE_DEPRECATION_MESSAGE, ONLINE_OFFLINE_DEPRECATION_MESSAGE,
level = DeprecationLevel.ERROR, level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") replaceWith = ReplaceWith("Image", "Image")
) )
public interface OfflineImage : Image { public interface OfflineImage : Image {
public companion object Key : Message.Key<OfflineImage> { public companion object Key : Message.Key<OfflineImage> {
@ -96,7 +96,7 @@ public suspend fun OfflineImage.queryUrl(): String {
@Deprecated( @Deprecated(
ONLINE_OFFLINE_DEPRECATION_MESSAGE, ONLINE_OFFLINE_DEPRECATION_MESSAGE,
level = DeprecationLevel.ERROR, level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") replaceWith = ReplaceWith("Image", "Image")
) )
@Serializable @Serializable
public data class OfflineGroupImage( public data class OfflineGroupImage(
@ -124,7 +124,7 @@ public data class OfflineGroupImage(
@Deprecated( @Deprecated(
ONLINE_OFFLINE_DEPRECATION_MESSAGE, ONLINE_OFFLINE_DEPRECATION_MESSAGE,
level = DeprecationLevel.ERROR, level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") replaceWith = ReplaceWith("Image", "Image")
) )
public abstract class OnlineGroupImage : GroupImage(), OnlineImage public abstract class OnlineGroupImage : GroupImage(), OnlineImage
@ -137,7 +137,7 @@ public abstract class OnlineGroupImage : GroupImage(), OnlineImage
@Deprecated( @Deprecated(
ONLINE_OFFLINE_DEPRECATION_MESSAGE, ONLINE_OFFLINE_DEPRECATION_MESSAGE,
level = DeprecationLevel.ERROR, level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") replaceWith = ReplaceWith("Image", "Image")
) )
@Serializable @Serializable
public data class OfflineFriendImage( public data class OfflineFriendImage(
@ -161,7 +161,7 @@ public data class OfflineFriendImage(
@Deprecated( @Deprecated(
ONLINE_OFFLINE_DEPRECATION_MESSAGE, ONLINE_OFFLINE_DEPRECATION_MESSAGE,
level = DeprecationLevel.ERROR, level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image") replaceWith = ReplaceWith("Image", "Image")
) )
public abstract class OnlineFriendImage : FriendImage(), OnlineImage public abstract class OnlineFriendImage : FriendImage(), OnlineImage

View File

@ -23,9 +23,9 @@ import net.mamoe.mirai.Bot
import net.mamoe.mirai.contact.* import net.mamoe.mirai.contact.*
import net.mamoe.mirai.event.AbstractEvent import net.mamoe.mirai.event.AbstractEvent
import net.mamoe.mirai.event.events.BotEvent 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.MessageChain
import net.mamoe.mirai.message.data.OnlineMessageSource import net.mamoe.mirai.message.data.OnlineMessageSource
import net.mamoe.mirai.qqandroid.network.Packet
import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmMultifileClass
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
@ -35,7 +35,7 @@ import kotlin.jvm.JvmName
*/ */
@Deprecated( @Deprecated(
message = "use MessageEvent", message = "use MessageEvent",
replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"), replaceWith = ReplaceWith("MessageEvent", "MessageEvent"),
level = DeprecationLevel.HIDDEN level = DeprecationLevel.HIDDEN
) )
public abstract class MessagePacketBase<out TSender : User, out TSubject : Contact> : Packet, BotEvent, public abstract class MessagePacketBase<out TSender : User, out TSubject : Contact> : Packet, BotEvent,
@ -51,7 +51,7 @@ public abstract class MessagePacketBase<out TSender : User, out TSubject : Conta
@Deprecated( @Deprecated(
message = "Ambiguous name. Use MessageEvent instead", message = "Ambiguous name. Use MessageEvent instead",
replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"), replaceWith = ReplaceWith("MessageEvent", "MessageEvent"),
level = DeprecationLevel.HIDDEN level = DeprecationLevel.HIDDEN
) )
@Suppress("DEPRECATION_ERROR") @Suppress("DEPRECATION_ERROR")
@ -68,7 +68,7 @@ public abstract class MessagePacket : MessagePacketBase<User, Contact>(),
@Deprecated( @Deprecated(
message = "Ambiguous name. Use MessageEvent instead", message = "Ambiguous name. Use MessageEvent instead",
replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"), replaceWith = ReplaceWith("MessageEvent", "MessageEvent"),
level = DeprecationLevel.HIDDEN level = DeprecationLevel.HIDDEN
) )
@Suppress("DEPRECATION_ERROR") @Suppress("DEPRECATION_ERROR")
@ -85,7 +85,7 @@ public abstract class ContactMessage : MessagePacket(),
@Deprecated( @Deprecated(
message = "Ambiguous name. Use FriendMessageEvent instead", message = "Ambiguous name. Use FriendMessageEvent instead",
replaceWith = ReplaceWith("FriendMessageEvent", "net.mamoe.mirai.message.FriendMessageEvent"), replaceWith = ReplaceWith("FriendMessageEvent", "FriendMessageEvent"),
level = DeprecationLevel.HIDDEN level = DeprecationLevel.HIDDEN
) )
@Suppress("DEPRECATION_ERROR") @Suppress("DEPRECATION_ERROR")
@ -101,7 +101,7 @@ public abstract class FriendMessage : MessageEvent() {
@Deprecated( @Deprecated(
message = "Ambiguous name. Use GroupMessageEvent instead", message = "Ambiguous name. Use GroupMessageEvent instead",
replaceWith = ReplaceWith("GroupMessageEvent", "net.mamoe.mirai.message.GroupMessageEvent"), replaceWith = ReplaceWith("GroupMessageEvent", "GroupMessageEvent"),
level = DeprecationLevel.HIDDEN level = DeprecationLevel.HIDDEN
) )
@Suppress("DEPRECATION_ERROR") @Suppress("DEPRECATION_ERROR")
@ -118,7 +118,7 @@ public abstract class GroupMessage : MessageEvent() {
@Deprecated( @Deprecated(
message = "Ambiguous name. Use TempMessageEvent instead", message = "Ambiguous name. Use TempMessageEvent instead",
replaceWith = ReplaceWith("TempMessageEvent", "net.mamoe.mirai.message.TempMessageEvent"), replaceWith = ReplaceWith("TempMessageEvent", "TempMessageEvent"),
level = DeprecationLevel.HIDDEN level = DeprecationLevel.HIDDEN
) )
public abstract class TempMessage : MessageEvent() { public abstract class TempMessage : MessageEvent() {

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * 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.event.Event
import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.MiraiInternalAPI

Some files were not shown because too many files have changed in this diff Show More