diff --git a/build.gradle.kts b/build.gradle.kts index 2eb66dca3..48c18003e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("UnstableApiUsage", "UNUSED_VARIABLE") import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar @@ -229,9 +238,9 @@ val experimentalAnnotations = arrayOf( "kotlin.RequiresOptIn", "kotlin.contracts.ExperimentalContracts", "kotlin.experimental.ExperimentalTypeInference", - "net.mamoe.mirai.utils.MiraiInternalAPI", - "net.mamoe.mirai.utils.MiraiExperimentalAPI", - "net.mamoe.mirai.LowLevelAPI", + "net.mamoe.mirai.utils.MiraiInternalApi", + "net.mamoe.mirai.utils.MiraiExperimentalApi", + "net.mamoe.mirai.LowLevelApi", "kotlinx.serialization.ExperimentalSerializationApi" ) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4d9233c82..1002f44e3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + plugins { `kotlin-dsl` } diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index e69de29bb..e5b95cae5 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,9 @@ +/* + * 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + diff --git a/buildSrc/src/main/kotlin/PublishingHelpers.kt b/buildSrc/src/main/kotlin/PublishingHelpers.kt index 515327531..e1d11b63c 100644 --- a/buildSrc/src/main/kotlin/PublishingHelpers.kt +++ b/buildSrc/src/main/kotlin/PublishingHelpers.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "NOTHING_TO_INLINE", "RemoveRedundantBackticks") import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 911c2ce0d..122b6f0c3 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("ObjectPropertyName", "ObjectPropertyName", "unused") /* * Copyright 2019-2020 Mamoe Technologies and contributors. diff --git a/buildSrc/src/main/kotlin/upload/Bintray.kt b/buildSrc/src/main/kotlin/upload/Bintray.kt index 5d0323a00..add7560ae 100644 --- a/buildSrc/src/main/kotlin/upload/Bintray.kt +++ b/buildSrc/src/main/kotlin/upload/Bintray.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package upload import org.gradle.api.Project diff --git a/buildSrc/src/main/kotlin/utils.kt b/buildSrc/src/main/kotlin/utils.kt index 9dd5269ca..21986ba02 100644 --- a/buildSrc/src/main/kotlin/utils.kt +++ b/buildSrc/src/main/kotlin/utils.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + import java.io.InputStream import java.io.OutputStream import java.security.MessageDigest diff --git a/gradle.properties b/gradle.properties index bb44b0b8d..cc3187dd9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,11 @@ +# +# 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. +# +# https://github.com/mamoe/mirai/blob/master/LICENSE +# # style guide kotlin.code.style=official # config diff --git a/gradle/android.gradle b/gradle/android.gradle index 31536c586..001c42409 100644 --- a/gradle/android.gradle +++ b/gradle/android.gradle @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + apply plugin: "com.android.library" android { diff --git a/gradle/api-validation.gradle b/gradle/api-validation.gradle index c3434f235..f0836c84f 100644 --- a/gradle/api-validation.gradle +++ b/gradle/api-validation.gradle @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + apiValidation { ignoredPackages += [ "net.mamoe.mirai.event.internal", diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle index 346e5b100..a9c102777 100644 --- a/gradle/bintray.gradle +++ b/gradle/bintray.gradle @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + publishing { repositories { maven { diff --git a/gradle/publish.gradle b/gradle/publish.gradle index 9c9c7b62c..db32312c2 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + // 部分源码来自 kotlinx.coroutines // Source code from kotlinx.coroutines diff --git a/gradle/publishOld.gradle b/gradle/publishOld.gradle index 001960256..1e71b1d94 100644 --- a/gradle/publishOld.gradle +++ b/gradle/publishOld.gradle @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + import upload.Bintray // 部分源码来自 kotlinx.coroutines diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6243a50d1..cba462d3b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,3 +1,11 @@ +# +# 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. +# +# https://github.com/mamoe/mirai/blob/master/LICENSE +# #Tue Mar 31 10:18:00 CST 2020 distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 2fe81a7d9..d77a7183f 100644 --- a/gradlew +++ b/gradlew @@ -1,19 +1,12 @@ #!/usr/bin/env sh # -# Copyright 2015 the original author or authors. +# Copyright 2019-2020 Mamoe Technologies and contributors. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# 此源代码的使用受 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://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# https://github.com/mamoe/mirai/blob/master/LICENSE # ############################################################################## diff --git a/mirai-core-all/build.gradle.kts b/mirai-core-all/build.gradle.kts index 51c5e2bab..92edf6fbf 100644 --- a/mirai-core-all/build.gradle.kts +++ b/mirai-core-all/build.gradle.kts @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("UnusedImport") plugins { diff --git a/mirai-core-api/build.gradle.kts b/mirai-core-api/build.gradle.kts index 3eaf02f2b..8ac9819c6 100644 --- a/mirai-core-api/build.gradle.kts +++ b/mirai-core-api/build.gradle.kts @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("UNUSED_VARIABLE") plugins { diff --git a/mirai-core-api/src/commonMain/kotlin/Bot.kt b/mirai-core-api/src/commonMain/kotlin/Bot.kt index 2fbca4e8b..839320dbd 100644 --- a/mirai-core-api/src/commonMain/kotlin/Bot.kt +++ b/mirai-core-api/src/commonMain/kotlin/Bot.kt @@ -1,32 +1,26 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "EXPERIMENTAL_API_USAGE", "unused", "FunctionName", "NOTHING_TO_INLINE", "UnusedImport", - "EXPERIMENTAL_OVERRIDE", "CanBeParameter", "MemberVisibilityCanBePrivate" + "EXPERIMENTAL_OVERRIDE", "CanBeParameter", "MemberVisibilityCanBePrivate", "INAPPLICABLE_JVM_NAME", + "EXPOSED_SUPER_CLASS" ) package net.mamoe.mirai import kotlinx.coroutines.* import net.mamoe.mirai.contact.* -import net.mamoe.mirai.event.events.BotInvitedJoinGroupRequestEvent -import net.mamoe.mirai.event.events.MemberJoinRequestEvent -import net.mamoe.mirai.event.events.NewFriendRequestEvent -import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.action.BotNudge import net.mamoe.mirai.message.action.MemberNudge -import net.mamoe.mirai.message.action.Nudge -import net.mamoe.mirai.message.data.* import net.mamoe.mirai.network.LoginFailedException import net.mamoe.mirai.utils.* import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext import kotlin.jvm.JvmField import kotlin.jvm.JvmStatic import kotlin.jvm.JvmSynthetic @@ -48,10 +42,9 @@ public suspend inline fun B.alsoLogin(): B = also { login() } * * @see BotFactory 构造 [Bot] 的工厂, [Bot] 唯一的构造方式. */ -@Suppress("INAPPLICABLE_JVM_NAME", "EXPOSED_SUPER_CLASS") public abstract class Bot internal constructor( public val configuration: BotConfiguration -) : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI, ContactOrBot { +) : CoroutineScope, ContactOrBot { public final override val coroutineContext: CoroutineContext = // for id configuration.parentCoroutineContext .plus(SupervisorJob(configuration.parentCoroutineContext[Job])) @@ -124,7 +117,7 @@ public abstract class Bot internal constructor( * 在 JVM 的默认实现为 `class ContextImpl : Context` * 在 Android 实现为 `android.content.Context` */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public abstract val context: Context /** @@ -151,10 +144,10 @@ public abstract class Bot internal constructor( // region contacts /** - * [User.id] 与 [Bot.id] 相同的 [_lowLevelNewFriend] 实例 + * [User.id] 与 [Bot.id] 相同的 [Friend] 实例 */ - @MiraiExperimentalAPI - public abstract val selfQQ: Friend + @MiraiExperimentalApi + public abstract val asFriend: Friend /** @@ -183,8 +176,6 @@ public abstract class Bot internal constructor( // endregion - // region network - /** * 登录, 或重新登录. * 这个函数总是关闭一切现有网路任务 (但不会关闭其他任务), 然后重新登录并重新缓存好友列表和群列表. @@ -196,170 +187,16 @@ public abstract class Bot internal constructor( */ @JvmSynthetic public abstract suspend fun login() - // endregion - - - // region actions - - /** - * 撤回这条消息. 可撤回自己 2 分钟内发出的消息, 和任意时间的群成员的消息. - * - * [Bot] 撤回自己的消息不需要权限. - * [Bot] 撤回群员的消息需要管理员权限. - * - * @param source 消息源. 可从 [MessageReceipt.source] 获得, 或从消息事件中的 [MessageChain] 获得, 或通过 [buildMessageSource] 构建. - * - * @throws PermissionDeniedException 当 [Bot] 无权限操作时抛出 - * @throws IllegalStateException 当这条消息已经被撤回时抛出 (仅同步主动操作) - * - * @see Bot.recall (扩展函数) 接受参数 [MessageChain] - * @see MessageSource.recall 撤回消息扩展 - */ - @JvmSynthetic - public abstract suspend fun recall(source: MessageSource) /** * 创建一个 "戳一戳" 消息 * * @see MemberNudge.sendTo 发送这个戳一戳消息 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("1.3.0") public fun nudge(): BotNudge = BotNudge(this) - /** - * 获取图片下载链接 - * - * @see Image.queryUrl [Image] 的扩展函数 - */ - @PlannedRemoval("1.2.0") - @Deprecated( - "use extension.", - replaceWith = ReplaceWith("image.queryUrl()", imports = ["queryUrl"]), - level = DeprecationLevel.ERROR - ) - @JvmSynthetic - public abstract suspend fun queryImageUrl(image: Image): String - - /** - * 构造一个 [OfflineMessageSource] - * - * @param id 即 [MessageSource.id] - * @param internalId 即 [MessageSource.internalId] - * - * @param fromUin 为用户时为 [Friend.id], 为群时需使用 [Group.calculateGroupUinByGroupCode] 计算 - * @param targetUin 为用户时为 [Friend.id], 为群时需使用 [Group.calculateGroupUinByGroupCode] 计算 - */ - @MiraiExperimentalAPI("This is very experimental and is subject to change.") - public abstract fun constructMessageSource( - kind: OfflineMessageSource.Kind, - fromUin: Long, targetUin: Long, - id: Int, time: Int, internalId: Int, - originalMessage: MessageChain - ): OfflineMessageSource - - - /** - * 通过好友验证 - * - * @param event 好友验证的事件对象 - */ - @PlannedRemoval("1.2.0") - @Deprecated("use member function.", replaceWith = ReplaceWith("event.accept()"), level = DeprecationLevel.ERROR) - @JvmSynthetic - public abstract suspend fun acceptNewFriendRequest(event: NewFriendRequestEvent) - - /** - * 拒绝好友验证 - * - * @param event 好友验证的事件对象 - * @param blackList 拒绝后是否拉入黑名单 - */ - @PlannedRemoval("1.2.0") - @Deprecated( - "use member function.", - replaceWith = ReplaceWith("event.reject(blackList)"), - level = DeprecationLevel.ERROR - ) - @JvmSynthetic - public abstract suspend fun rejectNewFriendRequest(event: NewFriendRequestEvent, blackList: Boolean = false) - - /** - * 通过加群验证(需管理员权限) - * - * @param event 加群验证的事件对象 - */ - @PlannedRemoval("1.2.0") - @Deprecated("use member function.", replaceWith = ReplaceWith("event.accept()"), level = DeprecationLevel.ERROR) - @JvmSynthetic - public abstract suspend fun acceptMemberJoinRequest(event: MemberJoinRequestEvent) - - /** - * 拒绝加群验证(需管理员权限) - * - * @param event 加群验证的事件对象 - * @param blackList 拒绝后是否拉入黑名单 - */ - @PlannedRemoval("1.2.0") - @Deprecated( - "use member function.", - replaceWith = ReplaceWith("event.reject(blackList)"), - level = DeprecationLevel.HIDDEN - ) - public abstract suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false) - - @JvmSynthetic - public abstract suspend fun rejectMemberJoinRequest( - event: MemberJoinRequestEvent, - blackList: Boolean = false, - message: String = "" - ) - - /** - * 忽略加群验证(需管理员权限) - * - * @param event 加群验证的事件对象 - * @param blackList 忽略后是否拉入黑名单 - */ - @PlannedRemoval("1.2.0") - @Deprecated( - "use member function.", - replaceWith = ReplaceWith("event.ignore(blackList)"), - level = DeprecationLevel.ERROR - ) - @JvmSynthetic - public abstract suspend fun ignoreMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false) - - /** - * 接收邀请入群(需管理员权限) - * - * @param event 邀请入群的事件对象 - */ - @PlannedRemoval("1.2.0") - @Deprecated("use member function.", replaceWith = ReplaceWith("event.accept()"), level = DeprecationLevel.ERROR) - @JvmSynthetic - public abstract suspend fun acceptInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) - - /** - * 忽略邀请入群(需管理员权限) - * - * @param event 邀请入群的事件对象 - */ - @PlannedRemoval("1.2.0") - @Deprecated("use member function.", replaceWith = ReplaceWith("event.ignore()"), level = DeprecationLevel.ERROR) - @JvmSynthetic - public abstract suspend fun ignoreInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) - - @Deprecated( - "use member function.", - replaceWith = ReplaceWith("nudge.sendTo(contact)"), - level = DeprecationLevel.ERROR - ) - @SinceMirai("1.3.0") - public abstract suspend fun sendNudge(nudge: Nudge, receiver: Contact): Boolean - - // endregion - /** * 关闭这个 [Bot], 立即取消 [Bot] 的 [SupervisorJob]. * 之后 [isActive] 将会返回 `false`. @@ -389,53 +226,6 @@ public val Bot.supervisorJob: CompletableJob @JvmSynthetic public suspend inline fun Bot.join(): Unit = this.coroutineContext[Job]!!.join() -/** - * 撤回这条消息. - * - * [Bot] 撤回自己的消息不需要权限, 但需要在发出后 2 分钟内撤回. - * [Bot] 撤回群员的消息需要管理员权限, 可在任意时间撤回. - * - * @throws PermissionDeniedException 当 [Bot] 无权限操作时 - * @see Bot.recall - */ -@JvmSynthetic -public suspend inline fun Bot.recall(message: MessageChain): Unit = - this.recall(message.source) - -/** - * 在一段时间后撤回这个消息源所指代的消息. - * - * @param millis 延迟的时间, 单位为毫秒 - * @param coroutineContext 额外的 [CoroutineContext] - * @see recall - */ -@JvmSynthetic -public inline fun CoroutineScope.recallIn( - source: MessageSource, - millis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = this.launch(coroutineContext + CoroutineName("MessageRecall")) { - delay(millis) - source.recall() -} - -/** - * 在一段时间后撤回这条消息. - * - * @param millis 延迟的时间, 单位为毫秒 - * @param coroutineContext 额外的 [CoroutineContext] - * @see recall - */ -@JvmSynthetic -public inline fun CoroutineScope.recallIn( - message: MessageChain, - millis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = this.launch(coroutineContext + CoroutineName("MessageRecall")) { - delay(millis) - message.recall() -} - /** * 关闭这个 [Bot], 停止一切相关活动. 所有引用都会被释放. * diff --git a/mirai-core-api/src/commonMain/kotlin/BotFactory.kt b/mirai-core-api/src/commonMain/kotlin/BotFactory.kt index bd4dde5e8..3da94b596 100644 --- a/mirai-core-api/src/commonMain/kotlin/BotFactory.kt +++ b/mirai-core-api/src/commonMain/kotlin/BotFactory.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") diff --git a/mirai-core-api/src/commonMain/kotlin/Mirai.kt b/mirai-core-api/src/commonMain/kotlin/Mirai.kt new file mode 100644 index 000000000..9d0b9cda2 --- /dev/null +++ b/mirai-core-api/src/commonMain/kotlin/Mirai.kt @@ -0,0 +1,163 @@ +/* + * 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + +@file:Suppress("INTERFACE_NOT_SUPPORTED") + +package net.mamoe.mirai + +import net.mamoe.kjbb.JvmBlockingBridge +import net.mamoe.mirai.contact.Contact +import net.mamoe.mirai.contact.Friend +import net.mamoe.mirai.contact.Group +import net.mamoe.mirai.contact.PermissionDeniedException +import net.mamoe.mirai.event.events.BotInvitedJoinGroupRequestEvent +import net.mamoe.mirai.event.events.MemberJoinRequestEvent +import net.mamoe.mirai.event.events.NewFriendRequestEvent +import net.mamoe.mirai.message.MessageReceipt +import net.mamoe.mirai.message.action.Nudge +import net.mamoe.mirai.message.data.* +import net.mamoe.mirai.utils.MiraiExperimentalApi +import kotlin.jvm.JvmSynthetic + +@OptIn(LowLevelApi::class, MiraiExperimentalApi::class) +public interface Mirai : LowLevelApiAccessor { + @Suppress("PropertyName") + @MiraiExperimentalApi + public val BotFactory: BotFactory + + /** + * 撤回这条消息. 可撤回自己 2 分钟内发出的消息, 和任意时间的群成员的消息. + * + * [Bot] 撤回自己的消息不需要权限. + * [Bot] 撤回群员的消息需要管理员权限. + * + * @param source 消息源. 可从 [MessageReceipt.source] 获得, 或从消息事件中的 [MessageChain] 获得, 或通过 [buildMessageSource] 构建. + * + * @throws PermissionDeniedException 当 [Bot] 无权限操作时抛出 + * @throws IllegalStateException 当这条消息已经被撤回时抛出 (仅同步主动操作) + * + * @see Mirai.recall (扩展函数) 接受参数 [MessageChain] + * @see MessageSource.recall 撤回消息扩展 + */ + @JvmBlockingBridge + public suspend fun recall(bot: Bot, source: MessageSource) + + @JvmBlockingBridge + public suspend fun sendNudge(bot: Bot, nudge: Nudge, receiver: Contact): Boolean + + public fun createImage(imageId: String): Image + + /** + * 获取图片下载链接 + * + * @see Image.queryUrl [Image] 的扩展函数 + */ + @JvmBlockingBridge + public suspend fun queryImageUrl(bot: Bot, image: Image): String + + /** + * 构造一个 [OfflineMessageSource] + * + * @param id 即 [MessageSource.id] + * @param internalId 即 [MessageSource.internalId] + * + * @param fromUin 为用户时为 [Friend.id], 为群时需使用 [Group.calculateGroupUinByGroupCode] 计算 + * @param targetUin 为用户时为 [Friend.id], 为群时需使用 [Group.calculateGroupUinByGroupCode] 计算 + */ + @MiraiExperimentalApi("This is very experimental and is subject to change.") + public fun constructMessageSource( + bot: Bot, + kind: OfflineMessageSource.Kind, + fromUin: Long, targetUin: Long, + id: Int, time: Int, internalId: Int, + originalMessage: MessageChain + ): OfflineMessageSource + + + /** + * 通过好友验证 + * + * @param event 好友验证的事件对象 + */ + @JvmBlockingBridge + public suspend fun acceptNewFriendRequest(event: NewFriendRequestEvent) + + /** + * 拒绝好友验证 + * + * @param event 好友验证的事件对象 + * @param blackList 拒绝后是否拉入黑名单 + */ + @JvmBlockingBridge + public suspend fun rejectNewFriendRequest(event: NewFriendRequestEvent, blackList: Boolean = false) + + /** + * 通过加群验证(需管理员权限) + * + * @param event 加群验证的事件对象 + */ + @JvmBlockingBridge + public suspend fun acceptMemberJoinRequest(event: MemberJoinRequestEvent) + + /** + * 拒绝加群验证(需管理员权限) + * + * @param event 加群验证的事件对象 + * @param blackList 拒绝后是否拉入黑名单 + */ + @JvmBlockingBridge + public suspend fun rejectMemberJoinRequest( + event: MemberJoinRequestEvent, + blackList: Boolean = false, + message: String = "" + ) + + /** + * 忽略加群验证(需管理员权限) + * + * @param event 加群验证的事件对象 + * @param blackList 忽略后是否拉入黑名单 + */ + @JvmBlockingBridge + public suspend fun ignoreMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean = false) + + /** + * 接收邀请入群(需管理员权限) + * + * @param event 邀请入群的事件对象 + */ + @JvmBlockingBridge + public suspend fun acceptInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) + + /** + * 忽略邀请入群(需管理员权限) + * + * @param event 邀请入群的事件对象 + */ + @JvmBlockingBridge + public suspend fun ignoreInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) + + + public companion object INSTANCE : Mirai by findMiraiInstance() +} + +/** + * 撤回这条消息. + * + * [Bot] 撤回自己的消息不需要权限, 但需要在发出后 2 分钟内撤回. + * [Bot] 撤回群员的消息需要管理员权限, 可在任意时间撤回. + * + * @throws PermissionDeniedException 当 [Bot] 无权限操作时 + * @see Mirai.recall + */ +@JvmSynthetic +public suspend inline fun Mirai.recall(bot: Bot, message: MessageChain): Unit = + this.recall(bot, message.source) + +internal expect fun findMiraiInstance(): Mirai \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/contact/Contact.kt b/mirai-core-api/src/commonMain/kotlin/contact/Contact.kt index d5350bcc0..d97eded06 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/Contact.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/Contact.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "NOTHING_TO_INLINE", "EXPERIMENTAL_OVERRIDE") @@ -13,21 +13,18 @@ package net.mamoe.mirai.contact import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Job import net.mamoe.mirai.Bot import net.mamoe.mirai.JavaFriendlyAPI +import net.mamoe.mirai.Mirai import net.mamoe.mirai.event.events.* import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.data.* import net.mamoe.mirai.message.quote import net.mamoe.mirai.message.recall import net.mamoe.mirai.recall -import net.mamoe.mirai.recallIn import net.mamoe.mirai.utils.ExternalImage import net.mamoe.mirai.utils.OverFileSizeMaxException import net.mamoe.mirai.utils.WeakRefProperty -import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext import kotlin.jvm.JvmSynthetic @@ -35,7 +32,7 @@ import kotlin.jvm.JvmSynthetic * 联系对象, 即可以与 [Bot] 互动的对象. 包含 [用户][User], 和 [群][Group]. */ @Suppress("EXPOSED_SUPER_CLASS") -public abstract class Contact : ContactOrBot, CoroutineScope, ContactJavaFriendlyAPI { +public abstract class Contact : ContactOrBot, CoroutineScope { /** * 这个联系对象所属 [Bot]. */ @@ -99,33 +96,13 @@ public abstract class Contact : ContactOrBot, CoroutineScope, ContactJavaFriendl } /** - * @see Bot.recall + * @see Mirai.recall */ @JvmSynthetic -public suspend inline fun Contact.recall(source: MessageChain): Unit = this.bot.recall(source) +public suspend inline fun Contact.recall(source: MessageChain): Unit = Mirai.recall(bot, source) /** - * @see Bot.recall + * @see Mirai.recall */ @JvmSynthetic -public suspend inline fun Contact.recall(source: MessageSource): Unit = this.bot.recall(source) - -/** - * @see Bot.recallIn - */ -@JvmSynthetic -public inline fun Contact.recallIn( - message: MessageChain, - millis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = this.bot.recallIn(message, millis, coroutineContext) - -/** - * @see Bot.recallIn - */ -@JvmSynthetic -public inline fun Contact.recallIn( - source: MessageSource, - millis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = this.bot.recallIn(source, millis, coroutineContext) \ No newline at end of file +public suspend inline fun Contact.recall(source: MessageSource): Unit = Mirai.recall(bot, source) \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/contact/ContactList.kt b/mirai-core-api/src/commonMain/kotlin/contact/ContactList.kt index c4175e078..6be74c496 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/ContactList.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/ContactList.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused") diff --git a/mirai-core-api/src/commonMain/kotlin/contact/ContactOrBot.kt b/mirai-core-api/src/commonMain/kotlin/contact/ContactOrBot.kt index 37f763f1f..a1b7d4fb8 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/ContactOrBot.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/ContactOrBot.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.contact diff --git a/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt b/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt index 2388674c2..aa0efa7e2 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/Exceptions.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") diff --git a/mirai-core-api/src/commonMain/kotlin/contact/Friend.kt b/mirai-core-api/src/commonMain/kotlin/contact/Friend.kt index fc6199e0e..38b4b6fb5 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/Friend.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/Friend.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "UnusedImport") @@ -23,7 +23,7 @@ import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.PlainText import net.mamoe.mirai.message.data.isContentEmpty import net.mamoe.mirai.message.recall -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai import kotlin.jvm.JvmSynthetic @@ -82,7 +82,7 @@ public abstract class Friend : User(), CoroutineScope { * * @see FriendNudge.sendTo 发送这个戳一戳消息 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("1.3.0") public final override fun nudge(): FriendNudge = FriendNudge(this) diff --git a/mirai-core-api/src/commonMain/kotlin/contact/Group.kt b/mirai-core-api/src/commonMain/kotlin/contact/Group.kt index 359a0932e..08dafe339 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/Group.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/Group.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "UnusedImport") @@ -15,7 +15,7 @@ import kotlinx.coroutines.CoroutineScope import net.mamoe.kjbb.JvmBlockingBridge import net.mamoe.mirai.Bot import net.mamoe.mirai.JavaFriendlyAPI -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi import net.mamoe.mirai.data.MemberInfo import net.mamoe.mirai.event.events.* import net.mamoe.mirai.message.MessageReceipt @@ -63,7 +63,7 @@ public abstract class Group : Contact(), CoroutineScope { /** * [Bot] 在群内的 [Member] 实例 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public abstract val botAsMember: Member /** @@ -127,8 +127,8 @@ public abstract class Group : Contact(), CoroutineScope { * 构造一个 [Member]. * 非特殊情况请不要使用这个函数. 优先使用 [get]. */ - @LowLevelAPI - @MiraiExperimentalAPI("dangerous") + @LowLevelApi + @MiraiExperimentalApi("dangerous") public abstract fun newMember(memberInfo: MemberInfo): Member /** @@ -184,7 +184,7 @@ public abstract class Group : Contact(), CoroutineScope { * @throws OverFileSizeMaxException 当语音文件过大而被服务器拒绝上传时. (最大大小约为 1 MB) */ @JvmBlockingBridge - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("1.2.0") public abstract suspend fun uploadVoice(input: InputStream): Voice @@ -194,7 +194,7 @@ public abstract class Group : Contact(), CoroutineScope { * 使用 groupCode 计算 groupUin. 这两个值仅在 mirai 内部协议区分, 一般人使用时无需在意. * @suppress internal api */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @JvmStatic public fun calculateGroupUinByGroupCode(groupCode: Long): Long = CommonGroupCalculations.calculateGroupUinByGroupCode(groupCode) @@ -203,7 +203,7 @@ public abstract class Group : Contact(), CoroutineScope { * 使用 groupUin 计算 groupCode. 这两个值仅在 mirai 内部协议区分, 一般人使用时无需在意. * @suppress internal api */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @JvmStatic public fun calculateGroupCodeByGroupUin(groupUin: Long): Long = CommonGroupCalculations.calculateGroupCodeByGroupUin(groupUin) @@ -269,7 +269,7 @@ public interface GroupSettings { /** * 自动加群审批 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public val isAutoApproveEnabled: Boolean /** diff --git a/mirai-core-api/src/commonMain/kotlin/contact/JavaFriendly.common.kt b/mirai-core-api/src/commonMain/kotlin/contact/JavaFriendly.common.kt deleted file mode 100644 index e315e3050..000000000 --- a/mirai-core-api/src/commonMain/kotlin/contact/JavaFriendly.common.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 net.mamoe.mirai.contact - -import net.mamoe.mirai.JavaFriendlyAPI - -/** - * [Contact] 中为了让 `Java` 更容易调用的 API. - * 不要用它作为一个类型, 只应使用其中的方法 - */ -@JavaFriendlyAPI -internal expect interface ContactJavaFriendlyAPI - -/** - * [Member] 中为了让 `Java` 更容易调用的 API - * 不要用它作为一个类型, 只应使用其中的方法 - */ -@Suppress("DEPRECATION_ERROR") -@JavaFriendlyAPI -internal expect interface MemberJavaFriendlyAPI \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/contact/Member.kt b/mirai-core-api/src/commonMain/kotlin/contact/Member.kt index f336fce9e..775a10e2f 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/Member.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/Member.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "UnusedImport") @@ -22,7 +22,7 @@ import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.PlainText import net.mamoe.mirai.message.data.isContentEmpty import net.mamoe.mirai.message.recall -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.WeakRefProperty import kotlin.jvm.JvmSynthetic @@ -40,7 +40,7 @@ import kotlin.time.ExperimentalTime */ @Suppress("INAPPLICABLE_JVM_NAME", "EXPOSED_SUPER_CLASS") @OptIn(JavaFriendlyAPI::class) -public abstract class Member : MemberJavaFriendlyAPI, User() { +public abstract class Member : User() { /** * 所在的群. */ @@ -166,7 +166,7 @@ public abstract class Member : MemberJavaFriendlyAPI, User() { * * @see MemberNudge.sendTo 发送这个戳一戳消息 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("1.3.0") public final override fun nudge(): Nudge = MemberNudge(this) diff --git a/mirai-core-api/src/commonMain/kotlin/contact/MemberPermission.kt b/mirai-core-api/src/commonMain/kotlin/contact/MemberPermission.kt index df2add4fa..1e58b5473 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/MemberPermission.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/MemberPermission.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core-api/src/commonMain/kotlin/contact/User.kt b/mirai-core-api/src/commonMain/kotlin/contact/User.kt index 5a8d81aa1..77a07e42f 100644 --- a/mirai-core-api/src/commonMain/kotlin/contact/User.kt +++ b/mirai-core-api/src/commonMain/kotlin/contact/User.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused") @@ -23,7 +23,7 @@ import net.mamoe.mirai.message.data.PlainText import net.mamoe.mirai.message.data.isContentEmpty import net.mamoe.mirai.message.recall import net.mamoe.mirai.utils.ExternalImage -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.OverFileSizeMaxException import net.mamoe.mirai.utils.SinceMirai import kotlin.jvm.JvmSynthetic @@ -89,7 +89,7 @@ public abstract class User : Contact(), CoroutineScope { * * @see FriendNudge.sendTo 发送这个戳一戳消息 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("1.3.0") public abstract fun nudge(): Nudge diff --git a/mirai-core-api/src/commonMain/kotlin/data/FriendInfo.kt b/mirai-core-api/src/commonMain/kotlin/data/FriendInfo.kt index 2a9fa1f6b..efb98b480 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/FriendInfo.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/FriendInfo.kt @@ -1,17 +1,17 @@ /* * 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. + * 此源代码的使用受 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.data -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi -@LowLevelAPI +@LowLevelApi public interface FriendInfo { public val uin: Long diff --git a/mirai-core-api/src/commonMain/kotlin/data/GroupActiveData.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupActiveData.kt index 8a2d08313..3cdc9d77b 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/GroupActiveData.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/GroupActiveData.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.data @@ -12,13 +12,13 @@ package net.mamoe.mirai.data import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi /** * 群统计信息 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @Serializable public data class GroupActiveData( diff --git a/mirai-core-api/src/commonMain/kotlin/data/GroupAnnouncement.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupAnnouncement.kt index 91311c7bf..ccdc72f4e 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/GroupAnnouncement.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/GroupAnnouncement.kt @@ -1,17 +1,17 @@ /* * 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. + * 此源代码的使用受 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.data import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi /** * 群公告数据类 @@ -20,7 +20,7 @@ import net.mamoe.mirai.utils.MiraiExperimentalAPI * 发公告时只需要填写text,其他参数可为默认值 * */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @Serializable public data class GroupAnnouncementList( val ec: Int, //状态码 0 是正常的 @@ -29,7 +29,7 @@ public data class GroupAnnouncementList( val inst: List? = null //置顶列表? ) -@MiraiExperimentalAPI +@MiraiExperimentalApi @Serializable public data class GroupAnnouncement( @SerialName("u") val sender: Long = 0, @@ -42,7 +42,7 @@ public data class GroupAnnouncement( val fid: String? = null //公告的id ) -@MiraiExperimentalAPI +@MiraiExperimentalApi @Serializable public data class GroupAnnouncementMsg( val text: String, @@ -50,7 +50,7 @@ public data class GroupAnnouncementMsg( val title: String? = null ) -@MiraiExperimentalAPI +@MiraiExperimentalApi @Serializable public data class GroupAnnouncementSettings( @SerialName("is_show_edit_card") val isShowEditCard: Int = 0, diff --git a/mirai-core-api/src/commonMain/kotlin/data/GroupHonorListData.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupHonorListData.kt index 79f11792d..a8dbc2f3f 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/GroupHonorListData.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/GroupHonorListData.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.data import kotlinx.serialization.KSerializer @@ -9,14 +18,14 @@ import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai import kotlin.jvm.JvmStatic /** * 群荣誉信息 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public enum class GroupHonorType(public val value: Int) { TALKATIVE(1), // 龙王 @@ -27,13 +36,14 @@ public enum class GroupHonorType(public val value: Int) { ACTIVE(7), // 活跃头衔 EXCLUSIVE(8), // 特殊头衔 MANAGE(9); // 管理头衔 + internal companion object { @JvmStatic internal fun deserializeFromInt(value: Int): GroupHonorType = values().first { it.value == value } } } -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") @Serializable public data class GroupHonorListData( diff --git a/mirai-core-api/src/commonMain/kotlin/data/GroupInfo.kt b/mirai-core-api/src/commonMain/kotlin/data/GroupInfo.kt index be17801be..18a672f70 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/GroupInfo.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/GroupInfo.kt @@ -1,20 +1,20 @@ /* * 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. + * 此源代码的使用受 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.data -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi /** * 群资料. */ -@LowLevelAPI +@LowLevelApi public interface GroupInfo { /** * Uin diff --git a/mirai-core-api/src/commonMain/kotlin/data/MemberInfo.kt b/mirai-core-api/src/commonMain/kotlin/data/MemberInfo.kt index 078669675..59b72d2a4 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/MemberInfo.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/MemberInfo.kt @@ -1,18 +1,18 @@ /* * 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. + * 此源代码的使用受 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.data -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi import net.mamoe.mirai.contact.MemberPermission -@LowLevelAPI +@LowLevelApi public interface MemberInfo : FriendInfo { public val nameCard: String diff --git a/mirai-core-api/src/commonMain/kotlin/data/OnlineStatus.kt b/mirai-core-api/src/commonMain/kotlin/data/OnlineStatus.kt index d8f123d27..7566a3ccc 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/OnlineStatus.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/OnlineStatus.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") diff --git a/mirai-core-api/src/commonMain/kotlin/data/Profile.kt b/mirai-core-api/src/commonMain/kotlin/data/Profile.kt index ba63f0a6e..16bf73651 100644 --- a/mirai-core-api/src/commonMain/kotlin/data/Profile.kt +++ b/mirai-core-api/src/commonMain/kotlin/data/Profile.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE") diff --git a/mirai-core-api/src/commonMain/kotlin/event/Event.kt b/mirai-core-api/src/commonMain/kotlin/event/Event.kt index 45812ce58..f29dd9906 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/Event.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/Event.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") @@ -16,7 +16,7 @@ import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import net.mamoe.mirai.JavaFriendlyAPI import net.mamoe.mirai.event.internal.broadcastInternal -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.internal.runBlocking import kotlin.jvm.JvmField @@ -180,7 +180,7 @@ public fun E.__broadcastJava(): E = apply { * 设置为 `true` 以关闭事件. * 所有的 `subscribe` 都能正常添加到监听器列表, 但所有的广播都会直接返回. */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public var EventDisabled: Boolean = false /** diff --git a/mirai-core-api/src/commonMain/kotlin/event/MessageSubscribersBuilder.kt b/mirai-core-api/src/commonMain/kotlin/event/MessageSubscribersBuilder.kt index 3559a01a3..a4cfd3a41 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/MessageSubscribersBuilder.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/MessageSubscribersBuilder.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( diff --git a/mirai-core-api/src/commonMain/kotlin/event/deprecated.kt b/mirai-core-api/src/commonMain/kotlin/event/deprecated.kt index 92b89db4c..a753f76bd 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/deprecated.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/deprecated.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/EventCancelledException.kt b/mirai-core-api/src/commonMain/kotlin/event/events/EventCancelledException.kt index c3be0ea89..a70d87a3a 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/EventCancelledException.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/EventCancelledException.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event.events diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/bot.kt b/mirai-core-api/src/commonMain/kotlin/event/events/bot.kt index 9be045754..6d7f53559 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/bot.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/bot.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "FunctionName") @@ -17,10 +17,9 @@ import net.mamoe.mirai.Bot import net.mamoe.mirai.contact.* 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.MessageEvent -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.MiraiInternalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi +import net.mamoe.mirai.utils.MiraiInternalApi import net.mamoe.mirai.utils.SinceMirai import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName @@ -61,7 +60,7 @@ public sealed class BotOfflineEvent : BotEvent, AbstractEvent() { * 被服务器断开 */ @SinceMirai("1.1.0") - @MiraiInternalAPI("This is very experimental and might be changed") + @MiraiInternalApi("This is very experimental and might be changed") public data class MsfOffline internal constructor( public override val bot: Bot, public override val cause: Throwable? @@ -78,7 +77,7 @@ public sealed class BotOfflineEvent : BotEvent, AbstractEvent() { /** * 因 returnCode = -10008 等原因掉线 */ - @MiraiInternalAPI("This is very experimental and might be changed") + @MiraiInternalApi("This is very experimental and might be changed") @SinceMirai("1.2.0") public data class PacketFactory10008 internal constructor( public override val bot: Bot, @@ -88,13 +87,13 @@ public sealed class BotOfflineEvent : BotEvent, AbstractEvent() { /** * 服务器主动要求更换另一个服务器 */ - @MiraiInternalAPI + @MiraiInternalApi public data class RequireReconnect internal constructor( public override val bot: Bot ) : BotOfflineEvent(), Packet, BotPassiveEvent - @MiraiExperimentalAPI + @MiraiExperimentalApi public interface CauseAware { public val cause: Throwable? } @@ -128,11 +127,11 @@ public data class BotNickChangedEvent( ) : BotEvent, Packet, AbstractEvent() -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public sealed class BotNudgedEvent : AbstractEvent(), BotEvent, Packet { /** - * 戳一戳的发起人,为 [Bot] 的某一好友, 或某一群员, 或 [Bot.selfQQ] + * 戳一戳的发起人,为 [Bot] 的某一好友, 或某一群员, 或 [Bot.asFriend] */ public abstract val from: User @@ -142,7 +141,7 @@ public sealed class BotNudgedEvent : AbstractEvent(), BotEvent, Packet { /** 戳一戳中设置的自定义后缀 */ public abstract val suffix: String - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("2.0.0") /** [Bot] 在群聊中被戳 */ public sealed class InGroup : BotNudgedEvent(), GroupMemberEvent { @@ -178,7 +177,7 @@ public sealed class BotNudgedEvent : AbstractEvent(), BotEvent, Packet { } } - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("2.0.0") /** [Bot] 在私聊中被戳 */ public sealed class InPrivateSession : BotNudgedEvent(), FriendEvent { @@ -205,7 +204,7 @@ public sealed class BotNudgedEvent : AbstractEvent(), BotEvent, Packet { override val action: String, override val suffix: String ) : InPrivateSession() { - override val from: Friend get() = bot.selfQQ + override val from: Friend get() = bot.asFriend override fun toString(): String { return "BotNudgedEvent.InPrivateSession.ByBot(friend=$friend, action=$action, suffix=$suffix)" } @@ -246,7 +245,7 @@ public data class BotNudgedEvent internal constructor( * * @see MessageEvent.subject */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("2.0.0") public val BotNudgedEvent.subject: Contact get() = when (val inlineFrom = from) { diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt b/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt index 7a11e775c..10eadb60d 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/friend.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -15,6 +15,7 @@ package net.mamoe.mirai.event.events import net.mamoe.mirai.Bot import net.mamoe.mirai.JavaFriendlyAPI +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.User @@ -22,7 +23,7 @@ import net.mamoe.mirai.event.AbstractEvent 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.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.internal.runBlocking import kotlin.jvm.* @@ -97,10 +98,10 @@ public data class NewFriendRequestEvent internal constructor( public val fromGroup: Group? = if (fromGroupId == 0L) null else bot.getGroup(fromGroupId) @JvmSynthetic - public suspend fun accept(): Unit = bot.acceptNewFriendRequest(this) + public suspend fun accept(): Unit = Mirai.acceptNewFriendRequest(this) @JvmSynthetic - public suspend fun reject(blackList: Boolean = false): Unit = bot.rejectNewFriendRequest(this, blackList) + public suspend fun reject(blackList: Boolean = false): Unit = Mirai.rejectNewFriendRequest(this, blackList) @JavaFriendlyAPI @@ -149,10 +150,10 @@ public data class FriendInputStatusChangedEvent internal constructor( * 注: 此事件仅可能在私聊中发生 */ @SinceMirai("2.0.0") -@MiraiExperimentalAPI +@MiraiExperimentalApi public sealed class FriendNudgedEvent : AbstractEvent(), FriendEvent, Packet { /** - * 戳一戳的发起人, 为 [Bot] 的某一好友, 或是 [Bot.selfQQ] + * 戳一戳的发起人, 为 [Bot] 的某一好友, 或是 [Bot.asFriend] */ public abstract val from: Friend @@ -167,7 +168,7 @@ public sealed class FriendNudgedEvent : AbstractEvent(), FriendEvent, Packet { public abstract val suffix: String /** 在 [Bot] 与 [Friend] 的对话中 [Friend] 戳了自己事件 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public data class NudgedByHimself internal constructor( override val action: String, override val suffix: String, @@ -182,7 +183,7 @@ public sealed class FriendNudgedEvent : AbstractEvent(), FriendEvent, Packet { } /** [Bot] 戳了 [Friend] */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public data class NudgedByBot internal constructor( override val action: String, override val suffix: String, @@ -193,6 +194,6 @@ public sealed class FriendNudgedEvent : AbstractEvent(), FriendEvent, Packet { } override val from: Friend - get() = bot.selfQQ + get() = bot.asFriend } } diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/group.kt b/mirai-core-api/src/commonMain/kotlin/event/events/group.kt index e6ed888bd..cd4437920 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/group.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/group.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -15,6 +15,7 @@ package net.mamoe.mirai.event.events import net.mamoe.mirai.Bot import net.mamoe.mirai.JavaFriendlyAPI +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.Member @@ -24,7 +25,7 @@ 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.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.internal.runBlocking import kotlin.internal.LowPriorityInOverloadResolution @@ -39,7 +40,7 @@ public sealed class BotLeaveEvent : BotEvent, Packet, AbstractEvent() { /** * 机器人主动退出一个群. */ - @MiraiExperimentalAPI("目前此事件类型不一定正确. 部分被踢出情况也会广播此事件.") + @MiraiExperimentalApi("目前此事件类型不一定正确. 部分被踢出情况也会广播此事件.") public data class Active internal constructor( public override val group: Group ) : BotLeaveEvent() { @@ -49,7 +50,7 @@ public sealed class BotLeaveEvent : BotEvent, Packet, AbstractEvent() { /** * 机器人被管理员或群主踢出群. */ - @MiraiExperimentalAPI("BotLeaveEvent 的子类可能在将来改动. 使用 BotLeaveEvent 以保证兼容性.") + @MiraiExperimentalApi("BotLeaveEvent 的子类可能在将来改动. 使用 BotLeaveEvent 以保证兼容性.") public data class Kick internal constructor( public override val operator: Member ) : BotLeaveEvent(), @@ -107,7 +108,7 @@ public sealed class BotJoinGroupEvent : GroupEvent, BotPassiveEvent, Packet, Abs /** * 不确定. 可能是主动加入 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public data class Active internal constructor( public override val group: Group ) : BotJoinGroupEvent() { @@ -119,7 +120,7 @@ public sealed class BotJoinGroupEvent : GroupEvent, BotPassiveEvent, Packet, Abs * * 此时服务器基于 Bot 的 QQ 设置自动同意了请求. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public data class Invite internal constructor( /** * 邀请人 @@ -137,7 +138,7 @@ public sealed class BotJoinGroupEvent : GroupEvent, BotPassiveEvent, Packet, Abs * 原群主通过 https://huifu.qq.com/ 恢复原来群主身份并入群, * [Bot] 是原群主 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("1.3.0") public data class Retrieve internal constructor( public override val group: Group @@ -341,20 +342,20 @@ public data class BotInvitedJoinGroupRequestEvent internal constructor( internal val responded: MiraiAtomicBoolean = MiraiAtomicBoolean(false) @JvmSynthetic - public suspend fun accept(): Unit = bot.acceptInvitedJoinGroupRequest(this) + public suspend fun accept(): Unit = Mirai.acceptInvitedJoinGroupRequest(this) @JvmSynthetic - public suspend fun ignore(): Unit = bot.ignoreInvitedJoinGroupRequest(this) + public suspend fun ignore(): Unit = Mirai.ignoreInvitedJoinGroupRequest(this) @JavaFriendlyAPI @JvmName("accept") public fun __acceptBlockingForJava__(): Unit = - runBlocking { bot.acceptInvitedJoinGroupRequest(this@BotInvitedJoinGroupRequestEvent) } + runBlocking { Mirai.acceptInvitedJoinGroupRequest(this@BotInvitedJoinGroupRequestEvent) } @JavaFriendlyAPI @JvmName("ignore") public fun __ignoreBlockingForJava__(): Unit = - runBlocking { bot.ignoreInvitedJoinGroupRequest(this@BotInvitedJoinGroupRequestEvent) } + runBlocking { Mirai.ignoreInvitedJoinGroupRequest(this@BotInvitedJoinGroupRequestEvent) } } /** @@ -385,36 +386,37 @@ public data class MemberJoinRequestEvent internal constructor( public val group: Group get() = this.bot.getGroup(groupId) @JvmField + @PublishedApi internal val responded: MiraiAtomicBoolean = MiraiAtomicBoolean(false) @JvmSynthetic - public suspend fun accept(): Unit = bot.acceptMemberJoinRequest(this) + public suspend fun accept(): Unit = Mirai.acceptMemberJoinRequest(this) @JvmSynthetic @JvmOverloads public suspend fun reject(blackList: Boolean = false, message: String = ""): Unit = - bot.rejectMemberJoinRequest(this, blackList, message) + Mirai.rejectMemberJoinRequest(this, blackList, message) @JvmSynthetic - public suspend fun ignore(blackList: Boolean = false): Unit = bot.ignoreMemberJoinRequest(this, blackList) + public suspend fun ignore(blackList: Boolean = false): Unit = Mirai.ignoreMemberJoinRequest(this, blackList) @JavaFriendlyAPI @JvmName("accept") public fun __acceptBlockingForJava__(): Unit = - runBlocking { bot.acceptMemberJoinRequest(this@MemberJoinRequestEvent) } + runBlocking { Mirai.acceptMemberJoinRequest(this@MemberJoinRequestEvent) } @JavaFriendlyAPI @JvmOverloads @JvmName("reject") public fun __rejectBlockingForJava__(blackList: Boolean = false, message: String = ""): Unit = - runBlocking { bot.rejectMemberJoinRequest(this@MemberJoinRequestEvent, blackList, message) } + runBlocking { Mirai.rejectMemberJoinRequest(this@MemberJoinRequestEvent, blackList, message) } @JavaFriendlyAPI @JvmOverloads @JvmName("ignore") public fun __ignoreBlockingForJava__(blackList: Boolean = false): Unit = - runBlocking { bot.ignoreMemberJoinRequest(this@MemberJoinRequestEvent, blackList) } + runBlocking { Mirai.ignoreMemberJoinRequest(this@MemberJoinRequestEvent, blackList) } } // endregion @@ -518,7 +520,7 @@ public data class MemberUnmuteEvent internal constructor( /** * [Member] 被 [戳][Nudge] 的事件. */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public data class MemberNudgedEvent internal constructor( /** diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/message.kt b/mirai-core-api/src/commonMain/kotlin/event/events/message.kt index 98f4fddfc..8bb6143cd 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/message.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/message.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -314,7 +314,7 @@ public sealed class MessageRecallEvent : BotEvent, AbstractEvent() { /** * 群消息撤回事件. */ - public data class GroupRecall internal constructor( + public data class GroupRecall @PublishedApi internal constructor( public override val bot: Bot, public override val authorId: Long, public override val messageId: Int, diff --git a/mirai-core-api/src/commonMain/kotlin/event/events/types.kt b/mirai-core-api/src/commonMain/kotlin/event/events/types.kt index 2ca71a2cd..bd1457cb4 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/events/types.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/events/types.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") diff --git a/mirai-core-api/src/commonMain/kotlin/event/internal/InternalEventListeners.kt b/mirai-core-api/src/commonMain/kotlin/event/internal/InternalEventListeners.kt index ae9dc5aed..4a10e94c9 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/internal/InternalEventListeners.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/internal/InternalEventListeners.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event.internal @@ -116,6 +116,7 @@ internal expect object GlobalEventListeners { operator fun get(priority: Listener.EventPriority): LockFreeLinkedList } +@PublishedApi internal expect class MiraiAtomicBoolean(initial: Boolean) { fun compareAndSet(expect: Boolean, update: Boolean): Boolean diff --git a/mirai-core-api/src/commonMain/kotlin/event/internal/messageSubscribersInternal.kt b/mirai-core-api/src/commonMain/kotlin/event/internal/messageSubscribersInternal.kt index c45ca3690..6784bb78d 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/internal/messageSubscribersInternal.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/internal/messageSubscribersInternal.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event.internal diff --git a/mirai-core-api/src/commonMain/kotlin/event/linear.kt b/mirai-core-api/src/commonMain/kotlin/event/linear.kt index eda1c9dab..3f8c47502 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/linear.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/linear.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") diff --git a/mirai-core-api/src/commonMain/kotlin/event/nextEvent.kt b/mirai-core-api/src/commonMain/kotlin/event/nextEvent.kt index 566d32c2a..60ed49ceb 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/nextEvent.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/nextEvent.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core-api/src/commonMain/kotlin/event/select.kt b/mirai-core-api/src/commonMain/kotlin/event/select.kt index c74a06ef6..055432866 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/select.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/select.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DuplicatedCode") @@ -17,7 +17,7 @@ import net.mamoe.mirai.message.data.Message import net.mamoe.mirai.message.data.PlainText import net.mamoe.mirai.message.isContextIdenticalWith import net.mamoe.mirai.message.nextMessage -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import kotlin.jvm.JvmName import kotlin.jvm.JvmSynthetic @@ -68,7 +68,7 @@ public suspend inline fun T.whileSelectMessages( /** * [selectMessages] 的 [Unit] 返回值捷径 (由于 Kotlin 无法推断 [Unit] 类型) */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @JvmName("selectMessages1") public suspend inline fun T.selectMessagesUnit( timeoutMillis: Long = -1, diff --git a/mirai-core-api/src/commonMain/kotlin/event/subscribeMessages.kt b/mirai-core-api/src/commonMain/kotlin/event/subscribeMessages.kt index 3381a018a..ff5a09558 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/subscribeMessages.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/subscribeMessages.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/event/subscriber.kt b/mirai-core-api/src/commonMain/kotlin/event/subscriber.kt index 6723a35df..a24cb34f2 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/subscriber.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/subscriber.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core-api/src/commonMain/kotlin/event/subscriberDeprecated.kt b/mirai-core-api/src/commonMain/kotlin/event/subscriberDeprecated.kt index 8f4a5c490..38e8e22c1 100644 --- a/mirai-core-api/src/commonMain/kotlin/event/subscriberDeprecated.kt +++ b/mirai-core-api/src/commonMain/kotlin/event/subscriberDeprecated.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "DEPRECATION", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core-api/src/commonMain/kotlin/qqandroid.network/Packet.kt b/mirai-core-api/src/commonMain/kotlin/internal/network/Packet.kt similarity index 58% rename from mirai-core-api/src/commonMain/kotlin/qqandroid.network/Packet.kt rename to mirai-core-api/src/commonMain/kotlin/internal/network/Packet.kt index 895f29039..97d2d3fb2 100644 --- a/mirai-core-api/src/commonMain/kotlin/qqandroid.network/Packet.kt +++ b/mirai-core-api/src/commonMain/kotlin/internal/network/Packet.kt @@ -1,16 +1,16 @@ /* * 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. + * 此源代码的使用受 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.internal.network import net.mamoe.mirai.event.Event -import net.mamoe.mirai.utils.MiraiInternalAPI +import net.mamoe.mirai.utils.MiraiInternalApi /** * 从服务器收到的包解析之后的结构化数据. @@ -18,17 +18,17 @@ import net.mamoe.mirai.utils.MiraiInternalAPI * * **InternalAPI**: 这是内部 API, 它随时都有可能被修改 */ -@MiraiInternalAPI +@MiraiInternalApi public interface Packet { /** * 实现这个接口的包将不会被记录到日志中 */ - @MiraiInternalAPI + @MiraiInternalApi public interface NoLog /** * 实现这个接口的 [Event] 不会被作为事件记录到日志中 */ - @MiraiInternalAPI + @MiraiInternalApi public interface NoEventLog } diff --git a/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt b/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt index ea0b20217..60a71ec9e 100644 --- a/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt +++ b/mirai-core-api/src/commonMain/kotlin/javaFriendly.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 @@ -15,17 +15,4 @@ package net.mamoe.mirai */ @RequiresOptIn(level = RequiresOptIn.Level.ERROR) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.TYPE, AnnotationTarget.CLASS) -internal annotation class JavaFriendlyAPI - -/** - * [Bot] 中为了让 Java 使用者调用更方便的 API 列表. - * - * **注意**: 不应该把这个类作为一个类型, 只应使用其中的方法 - */ -@Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "unused") -internal expect interface BotJavaFriendlyAPI - -// 保留多平台结构, 以避免在 Android 和 JVM 都定义这个类 -// 待 https://youtrack.jetbrains.com/issue/KT-27801 实现后修改为 hierarchical MPP 架构 - -// 待 https://youtrack.jetbrains.com/issue/KT-36740 修复后添加 Future 相关 API 到 hierarchical MPP 架构中 \ No newline at end of file +internal annotation class JavaFriendlyAPI \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/lowLevelApi.kt b/mirai-core-api/src/commonMain/kotlin/lowLevelApi.kt index 050b1f859..d50b42640 100644 --- a/mirai-core-api/src/commonMain/kotlin/lowLevelApi.kt +++ b/mirai-core-api/src/commonMain/kotlin/lowLevelApi.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 @@ -13,7 +13,7 @@ import kotlinx.coroutines.Job import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Group import net.mamoe.mirai.data.* -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai import net.mamoe.mirai.utils.WeakRef @@ -24,10 +24,11 @@ import net.mamoe.mirai.utils.WeakRef * 使用低级的 API 无法带来任何安全和便捷保障. * 仅在某些使用结构化 API 可能影响性能的情况下使用这些低级 API. */ +@MiraiExperimentalApi @RequiresOptIn @Retention(AnnotationRetention.BINARY) @Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) -public annotation class LowLevelAPI +public annotation class LowLevelApi /** * [Bot] 相关协议层低级 API. @@ -36,24 +37,24 @@ public annotation class LowLevelAPI * * **警告**: 所有的低级 API 都可能在任意时刻不经过任何警告和迭代就被修改. 因此非常不建议在任何情况下使用这些 API. */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @Suppress("FunctionName", "unused") -@LowLevelAPI -public interface LowLevelBotAPIAccessor { +@LowLevelApi +public interface LowLevelApiAccessor { /** * 构造一个 [Friend] 对象. 它持有对 [Bot] 的弱引用([WeakRef]). * * [Bot] 无法管理这个对象, 但这个对象会以 [Bot] 的 [Job] 作为父 Job. * 因此, 当 [Bot] 被关闭后, 这个对象也会被关闭. */ - @LowLevelAPI - public fun _lowLevelNewFriend(friendInfo: FriendInfo): Friend + @LowLevelApi + public fun _lowLevelNewFriend(bot: Bot, friendInfo: FriendInfo): Friend /** * 向服务器查询群列表. 返回值高 32 bits 为 uin, 低 32 bits 为 groupCode */ - @LowLevelAPI - public suspend fun _lowLevelQueryGroupList(): Sequence + @LowLevelApi + public suspend fun _lowLevelQueryGroupList(bot: Bot): Sequence /** * 向服务器查询群成员列表. @@ -63,8 +64,9 @@ public interface LowLevelBotAPIAccessor { * * @see Group.calculateGroupUinByGroupCode 使用 groupCode 计算 groupUin */ - @LowLevelAPI + @LowLevelApi public suspend fun _lowLevelQueryGroupMemberList( + bot: Bot, groupUin: Long, groupCode: Long, ownerId: Long @@ -74,35 +76,47 @@ public interface LowLevelBotAPIAccessor { * 获取群公告列表 * @param page 页码 */ - @LowLevelAPI - @MiraiExperimentalAPI - public suspend fun _lowLevelGetAnnouncements(groupId: Long, page: Int = 1, amount: Int = 10): GroupAnnouncementList + @LowLevelApi + @MiraiExperimentalApi + public suspend fun _lowLevelGetAnnouncements( + bot: Bot, + groupId: Long, page: Int = 1, amount: Int = 10 + ): GroupAnnouncementList /** * 发送群公告 * * @return 公告的fid */ - @LowLevelAPI - @MiraiExperimentalAPI - public suspend fun _lowLevelSendAnnouncement(groupId: Long, announcement: GroupAnnouncement): String + @LowLevelApi + @MiraiExperimentalApi + public suspend fun _lowLevelSendAnnouncement( + bot: Bot, + groupId: Long, announcement: GroupAnnouncement + ): String /** * 删除群公告 * @param fid [GroupAnnouncement.fid] */ - @LowLevelAPI - @MiraiExperimentalAPI - public suspend fun _lowLevelDeleteAnnouncement(groupId: Long, fid: String) + @LowLevelApi + @MiraiExperimentalApi + public suspend fun _lowLevelDeleteAnnouncement( + bot: Bot, + groupId: Long, fid: String + ) /** * 获取一条群公告 * @param fid [GroupAnnouncement.fid] */ - @LowLevelAPI - @MiraiExperimentalAPI - public suspend fun _lowLevelGetAnnouncement(groupId: Long, fid: String): GroupAnnouncement + @LowLevelApi + @MiraiExperimentalApi + public suspend fun _lowLevelGetAnnouncement( + bot: Bot, + groupId: Long, fid: String + ): GroupAnnouncement /** @@ -110,25 +124,30 @@ public interface LowLevelBotAPIAccessor { * 不传page可得到趋势图 * page从0开始传入可以得到发言列表 */ - @LowLevelAPI - @MiraiExperimentalAPI - public suspend fun _lowLevelGetGroupActiveData(groupId: Long, page: Int = -1): GroupActiveData + @LowLevelApi + @MiraiExperimentalApi + public suspend fun _lowLevelGetGroupActiveData(bot: Bot, groupId: Long, page: Int = -1): GroupActiveData /** * 获取群荣誉信息 */ @SinceMirai("1.3.0") - @LowLevelAPI - @MiraiExperimentalAPI - public suspend fun _lowLevelGetGroupHonorListData(groupId: Long, type: GroupHonorType): GroupHonorListData? + @LowLevelApi + @MiraiExperimentalApi + public suspend fun _lowLevelGetGroupHonorListData( + bot: Bot, + groupId: Long, + type: GroupHonorType + ): GroupHonorListData? /** * 处理一个账号请求添加机器人为好友的事件 */ - @LowLevelAPI + @LowLevelApi public suspend fun _lowLevelSolveNewFriendRequestEvent( + bot: Bot, eventId: Long, fromId: Long, fromNick: String, @@ -139,8 +158,9 @@ public interface LowLevelBotAPIAccessor { /** * 处理被邀请加入一个群请求事件 */ - @LowLevelAPI + @LowLevelApi public suspend fun _lowLevelSolveBotInvitedJoinGroupRequestEvent( + bot: Bot, eventId: Long, invitorId: Long, groupId: Long, @@ -150,9 +170,10 @@ public interface LowLevelBotAPIAccessor { /** * 处理账号请求加入群事件 */ - @LowLevelAPI + @LowLevelApi @SinceMirai("1.2.0") public suspend fun _lowLevelSolveMemberJoinRequestEvent( + bot: Bot, eventId: Long, fromId: Long, fromNick: String, @@ -165,9 +186,10 @@ public interface LowLevelBotAPIAccessor { /** * 查询语音的下载连接 */ - @LowLevelAPI + @LowLevelApi @SinceMirai("1.2.0") public suspend fun _lowLevelQueryGroupVoiceDownloadUrl( + bot: Bot, md5: ByteArray, groupId: Long, dstUin: Long @@ -176,9 +198,10 @@ public interface LowLevelBotAPIAccessor { /** * 查询语音的上传连接 */ - @LowLevelAPI + @LowLevelApi @SinceMirai("1.2.0") public suspend fun _lowLevelUploadVoice( + bot: Bot, md5: ByteArray, groupId: Long, ) diff --git a/mirai-core-api/src/commonMain/kotlin/message/FriendMessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/FriendMessageEvent.kt index e4b45490d..86b1557a7 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/FriendMessageEvent.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/FriendMessageEvent.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DEPRECATION_ERROR") diff --git a/mirai-core-api/src/commonMain/kotlin/message/GroupMessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/GroupMessageEvent.kt index d2ead40ff..b8861b249 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/GroupMessageEvent.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/GroupMessageEvent.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DEPRECATION_ERROR", "unused", "NOTHING_TO_INLINE", "MemberVisibilityCanBePrivate") diff --git a/mirai-core-api/src/commonMain/kotlin/message/MessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/MessageEvent.kt index 6a658c9a6..29f26b117 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/MessageEvent.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/MessageEvent.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( diff --git a/mirai-core-api/src/commonMain/kotlin/message/MessageReceipt.kt b/mirai-core-api/src/commonMain/kotlin/message/MessageReceipt.kt index 554325ebc..a741f2d86 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/MessageReceipt.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/MessageReceipt.kt @@ -1,27 +1,20 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE", "FunctionName", "unused") package net.mamoe.mirai.message -import kotlinx.coroutines.Job -import net.mamoe.mirai.Bot -import net.mamoe.mirai.JavaFriendlyAPI +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.* import net.mamoe.mirai.message.data.* -import net.mamoe.mirai.recallIn -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.internal.runBlocking -import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext -import kotlin.jvm.JvmName +import net.mamoe.mirai.utils.MiraiExperimentalApi import kotlin.jvm.JvmSynthetic /** @@ -41,7 +34,7 @@ import kotlin.jvm.JvmSynthetic * @see MessageReceipt.sourceId 源 id * @see MessageReceipt.sourceTime 源时间 */ -public open class MessageReceipt @MiraiExperimentalAPI("The constructor is subject to change.") constructor( +public open class MessageReceipt @MiraiExperimentalApi("The constructor is subject to change.") constructor( /** * 指代发送出去的消息. */ @@ -54,94 +47,25 @@ public open class MessageReceipt @MiraiExperimentalAPI("The con /** * @see Group.botAsMember */ - @MiraiExperimentalAPI("This is subject to change.") + @MiraiExperimentalApi("This is subject to change.") public val botAsMember: Member? ) { /** * 是否为发送给群的消息的回执 */ public val isToGroup: Boolean get() = target is Group - - /** - * 引用这条消息并回复. - * - * 仅供 Java 使用. - * - * 仅供 Java 使用: `MessageReceipt.quoteReply(message)` - */ - @JavaFriendlyAPI - @JvmName("quoteReply") - public fun __quoteReplyBlockingForJava__(message: Message): MessageReceipt { - return runBlocking { return@runBlocking quoteReply(message) } - } - - /** - * 引用这条消息并回复. - * - * 仅供 Java 使用: `MessageReceipt.quoteReply(message)` - */ - @JavaFriendlyAPI - @JvmName("quoteReply") - public fun __quoteReplyBlockingForJava__(message: String): MessageReceipt { - return runBlocking { quoteReply(message) } - } - - /** - * 撤回这条消息. [recall] 或 [recallIn] 只能被调用一次. - * - * 仅供 Java 使用: `MessageReceipt.recall()` - */ - @JavaFriendlyAPI - @JvmName("recall") - public fun __recallBlockingForJava__() { - return runBlocking { recall() } - } - - /** - * 撤回这条消息. [recall] 或 [recallIn] 只能被调用一次. - * - * 仅供 Java 使用: `MessageReceipt.recallIn(timeMillis)` - */ - @JavaFriendlyAPI - @JvmName("recallIn") - public fun __recallInBlockingForJava__(timeMillis: Long): Job { - return recallIn(timeMillis = timeMillis) - } - - /** - * 引用这条消息. - * - * 仅供 Java 使用: `MessageReceipt.quote()` - */ - @JavaFriendlyAPI - @JvmName("quote") - public fun __quoteBlockingForJava__(): QuoteReply { - return this.quote() - } } /** * 撤回这条消息. [recall] 或 [recallIn] 只能被调用一次. * - * @see Bot.recall + * @see Mirai.recall * @throws IllegalStateException 当此消息已经被撤回或正计划撤回时 */ public suspend inline fun MessageReceipt<*>.recall() { - return target.bot.recall(source) + return Mirai.recall(target.bot, source) } -/** - * 在一段时间后撤回这条消息. [recall] 或 [recallIn] 只能被调用一次. - * - * @param timeMillis 延迟时间, 单位为毫秒 - * @throws IllegalStateException 当此消息已经被撤回或正计划撤回时 - */ -public inline fun MessageReceipt<*>.recallIn( - timeMillis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = source.recallIn(timeMillis, coroutineContext) - - /** * 引用这条消息. * @see MessageChain.quote 引用一条消息 diff --git a/mirai-core-api/src/commonMain/kotlin/message/TempMessageEvent.kt b/mirai-core-api/src/commonMain/kotlin/message/TempMessageEvent.kt index 333723a44..12196acaf 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/TempMessageEvent.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/TempMessageEvent.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DEPRECATION_ERROR", "unused", "NOTHING_TO_INLINE") diff --git a/mirai-core-api/src/commonMain/kotlin/message/action/Nudge.kt b/mirai-core-api/src/commonMain/kotlin/message/action/Nudge.kt index 078a5d39b..05fb37ce9 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/action/Nudge.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/action/Nudge.kt @@ -1,21 +1,22 @@ /* * 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. + * 此源代码的使用受 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 import net.mamoe.kjbb.JvmBlockingBridge import net.mamoe.mirai.Bot +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.* import net.mamoe.mirai.event.events.BotNudgedEvent import net.mamoe.mirai.event.events.MemberNudgedEvent import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.SinceMirai /** @@ -26,7 +27,7 @@ import net.mamoe.mirai.utils.SinceMirai * @see User.nudge 创建 [Nudge] 对象 * @see Bot.nudge 创建 [Nudge] 对象 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public sealed class Nudge { /** @@ -49,10 +50,10 @@ public sealed class Nudge { * @return 成功发送时为 `true`. 若对方禁用 "戳一戳" 功能, 返回 `false`. */ @JvmBlockingBridge - @MiraiExperimentalAPI + @MiraiExperimentalApi public suspend fun sendTo(receiver: Contact): Boolean { @Suppress("DEPRECATION_ERROR") - return receiver.bot.sendNudge(this, receiver) + return Mirai.sendNudge(receiver.bot, this, receiver) } public companion object { @@ -68,7 +69,7 @@ public sealed class Nudge { * * @return 成功发送时为 `true`. 若对方禁用 "戳一戳" 功能, 返回 `false`. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @JvmBlockingBridge public suspend fun Contact.sendNudge(nudge: Nudge): Boolean = nudge.sendTo(this) } @@ -78,7 +79,7 @@ public sealed class Nudge { * @see Bot.nudge * @see Nudge */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public data class BotNudge( public override val target: Bot @@ -88,7 +89,7 @@ public data class BotNudge( * @see User.nudge * @see Nudge */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public sealed class UserNudge : Nudge() { public abstract override val target: User @@ -98,7 +99,7 @@ public sealed class UserNudge : Nudge() { * @see Member.nudge * @see Nudge */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public data class MemberNudge( public override val target: Member @@ -108,7 +109,7 @@ public data class MemberNudge( * @see Friend.nudge * @see Nudge */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.3.0") public data class FriendNudge( public override val target: Friend diff --git a/mirai-core-api/src/commonMain/kotlin/message/code/CodableMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/code/CodableMessage.kt index 2260515f0..ff9ce934d 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/code/CodableMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/code/CodableMessage.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.code diff --git a/mirai-core-api/src/commonMain/kotlin/message/code/MiraiCode.kt b/mirai-core-api/src/commonMain/kotlin/message/code/MiraiCode.kt index c0c03aeca..97c93d657 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/code/MiraiCode.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/code/MiraiCode.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt b/mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt index cc2f43373..0b48344a6 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/code/internal/impl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER") diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/At.kt b/mirai-core-api/src/commonMain/kotlin/message/data/At.kt index 27bec7105..b6183cd3b 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/At.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/At.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -14,7 +14,7 @@ package net.mamoe.mirai.message.data -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi import net.mamoe.mirai.contact.Member import net.mamoe.mirai.contact.nameCardOrNick import net.mamoe.mirai.message.code.CodableMessage @@ -63,7 +63,7 @@ private constructor( */ @Suppress("FunctionName") @JvmStatic - @LowLevelAPI + @LowLevelApi public fun _lowLevelConstructAtInstance(target: Long, display: String): At = At(target, display) } diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/AtAll.kt b/mirai-core-api/src/commonMain/kotlin/message/data/AtAll.kt index 4b94e8e1e..766b056f6 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/AtAll.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/AtAll.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/CombinedMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/CombinedMessage.kt index 32640937c..fad811b69 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/CombinedMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/CombinedMessage.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt index cd8856442..b15f5e35f 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/CustomMessage.kt @@ -1,13 +1,13 @@ /* * 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. + * 此源代码的使用受 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 */ -@file:OptIn(MiraiInternalAPI::class) +@file:OptIn(MiraiInternalApi::class) package net.mamoe.mirai.message.data @@ -34,7 +34,7 @@ import kotlin.jvm.JvmOverloads * * @see CustomMessageMetadata 自定义消息元数据 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public sealed class CustomMessage : SingleMessage { /** * 获取这个消息的工厂 @@ -48,7 +48,7 @@ public sealed class CustomMessage : SingleMessage { * @see JsonSerializerFactory 使用 [Json] 作为序列模式的 [Factory] * @see ProtoBufSerializerFactory 使用 [ProtoBuf] 作为序列模式的 [Factory] */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public abstract class Factory( /** * 此类型消息的名称. @@ -172,7 +172,7 @@ public sealed class CustomMessage : SingleMessage { /** * 序列化这个消息 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @SinceMirai("1.1.0") public fun T.toByteArray(): ByteArray { @Suppress("UNCHECKED_CAST") @@ -190,7 +190,7 @@ public fun T.toByteArray(): ByteArray { * @see CustomMessage 查看更多信息 * @see ConstrainSingle 可实现此接口以保证消息链中只存在一个元素 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public abstract class CustomMessageMetadata : CustomMessage(), MessageMetadata { public companion object Key : Message.Key { override val typeName: String get() = "CustomMessageMetadata" diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt index d16c825b5..7b2dd5422 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/Face.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/ForwardMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/ForwardMessage.kt index c7ed6b55b..f7666de67 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/ForwardMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/ForwardMessage.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("MemberVisibilityCanBePrivate", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "unused") @@ -18,7 +18,7 @@ import net.mamoe.mirai.contact.User import net.mamoe.mirai.contact.nameCardOrNick import net.mamoe.mirai.message.MessageEvent import net.mamoe.mirai.message.data.ForwardMessage.DisplayStrategy -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.currentTimeSeconds import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmSynthetic @@ -182,7 +182,7 @@ public class ForwardMessage @JvmOverloads constructor( public override fun toString(): String = "[mirai:forward:$nodeList]" private val contentToString: String by lazy { nodeList.joinToString("\n") } - @MiraiExperimentalAPI + @MiraiExperimentalApi public override fun contentToString(): String = contentToString } diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt index 37653fbd8..d3579f2ce 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/HummerMessage.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NOTHING_TO_INLINE") diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt index aa0d5ee1a..7202ce65e 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/Image.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -17,15 +17,17 @@ "DEPRECATION", "UnusedImport", "EXPOSED_SUPER_CLASS", - "DEPRECATION_ERROR" + "DEPRECATION_ERROR", "NOTHING_TO_INLINE" ) package net.mamoe.mirai.message.data import net.mamoe.mirai.Bot +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.Contact import net.mamoe.mirai.message.code.CodableMessage import net.mamoe.mirai.utils.ExternalImage +import net.mamoe.mirai.utils.MiraiInternalApi import net.mamoe.mirai.utils.sendImage import kotlin.js.JsName import kotlin.jvm.JvmMultifileClass @@ -51,7 +53,7 @@ import kotlin.jvm.JvmSynthetic * * ### 下载图片 * @see Image.queryUrl 扩展函数. 查询图片下载链接 - * @see Bot.queryImageUrl 查询图片下载链接 (Java 使用) + * @see Mirai.queryImageUrl 查询图片下载链接 (Java 使用) * * 查看平台 `actual` 定义以获取上传方式扩展. * @@ -89,15 +91,20 @@ public expect interface Image : Message, MessageContent, CodableMessage { final override fun contentToString(): String = "[图片]" */ +} - @Deprecated( - """ - 不要自行实现 Image, 它必须由协议模块实现, 否则会无法发送也无法解析. - """, level = DeprecationLevel.HIDDEN - ) - @Suppress("PropertyName") - @get:JvmSynthetic - internal val DoNotImplementThisClass: Nothing? +/** + * 所有 [Image] 实现的基类. + */ +public abstract class AbstractImage : Image { // make sealed in 1.3.0 ? + private var _stringValue: String? = null + get() = field ?: kotlin.run { + field = "[mirai:image:$imageId]" + field + } + + final override fun toString(): String = _stringValue!! + final override fun contentToString(): String = "[图片]" } /** @@ -116,7 +123,8 @@ public val Image.md5: ByteArray * [imageId] 形如 `/f8f1ab55-bf8e-4236-b55e-955848d7069f` (37 长度) 或 `/000000000-3814297509-BFB7027B9354B8F899A062061D74E206` (54 长度) */ // NotOnlineImage -public abstract class FriendImage internal constructor() : AbstractImage() { // change to sealed in the future. +public abstract class FriendImage @MiraiInternalApi public constructor() : + AbstractImage() { // change to sealed in the future. public companion object Key : Message.Key { public override val typeName: String get() = "FriendImage" } @@ -129,7 +137,8 @@ public abstract class FriendImage internal constructor() : AbstractImage() { // * @see Image 查看更多说明 */ // CustomFace -public abstract class GroupImage internal constructor() : AbstractImage() { // change to sealed in the future. +public abstract class GroupImage @MiraiInternalApi public constructor() : + AbstractImage() { // change to sealed in the future. public companion object Key : Message.Key { public override val typeName: String get() = "GroupImage" } @@ -176,12 +185,7 @@ public val GROUP_IMAGE_ID_REGEX: Regex = Regex("""\{[0-9a-fA-F]{8}-([0-9a-fA-F]{ @Suppress("FunctionName", "DEPRECATION") @JsName("newImage") @JvmName("newImage") -public fun Image(imageId: String): OfflineImage = when { - imageId matches FRIEND_IMAGE_ID_REGEX_1 -> OfflineFriendImage(imageId) - imageId matches FRIEND_IMAGE_ID_REGEX_2 -> OfflineFriendImage(imageId) - imageId matches GROUP_IMAGE_ID_REGEX -> OfflineGroupImage(imageId) - else -> throw IllegalArgumentException("Illegal imageId: $imageId. $ILLEGAL_IMAGE_ID_EXCEPTION_MESSAGE") -} +public inline fun Image(imageId: String): Image = Mirai.createImage(imageId) /** * 查询原图下载链接. @@ -195,11 +199,7 @@ public fun Image(imageId: String): OfflineImage = when { //@JvmBlockingBridge @JvmSynthetic public suspend fun Image.queryUrl(): String { - @Suppress("DEPRECATION") - return when (this) { - is ConstOriginUrlAware -> this.originUrl - is DeferredOriginUrlAware -> this.getUrl(firstOnlineBotInstance) - is SuspendDeferredOriginUrlAware -> this.getUrl(firstOnlineBotInstance) - else -> error("Internal error: unsupported Image class: ${this::class}") - } + val bot = Bot._instances.peekFirst()?.get() ?: error("No Bot available to query image url") + return Mirai.queryImageUrl(bot, this) + } \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/Message.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Message.kt index 1c401b331..d65cf7962 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/Message.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/Message.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( @@ -23,7 +23,7 @@ import net.mamoe.mirai.contact.Contact import net.mamoe.mirai.message.MessageEvent import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.data.Message.Key -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.PlannedRemoval import kotlin.contracts.contract import kotlin.jvm.JvmMultifileClass @@ -204,7 +204,7 @@ public interface Message { // must be interface. Don't consider any changes. another.fold(this, Message::plus).asMessageChain() } -@MiraiExperimentalAPI +@MiraiExperimentalApi @JvmSynthetic public suspend inline operator fun Message.plus(another: Flow): MessageChain = another.fold(this) { acc, it -> acc + it }.asMessageChain() diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt index d6e60bad6..bb9d29e82 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChain.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/MessageChainBuilder.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChainBuilder.kt index c91fb8164..90e218e7f 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/MessageChainBuilder.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/MessageChainBuilder.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/MessageSource.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageSource.kt index cf0aa9b5f..1e15d1a27 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/MessageSource.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/MessageSource.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -13,17 +13,14 @@ package net.mamoe.mirai.message.data -import kotlinx.coroutines.Job import net.mamoe.mirai.Bot +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.* import net.mamoe.mirai.message.MessageEvent import net.mamoe.mirai.message.MessageReceipt import net.mamoe.mirai.message.quote import net.mamoe.mirai.message.recall -import net.mamoe.mirai.recallIn import net.mamoe.mirai.utils.LazyProperty -import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName import kotlin.jvm.JvmSynthetic @@ -361,27 +358,10 @@ public inline fun MessageChain.quote(): QuoteReply = QuoteReply(this.source) * @throws PermissionDeniedException 当 [Bot] 无权限操作时 * @throws IllegalStateException 当这条消息已经被撤回时 (仅同步主动操作) * - * @see Bot.recall + * @see Mirai.recall */ @JvmSynthetic -public suspend inline fun MessageSource.recall(): Unit = bot.recall(this) - -/** - * 在一段时间后撤回这条消息. 可撤回自己 2 分钟内发出的消息, 和任意时间的群成员的消息. - * - * [Bot] 撤回自己的消息不需要权限. - * [Bot] 撤回群员的消息需要管理员权限. - * - * @throws PermissionDeniedException 当 [Bot] 无权限操作时 - * @throws IllegalStateException 当这条消息已经被撤回时 (仅同步主动操作) - * - * @see Bot.recall - */ -@JvmSynthetic -public inline fun MessageSource.recallIn( - timeMillis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = bot.recallIn(this, timeMillis, coroutineContext) +public suspend inline fun MessageSource.recall(): Unit = Mirai.recall(bot, this) // For MessageChain @@ -451,28 +431,7 @@ public val MessageChain.source: MessageSource * @throws PermissionDeniedException 当 [Bot] 无权限操作时 * @throws IllegalStateException 当这条消息已经被撤回时 (仅同步主动操作) * - * @see Bot.recall + * @see Mirai.recall */ @JvmSynthetic -public suspend inline fun MessageChain.recall(): Unit = this.source.recall() - -/** - * 在一段时间后撤回这条消息. 可撤回自己 2 分钟内发出的消息, 和任意时间的群成员的消息. - * - * **注意:** 仅从服务器接收的消息 (即来自 [MessageEvent.message]), 或手动添加了 [MessageSource] 元素的 [MessageChain] 才可以撤回. - * - * *提示: 若要撤回一条机器人自己发出的消息, 使用 [Contact.sendMessage] 返回的 [MessageReceipt] 中的 [MessageReceipt.recall]* - * - * [Bot] 撤回自己的消息不需要权限. - * [Bot] 撤回群员的消息需要管理员权限. - * - * @throws PermissionDeniedException 当 [Bot] 无权限操作时 - * @throws IllegalStateException 当这条消息已经被撤回时 (仅同步主动操作) - * - * @see Bot.recall - */ -@JvmSynthetic -public inline fun MessageChain.recallIn( - millis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = source.recallIn(millis, coroutineContext) +public suspend inline fun MessageChain.recall(): Unit = this.source.recall() \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/MessageSourceBuilder.kt b/mirai-core-api/src/commonMain/kotlin/message/data/MessageSourceBuilder.kt index 40867be17..c309776a7 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/MessageSourceBuilder.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/MessageSourceBuilder.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -14,11 +14,12 @@ package net.mamoe.mirai.message.data import net.mamoe.mirai.Bot +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.ContactOrBot import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.Member -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import net.mamoe.mirai.utils.currentTimeSeconds import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName @@ -41,7 +42,7 @@ public fun OnlineMessageSource.toOffline(): OfflineMessageSource = * * @see buildMessageSource 查看更多说明 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @JvmName("copySource") public fun MessageSource.copyAmend( block: MessageSourceAmender.() -> Unit @@ -103,10 +104,11 @@ public interface MessageSourceAmender { * ``` */ @JvmSynthetic -@MiraiExperimentalAPI +@MiraiExperimentalApi public fun Bot.buildMessageSource(block: MessageSourceBuilder.() -> Unit): MessageSource { val builder = MessageSourceBuilderImpl().apply(block) - return constructMessageSource( + return Mirai.constructMessageSource( + this, builder.kind ?: error("You must call `Contact.sendTo(Contact)` when `buildMessageSource`"), builder.fromUin, builder.targetUin, diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/PlainText.kt b/mirai-core-api/src/commonMain/kotlin/message/data/PlainText.kt index e64cecaec..1ee329e62 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/PlainText.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/PlainText.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/QuoteReply.kt b/mirai-core-api/src/commonMain/kotlin/message/data/QuoteReply.kt index 82e38243c..955958318 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/QuoteReply.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/QuoteReply.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -13,14 +13,9 @@ package net.mamoe.mirai.message.data -import kotlinx.coroutines.Job import net.mamoe.mirai.Bot -import net.mamoe.mirai.utils.PlannedRemoval -import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName -import kotlin.jvm.JvmOverloads import kotlin.jvm.JvmSynthetic @@ -68,65 +63,4 @@ public inline val QuoteReply.bot: Bot * 撤回引用的源消息 */ @JvmSynthetic -public suspend inline fun QuoteReply.recallSource(): Unit = this.source.recall() - -/** - * 在一段时间后撤回引用的源消息 - */ -@JvmOverloads -public inline fun QuoteReply.recallSourceIn( - millis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = this.source.recallIn(millis, coroutineContext) - - -//// 因语义不明而弃用的 API, 兼容到 1.3.0 - -@PlannedRemoval("1.3.0") -@get:JvmSynthetic -@Deprecated("use source.id for clearer semantics", ReplaceWith("source.id")) -public inline val QuoteReply.id: Int - get() = source.id - -@PlannedRemoval("1.3.0") -@get:JvmSynthetic -@Deprecated("use source.internalId for clearer semantics", ReplaceWith("source.internalId")) -public inline val QuoteReply.internalId: Int - get() = source.internalId - -@PlannedRemoval("1.3.0") -@get:JvmSynthetic -@Deprecated("use source.fromId for clearer semantics", ReplaceWith("source.fromId")) -public inline val QuoteReply.fromId: Long - get() = source.fromId - -@PlannedRemoval("1.3.0") -@get:JvmSynthetic -@Deprecated("use source.targetId for clearer semantics", ReplaceWith("source.targetId")) -public inline val QuoteReply.targetId: Long - get() = source.targetId - -@PlannedRemoval("1.3.0") -@get:JvmSynthetic -@Deprecated("use source.originalMessage for clearer semantics", ReplaceWith("source.originalMessage")) -public inline val QuoteReply.originalMessage: MessageChain - get() = source.originalMessage - -@PlannedRemoval("1.3.0") -@get:JvmSynthetic -@Deprecated("use source.time for clearer semantics", ReplaceWith("source.time")) -public inline val QuoteReply.time: Int - get() = source.time - -@PlannedRemoval("1.3.0") -@Deprecated("use recallSourceIn for clearer semantics", ReplaceWith("recallSourceIn(millis, coroutineContext)")) -@JvmOverloads -public inline fun QuoteReply.recallIn( - millis: Long, - coroutineContext: CoroutineContext = EmptyCoroutineContext -): Job = recallSourceIn(millis, coroutineContext) - -@PlannedRemoval("1.3.0") -@Deprecated("use recallSource for clearer semantics", ReplaceWith("this.recallSource()")) -@JvmSynthetic -public suspend inline fun QuoteReply.recall(): Unit = recallSource() +public suspend inline fun QuoteReply.recallSource(): Unit = this.source.recall() \ No newline at end of file diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt b/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt index bed842c7c..ce729d483 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/RichMessage.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmName("MessageUtils") @@ -13,7 +13,7 @@ package net.mamoe.mirai.message.data -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import kotlin.annotation.AnnotationTarget.* import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName @@ -34,7 +34,7 @@ public interface RichMessage : MessageContent { /** * **注意**: 富文本消息的 [RichMessage.contentEquals] 和 [RichMessage.toString] 都不稳定. 将来可能在没有任何警告的情况下改变格式. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public override fun contentToString(): String = this.content /** @@ -46,13 +46,13 @@ public interface RichMessage : MessageContent { * 一些模板 * @suppress 此 API 不稳定, 可能在任意时刻被删除 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public companion object Templates : Message.Key { /** * @suppress 此 API 不稳定, 可能在任意时刻被删除 */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public fun share( url: String, title: String? = null, @@ -150,11 +150,11 @@ commonElem=CommonElem#750141174 { */ @Suppress("DEPRECATION_ERROR") @JvmSynthetic -@MiraiExperimentalAPI +@MiraiExperimentalApi public inline fun buildXmlMessage(serviceId: Int, block: @XmlMessageDsl XmlMessageBuilder.() -> Unit): ServiceMessage = ServiceMessage(serviceId, XmlMessageBuilder().apply(block).text) -@MiraiExperimentalAPI +@MiraiExperimentalApi @Target(CLASS, FUNCTION, TYPE) @DslMarker public annotation class XmlMessageDsl @@ -162,7 +162,7 @@ public annotation class XmlMessageDsl /** * @suppress 此 API 不稳定 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @XmlMessageDsl public class XmlMessageBuilder( public var templateId: Int = 1, @@ -225,7 +225,7 @@ public class XmlMessageBuilder( } } -@MiraiExperimentalAPI +@MiraiExperimentalApi internal class LongMessage internal constructor(content: String, val resId: String) : ServiceMessage(35, content) { companion object Key : Message.Key { override val typeName: String get() = "LongMessage" diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/Voice.kt b/mirai-core-api/src/commonMain/kotlin/message/data/Voice.kt index ce9538f4d..cd8efbf03 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/Voice.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/Voice.kt @@ -1,22 +1,22 @@ /* * 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. + * 此源代码的使用受 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.data -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.MiraiInternalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi +import net.mamoe.mirai.utils.MiraiInternalApi import net.mamoe.mirai.utils.SinceMirai /** * 需要通过上传到服务器的消息,如语音、文件 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public abstract class PttMessage : MessageContent { public companion object Key : Message.Key { @@ -34,7 +34,7 @@ public abstract class PttMessage : MessageContent { * 语音消息, 目前只支持接收和转发 */ @SinceMirai("1.2.0") -public class Voice @MiraiInternalAPI constructor( +public class Voice @MiraiInternalApi constructor( public override val fileName: String, public override val md5: ByteArray, public override val fileSize: Long, diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/imageDeprecated.kt b/mirai-core-api/src/commonMain/kotlin/message/data/imageDeprecated.kt deleted file mode 100644 index f34a9ca9a..000000000 --- a/mirai-core-api/src/commonMain/kotlin/message/data/imageDeprecated.kt +++ /dev/null @@ -1,168 +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:JvmMultifileClass -@file:JvmName("MessageUtils") - -@file:Suppress( - "EXPERIMENTAL_API_USAGE", - "unused", - "DEPRECATION", - "UnusedImport", - "EXPOSED_SUPER_CLASS", - "DEPRECATION_ERROR" -) - -package net.mamoe.mirai.message.data - -import kotlinx.serialization.Serializable -import net.mamoe.mirai.Bot -import net.mamoe.mirai.contact.Contact -import net.mamoe.mirai.contact.Group -import net.mamoe.mirai.utils.PlannedRemoval -import kotlin.jvm.JvmMultifileClass -import kotlin.jvm.JvmName -import kotlin.jvm.JvmSynthetic - - -///////////////////////// -///// 以下 API 已弃用 ///// -///////////////////////// - - -// region 已启用 - -internal const val ONLINE_OFFLINE_DEPRECATION_MESSAGE = """ -自 1.0.0 起, mirai 已经能正常处理离线图片和在线图片的下载链接等功能. -使用者无需考虑一个图片为在线图片还是离线图片, 只需使用 Image 类型. -""" - - -@PlannedRemoval("1.2.0") // 改为 internal -@Deprecated( - ONLINE_OFFLINE_DEPRECATION_MESSAGE, - level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "Image") -) -@Suppress("EXPOSED_SUPER_INTERFACE") -public interface OnlineImage : Image, ConstOriginUrlAware { - public companion object Key : Message.Key { - public override val typeName: String get() = "OnlineImage" - } - - public override val originUrl: String -} - -/** - * 离线的图片, 即为客户端主动上传到服务器而获得的 [Image] 实例. - * 不能直接获取它在服务器上的链接. 需要通过 [Bot.queryImageUrl] 查询 - * - * 一般由 [Contact.uploadImage] 得到 - */ -@PlannedRemoval("1.2.0") // 改为 internal -@Deprecated( - ONLINE_OFFLINE_DEPRECATION_MESSAGE, - level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "Image") -) -public interface OfflineImage : Image { - public companion object Key : Message.Key { - public override val typeName: String get() = "OfflineImage" - } -} - -@PlannedRemoval("1.2.0") // 删除 -@Deprecated( - ONLINE_OFFLINE_DEPRECATION_MESSAGE, - level = DeprecationLevel.HIDDEN -) -@JvmSynthetic -public suspend fun OfflineImage.queryUrl(): String { - return Bot._instances.peekFirst()?.get()?.queryImageUrl(this) ?: error("No Bot available to query image url") -} - -/** - * 通过 [Group.uploadImage] 上传得到的 [GroupImage]. 它的链接需要查询 [Bot.queryImageUrl] - * - * @param imageId 参考 [Image.imageId] - */ -@PlannedRemoval("1.2.0") // 改为 internal -@Deprecated( - ONLINE_OFFLINE_DEPRECATION_MESSAGE, - level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "Image") -) -@Serializable -public data class OfflineGroupImage( - public override val imageId: String -) : GroupImage(), OfflineImage, DeferredOriginUrlAware { - public override fun getUrl(bot: Bot): String { - return "http://gchat.qpic.cn/gchatpic_new/${bot.id}/0-0-${ - imageId.substring(1..36) - .replace("-", "") - }/0?term=2" - } - - init { - @Suppress("DEPRECATION") - require(imageId matches GROUP_IMAGE_ID_REGEX) { - "Illegal imageId. It must matches GROUP_IMAGE_ID_REGEX" - } - } -} - -/** - * 接收消息时获取到的 [GroupImage]. 它可以直接获取下载链接 [originUrl] - */ -@PlannedRemoval("1.2.0") // 改为 internal -@Deprecated( - ONLINE_OFFLINE_DEPRECATION_MESSAGE, - level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "Image") -) -public abstract class OnlineGroupImage : GroupImage(), OnlineImage - -/** - * 通过 [Group.uploadImage] 上传得到的 [GroupImage]. 它的链接需要查询 [Bot.queryImageUrl] - * - * @param imageId 参考 [Image.imageId] - */ -@PlannedRemoval("1.2.0") // 改为 internal -@Deprecated( - ONLINE_OFFLINE_DEPRECATION_MESSAGE, - level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "Image") -) -@Serializable -public data class OfflineFriendImage( - public override val imageId: String -) : FriendImage(), OfflineImage, DeferredOriginUrlAware { - public override fun getUrl(bot: Bot): String { - return "http://c2cpicdw.qpic.cn/offpic_new/${bot.id}/${this.imageId}/0?term=2" - } - - init { - require(imageId matches FRIEND_IMAGE_ID_REGEX_1 || imageId matches FRIEND_IMAGE_ID_REGEX_2) { - "Illegal imageId. It must matches either FRIEND_IMAGE_ID_REGEX_1 or FRIEND_IMAGE_ID_REGEX_2" - } - } -} - -/** - * 接收消息时获取到的 [FriendImage]. 它可以直接获取下载链接 [originUrl] - */ -@PlannedRemoval("1.2.0") // 改为 internal -@Deprecated( - ONLINE_OFFLINE_DEPRECATION_MESSAGE, - level = DeprecationLevel.ERROR, - replaceWith = ReplaceWith("Image", "Image") -) -public abstract class OnlineFriendImage : FriendImage(), OnlineImage - -// endregion diff --git a/mirai-core-api/src/commonMain/kotlin/message/data/impl.kt b/mirai-core-api/src/commonMain/kotlin/message/data/impl.kt index c37d5aef5..77e2ebed2 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/data/impl.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/data/impl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE") @@ -13,10 +13,7 @@ package net.mamoe.mirai.message.data -import net.mamoe.mirai.Bot -import net.mamoe.mirai.utils.ExternalImage -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.SinceMirai +import net.mamoe.mirai.utils.MiraiExperimentalApi import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName import kotlin.jvm.JvmSynthetic @@ -24,62 +21,6 @@ import kotlin.native.concurrent.SharedImmutable // region image -/** - * 所有 [Image] 实现的基类. - */ -internal abstract class AbstractImage : Image { // make sealed in 1.3.0 ? - @Deprecated( - """ - 不要自行实现 Image, 它必须由协议模块实现, 否则会无法发送也无法解析. - """, level = DeprecationLevel.HIDDEN - ) - @Suppress("PropertyName", "DeprecatedCallableAddReplaceWith") - @get:JvmSynthetic - final override val DoNotImplementThisClass: Nothing? - get() = error("stub") - - private var _stringValue: String? = null - get() = field ?: kotlin.run { - field = "[mirai:image:$imageId]" - field - } - - final override fun toString(): String = _stringValue!! - final override fun contentToString(): String = "[图片]" -} - -internal interface ConstOriginUrlAware : Image { - val originUrl: String -} - -internal interface DeferredOriginUrlAware : Image { - fun getUrl(bot: Bot): String -} - -internal interface SuspendDeferredOriginUrlAware : Image { - suspend fun getUrl(bot: Bot): String -} - -/** - * 由 [ExternalImage] 委托的 [Image] 类型. - */ -@SinceMirai("1.1.0") -@MiraiExperimentalAPI("Will be renamed to OfflineImage on 1.2.0") -@Suppress("DEPRECATION_ERROR") -internal class ExperimentalDeferredImage internal constructor( - @Suppress("CanBeParameter") private val externalImage: ExternalImage // for future use -) : AbstractImage(), SuspendDeferredOriginUrlAware { - override suspend fun getUrl(bot: Bot): String { - TODO() - } - - override val imageId: String = externalImage.calculateImageResourceId() -} - -internal val firstOnlineBotInstance: Bot get() = Bot.botInstancesSequence.firstOrNull() ?: error("No Bot available") - -// endergion - ///////////////////////// //// IMPLEMENTATIONS //// ///////////////////////// @@ -199,7 +140,7 @@ internal fun Sequence.constrainSingleMessages(): List SingleMessage?): ArrayList { val list = ArrayList() @@ -255,8 +196,8 @@ internal fun MessageChain.firstOrNullImpl(key: Message.Key): M? AtAll -> firstIsInstanceOrNull() PlainText -> firstIsInstanceOrNull() Image -> firstIsInstanceOrNull<Image>() - OnlineImage -> firstIsInstanceOrNull<OnlineImage>() - OfflineImage -> firstIsInstanceOrNull<OfflineImage>() + // OnlineImage -> firstIsInstanceOrNull<OnlineImage>() + // OfflineImage -> firstIsInstanceOrNull<OfflineImage>() GroupImage -> firstIsInstanceOrNull<GroupImage>() FriendImage -> firstIsInstanceOrNull<FriendImage>() Face -> firstIsInstanceOrNull<Face>() @@ -412,7 +353,8 @@ internal fun calculateImageMd5ByImageId(imageId: String): ByteArray { } } -internal val ILLEGAL_IMAGE_ID_EXCEPTION_MESSAGE = +@PublishedApi +internal val ILLEGAL_IMAGE_ID_EXCEPTION_MESSAGE: String = "ImageId must match Regex `${FRIEND_IMAGE_ID_REGEX_1.pattern}`, " + "`${FRIEND_IMAGE_ID_REGEX_2.pattern}` or " + "`${GROUP_IMAGE_ID_REGEX.pattern}`" diff --git a/mirai-core-api/src/commonMain/kotlin/message/deprecated.kt b/mirai-core-api/src/commonMain/kotlin/message/deprecated.kt index 1d2dc5ed5..252da2629 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/deprecated.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/deprecated.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( diff --git a/mirai-core-api/src/commonMain/kotlin/message/utils.kt b/mirai-core-api/src/commonMain/kotlin/message/utils.kt index ff5ca8aa3..8b556af60 100644 --- a/mirai-core-api/src/commonMain/kotlin/message/utils.kt +++ b/mirai-core-api/src/commonMain/kotlin/message/utils.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/network/ForceOfflineException.kt b/mirai-core-api/src/commonMain/kotlin/network/ForceOfflineException.kt index 1c6c69c88..3ea73f4c7 100644 --- a/mirai-core-api/src/commonMain/kotlin/network/ForceOfflineException.kt +++ b/mirai-core-api/src/commonMain/kotlin/network/ForceOfflineException.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.network diff --git a/mirai-core-api/src/commonMain/kotlin/network/LoginFailedException.kt b/mirai-core-api/src/commonMain/kotlin/network/LoginFailedException.kt index 877b54ad8..699cdb3d0 100644 --- a/mirai-core-api/src/commonMain/kotlin/network/LoginFailedException.kt +++ b/mirai-core-api/src/commonMain/kotlin/network/LoginFailedException.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") @@ -12,8 +12,8 @@ package net.mamoe.mirai.network import net.mamoe.mirai.Bot -import net.mamoe.mirai.utils.MiraiExperimentalAPI -import net.mamoe.mirai.utils.MiraiInternalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi +import net.mamoe.mirai.utils.MiraiInternalApi import net.mamoe.mirai.utils.SinceMirai /** @@ -31,14 +31,14 @@ public sealed class LoginFailedException( /** * 密码输入错误 (有时候也会是其他错误, 如 `"当前上网环境异常,请更换网络环境或在常用设备上登录或稍后再试。"`) */ -public class WrongPasswordException @MiraiInternalAPI constructor( +public class WrongPasswordException @MiraiInternalApi constructor( message: String? ) : LoginFailedException(true, message) /** * 无可用服务器 */ -public class NoServerAvailableException @MiraiInternalAPI constructor( +public class NoServerAvailableException @MiraiInternalApi constructor( public override val cause: Throwable? ) : LoginFailedException(false, "no server available") @@ -46,20 +46,20 @@ public class NoServerAvailableException @MiraiInternalAPI constructor( * 服务器要求稍后重试 */ @SinceMirai("1.2.0") -public class RetryLaterException @MiraiInternalAPI constructor() : +public class RetryLaterException @MiraiInternalApi constructor() : LoginFailedException(false, "server requests retrial later") /** * 无标准输入或 Kotlin 不支持此输入. */ -public class NoStandardInputForCaptchaException @MiraiInternalAPI constructor( +public class NoStandardInputForCaptchaException @MiraiInternalApi constructor( public override val cause: Throwable? ) : LoginFailedException(true, "no standard input for captcha") /** * 需要短信验证时抛出. mirai 目前还不支持短信验证. */ -@MiraiExperimentalAPI("Will be removed when SMS login is supported") +@MiraiExperimentalApi("Will be removed when SMS login is supported") public class UnsupportedSMSLoginException(message: String?) : LoginFailedException(true, message) /** diff --git a/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt b/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt index ddc7d51c6..891f5c0e0 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/Annotations.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils @@ -24,7 +24,7 @@ import kotlin.annotation.AnnotationTarget.* CLASS, FUNCTION, PROPERTY ) @MustBeDocumented -public annotation class MiraiInternalAPI( +public annotation class MiraiInternalApi( public val message: String = "" ) @@ -38,7 +38,7 @@ public annotation class MiraiInternalAPI( @RequiresOptIn(level = RequiresOptIn.Level.WARNING) @Target(CLASS, TYPEALIAS, FUNCTION, PROPERTY, FIELD, CONSTRUCTOR) @MustBeDocumented -public annotation class MiraiExperimentalAPI( +public annotation class MiraiExperimentalApi( public val message: String = "" ) diff --git a/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt index 4081fbc62..1a91c833d 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/BotConfiguration.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "DEPRECATION_ERROR", "EXPOSED_SUPER_CLASS") @@ -148,14 +148,14 @@ public open class BotConfigurationBase internal constructor() { /** 缓存策略 */ @SinceMirai("1.0.0") - @MiraiExperimentalAPI + @MiraiExperimentalApi public var fileCacheStrategy: FileCacheStrategy = FileCacheStrategy.PlatformDefault /** * Json 序列化器, 使用 'kotlinx.serialization' */ @SinceMirai("1.1.0") - @MiraiExperimentalAPI + @MiraiExperimentalApi public var json: Json = kotlin.runCatching { @OptIn(UnstableDefault::class) Json { diff --git a/mirai-core-api/src/commonMain/kotlin/utils/Channels.kt b/mirai-core-api/src/commonMain/kotlin/utils/Channels.kt index 450297dcf..671ed7904 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/Channels.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/Channels.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmName("Utils") @@ -28,7 +28,7 @@ import kotlin.jvm.JvmName * 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst] */ @OptIn(InternalSerializationApi::class) -@MiraiExperimentalAPI +@MiraiExperimentalApi public suspend fun ByteReadChannel.copyTo(dst: OutputStream) { val buffer = ByteArray(2048) var size: Int @@ -40,7 +40,7 @@ public suspend fun ByteReadChannel.copyTo(dst: OutputStream) { /** * 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst] */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public suspend fun ByteReadChannel.copyTo(dst: Output) { val buffer = ByteArray(2048) var size: Int @@ -52,7 +52,7 @@ public suspend fun ByteReadChannel.copyTo(dst: Output) { /** * 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst] */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel) { val buffer = ByteArray(2048) var size: Int @@ -67,7 +67,7 @@ public suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel) { /** * 从接收者管道读取所有数据并写入 [dst], 最终关闭 [dst] */ -@MiraiExperimentalAPI +@MiraiExperimentalApi @OptIn(InternalSerializationApi::class) public suspend fun ByteReadChannel.copyAndClose(dst: OutputStream) { // 在 JVM 这个 API 不是 internal 的 try { @@ -84,7 +84,7 @@ public suspend fun ByteReadChannel.copyAndClose(dst: OutputStream) { // 在 JVM /** * 从接收者管道读取所有数据并写入 [dst], 最终关闭 [dst] */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public suspend fun ByteReadChannel.copyAndClose(dst: Output) { try { val buffer = ByteArray(2048) @@ -100,7 +100,7 @@ public suspend fun ByteReadChannel.copyAndClose(dst: Output) { /** * 从接收者管道读取所有数据并写入 [dst], 最终关闭 [dst] */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) { @Suppress("DuplicatedCode") try { @@ -118,7 +118,7 @@ public suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel) { /** * 从接收者管道读取所有数据并写入 [dst], 最终关闭 [dst] */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public suspend fun ByteReadChannel.copyAndClose(dst: io.ktor.utils.io.ByteWriteChannel) { @Suppress("DuplicatedCode") try { diff --git a/mirai-core-api/src/commonMain/kotlin/utils/Context.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/Context.common.kt index 1c81fc6ad..0166da8f8 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/Context.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/Context.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt b/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt index 3f7756da8..5c54d9427 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/DeviceInfo.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/commonMain/kotlin/utils/ExternalImage.kt b/mirai-core-api/src/commonMain/kotlin/utils/ExternalImage.kt index 1fa0a32f9..1739d60e7 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/ExternalImage.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/ExternalImage.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused") @@ -69,12 +69,12 @@ public class ExternalImage internal constructor( public const val defaultFormatName: String = "mirai" - @MiraiExperimentalAPI + @MiraiExperimentalApi public fun generateUUID(md5: ByteArray): String { return "${md5[0, 3]}-${md5[4, 5]}-${md5[6, 7]}-${md5[8, 9]}-${md5[10, 15]}" } - @MiraiExperimentalAPI + @MiraiExperimentalApi public fun generateImageId(md5: ByteArray): String { return """{${generateUUID(md5)}}.$defaultFormatName""" } diff --git a/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.common.kt index 763e267a5..3cc627e87 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/FileCacheStrategy.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils @@ -21,13 +21,13 @@ import kotlin.contracts.contract * * 图片上传时默认使用文件缓存. */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public expect interface FileCacheStrategy { /** * 将 [input] 缓存为 [ExternalImage]. * 此函数应 close 这个 [Input] */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public fun newImageCache(input: Input): ExternalImage @@ -35,25 +35,25 @@ public expect interface FileCacheStrategy { * 将 [input] 缓存为 [ExternalImage]. * 此 [input] 的内容应是不变的. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public fun newImageCache(input: ByteArray): ExternalImage /** * 默认的缓存方案. 在 JVM 平台使用系统临时文件. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public object PlatformDefault : FileCacheStrategy /** * 使用内存直接存储所有图片文件. */ public object MemoryCache : FileCacheStrategy { - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public override fun newImageCache(input: Input): ExternalImage - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public override fun newImageCache(input: ByteArray): ExternalImage } diff --git a/mirai-core-api/src/commonMain/kotlin/utils/LazyProperty.kt b/mirai-core-api/src/commonMain/kotlin/utils/LazyProperty.kt index 707c8124f..b07185cc0 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/LazyProperty.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/LazyProperty.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt b/mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt index 7ee21b3a2..b33948e5f 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/LockFreeLinkedList.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE", "unused") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/LoginSolver.kt b/mirai-core-api/src/commonMain/kotlin/utils/LoginSolver.kt index 94035ae7e..60a763a72 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/LoginSolver.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/LoginSolver.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/commonMain/kotlin/utils/MiraiLogger.kt b/mirai-core-api/src/commonMain/kotlin/utils/MiraiLogger.kt index 0bce9ce99..8d85d58f5 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/MiraiLogger.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/MiraiLogger.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") @@ -261,9 +261,9 @@ public open class SimpleLogger( ) : MiraiLoggerPlatformBase() { public enum class LogPriority( - @MiraiExperimentalAPI public val nameAligned: String, + @MiraiExperimentalApi public val nameAligned: String, public val simpleName: String, - @MiraiExperimentalAPI public val correspondingFunction: MiraiLogger.(message: String?, e: Throwable?) -> Unit + @MiraiExperimentalApi public val correspondingFunction: MiraiLogger.(message: String?, e: Throwable?) -> Unit ) { VERBOSE("VERBOSE", "V", MiraiLogger::verbose), DEBUG(" DEBUG ", "D", MiraiLogger::debug), diff --git a/mirai-core-api/src/commonMain/kotlin/utils/OverFileSizeMaxException.kt b/mirai-core-api/src/commonMain/kotlin/utils/OverFileSizeMaxException.kt index 128efa4ff..fb1dc9c81 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/OverFileSizeMaxException.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/OverFileSizeMaxException.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/commonMain/kotlin/utils/SoftRef.kt b/mirai-core-api/src/commonMain/kotlin/utils/SoftRef.kt index 0fc805178..f08882e0f 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/SoftRef.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/SoftRef.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NOTHING_TO_INLINE") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/TimeUtils.kt b/mirai-core-api/src/commonMain/kotlin/utils/TimeUtils.kt index 158d77f9b..9feaef1c9 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/TimeUtils.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/TimeUtils.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -82,7 +82,7 @@ public inline val Int.weeksToSeconds: Long public inline val Int.monthsToSeconds: Long get() = this * 30.daysToSeconds -@MiraiExperimentalAPI +@MiraiExperimentalApi @ExperimentalTime public val Duration.asHumanReadable: String get() { diff --git a/mirai-core-api/src/commonMain/kotlin/utils/WeakRef.kt b/mirai-core-api/src/commonMain/kotlin/utils/WeakRef.kt index e84b7e1f4..e9211455d 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/WeakRef.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/WeakRef.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NOTHING_TO_INLINE") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/ChunkedFlowSession.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/ChunkedFlowSession.kt index 3f749285b..d424200f7 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/ChunkedFlowSession.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/ChunkedFlowSession.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal @@ -19,12 +19,12 @@ import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.Closeable import kotlinx.io.core.Input import kotlinx.serialization.InternalSerializationApi -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import java.io.InputStream import kotlin.jvm.JvmField -@MiraiExperimentalAPI +@MiraiExperimentalApi public interface ChunkedFlowSession<T> : Closeable { public val flow: Flow<T> override fun close() @@ -41,7 +41,7 @@ internal inline fun <T, R> ChunkedFlowSession<T>.map(crossinline mapper: suspend /** * 由 [chunkedFlow] 分割得到的区块 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public class ChunkedInput( /** * 区块的数据. diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/DeferredReusableInput.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/DeferredReusableInput.common.kt index f0706a8bc..a370f5df4 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/DeferredReusableInput.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/DeferredReusableInput.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/RandomUtils.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/RandomUtils.kt index 2c17e9624..1c3cfca38 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/RandomUtils.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/RandomUtils.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/ReusableInput.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/ReusableInput.kt index d1c36d1bf..145700e05 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/ReusableInput.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/ReusableInput.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/asReusableInput.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/asReusableInput.common.kt index ade61e8ab..22b3baa8b 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/asReusableInput.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/asReusableInput.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/md5.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/md5.common.kt index 538752522..2e8a832bf 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/md5.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/md5.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/retryCatching.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/retryCatching.common.kt index 14da423fc..d648155a8 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/retryCatching.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/retryCatching.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/commonMain/kotlin/utils/internal/runBlocking.common.kt b/mirai-core-api/src/commonMain/kotlin/utils/internal/runBlocking.common.kt index df3e0d0eb..a89afdd79 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/internal/runBlocking.common.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/internal/runBlocking.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.kt index 73f377a60..155105648 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedInputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.kt index b4bc5bbb3..3a4a11490 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/BufferedOutputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.kt index 53d00b3d3..0b9ec64e8 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayInputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt index 5f909e097..b3893eb3b 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ByteArrayOutputStream.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt index c77b71bc7..588241bc2 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Closeable.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.kt index c18757dac..6aa085bef 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataInput.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.kt index 21ec82901..a8d89a61e 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/DataOutput.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.kt index 4a4e30fcf..92244aa25 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/EOFException.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt index 59c25b582..e86a8ee8e 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/File.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "unused", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.kt index 46454ffbc..20ae3f361 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileDescriptor.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 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", @@ -39,8 +48,10 @@ public expect final class FileDescriptor { public companion object { @JvmStatic public val `in`: FileDescriptor + @JvmStatic public val out: FileDescriptor + @JvmStatic public val err: FileDescriptor } diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.kt index 73ebeb2d4..6b0b3eeca 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileInputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.kt index b7057d539..d0bf2b910 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FileOutputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.kt index 0525281e4..edcaa2fe6 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterInputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.kt index ea5351b71..1c7cc924f 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/FilterOutputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.kt index 5ed6a7c9a..ca3d10bd8 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/IOException.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.kt index f95510a6b..5f08dd217 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/InputStream.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.kt index 3e7f191e6..3747ea3ce 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/ObjectInput.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt index 87025f2cb..b3a8294ca 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/OutputStream.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt index 6b9bb0c3d..7a6db09a7 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/io/Serializable.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "unused", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.kt index 3567bffdb..3edd8e034 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet4Address.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.kt index 3627d557c..a06d88e64 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Inet6Address.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.kt index 73e5d5d9f..8844539a0 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetAddress.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 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", @@ -53,14 +62,19 @@ public expect open class InetAddress : java.io.Serializable { public companion object { @JvmStatic public open fun getByAddress(host: String, addr: ByteArray): InetAddress + @JvmStatic public open fun getByName(host: String): InetAddress + @JvmStatic public open fun getAllByName(host: String): Array<InetAddress> + @JvmStatic public open fun getLoopbackAddress(): InetAddress + @JvmStatic public open fun getByAddress(addr: ByteArray): InetAddress + @JvmStatic public open fun getLocalHost(): InetAddress } diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.kt index 5060b7806..c40233933 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/InetSocketAddress.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt index 9170dcbe0..9614f27ac 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Proxy.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "unused", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.kt index b6561f84f..bf09e1845 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/Socket.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.kt index 6a28bf96f..15c4868ae 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketAddress.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.kt index 0a79a6055..1b29b8b41 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketException.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.kt index 5735aae2a..7f4a97f5e 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOption.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.kt index 29078cb22..fb3aca972 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/SocketOptions.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt index e069d19d9..bb0990268 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URI.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "unused", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt index ca746cc43..74ab988e0 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URL.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "unused", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt index 1534f5b49..89c4dbab1 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/net/URLConnection.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "unused", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt index f9e58b6c3..ea634a3e4 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Buffer.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt index ab1c69995..f92ec15ab 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteBuffer.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt index bc989f909..f2bde11d2 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/ByteOrder.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "NO_ACTUAL_FOR_EXPECT", "PackageDirectoryMismatch") diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.kt index c6011f0e8..1363b5b2e 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/FileSystem.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt index c52da3677..056004b4b 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Path.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "unused", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.kt index 7e24a7ccf..6bf630b7a 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Paths.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 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", diff --git a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.kt b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.kt index fefc26ab9..a2bec503d 100644 --- a/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.kt +++ b/mirai-core-api/src/commonMain/kotlin/utils/java.bindings/nio/Watchable.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 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", diff --git a/mirai-core-api/src/commonTest/kotlin/message.data/CombinedMessageTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/CombinedMessageTest.kt index b92a8b834..41a1ff741 100644 --- a/mirai-core-api/src/commonTest/kotlin/message.data/CombinedMessageTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/CombinedMessageTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.data diff --git a/mirai-core-api/src/commonTest/kotlin/message.data/ConstrainSingleTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/ConstrainSingleTest.kt index 928c6e941..47c02d0a5 100644 --- a/mirai-core-api/src/commonTest/kotlin/message.data/ConstrainSingleTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/ConstrainSingleTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.data diff --git a/mirai-core-api/src/commonTest/kotlin/message.data/ContentEqualsTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/ContentEqualsTest.kt index e173767a3..525b3b552 100644 --- a/mirai-core-api/src/commonTest/kotlin/message.data/ContentEqualsTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/ContentEqualsTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.data diff --git a/mirai-core-api/src/commonTest/kotlin/message.data/ImageTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/ImageTest.kt index de218d050..084a71cca 100644 --- a/mirai-core-api/src/commonTest/kotlin/message.data/ImageTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/ImageTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE") diff --git a/mirai-core-api/src/commonTest/kotlin/message.data/MessageChainBuilderTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/MessageChainBuilderTest.kt index 36da61dbd..28beb110a 100644 --- a/mirai-core-api/src/commonTest/kotlin/message.data/MessageChainBuilderTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/MessageChainBuilderTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.data diff --git a/mirai-core-api/src/commonTest/kotlin/message.data/MessageUtilsTest.kt b/mirai-core-api/src/commonTest/kotlin/message.data/MessageUtilsTest.kt index 1c9ba8969..95687f514 100644 --- a/mirai-core-api/src/commonTest/kotlin/message.data/MessageUtilsTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/MessageUtilsTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.data diff --git a/mirai-core-api/src/commonTest/kotlin/message.data/TestMessageChainDelegate.kt b/mirai-core-api/src/commonTest/kotlin/message.data/TestMessageChainDelegate.kt index 783e68467..c343e9c44 100644 --- a/mirai-core-api/src/commonTest/kotlin/message.data/TestMessageChainDelegate.kt +++ b/mirai-core-api/src/commonTest/kotlin/message.data/TestMessageChainDelegate.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.data diff --git a/mirai-core-api/src/commonTest/kotlin/package.kt b/mirai-core-api/src/commonTest/kotlin/package.kt index a04ac80e4..d26340a01 100644 --- a/mirai-core-api/src/commonTest/kotlin/package.kt +++ b/mirai-core-api/src/commonTest/kotlin/package.kt @@ -1,9 +1,9 @@ /* - * 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. + * 此源代码的使用受 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 \ No newline at end of file diff --git a/mirai-core-api/src/commonTest/kotlin/test/TestDSL.kt b/mirai-core-api/src/commonTest/kotlin/test/TestDSL.kt index 980435979..61b32eccb 100644 --- a/mirai-core-api/src/commonTest/kotlin/test/TestDSL.kt +++ b/mirai-core-api/src/commonTest/kotlin/test/TestDSL.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE") diff --git a/mirai-core-api/src/commonTest/kotlin/utils/ExternalImageTest.kt b/mirai-core-api/src/commonTest/kotlin/utils/ExternalImageTest.kt index d95a68a17..522d03fb3 100644 --- a/mirai-core-api/src/commonTest/kotlin/utils/ExternalImageTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/utils/ExternalImageTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/commonTest/kotlin/utils/TimeTest.kt b/mirai-core-api/src/commonTest/kotlin/utils/TimeTest.kt index 85e63e200..4c72518b7 100644 --- a/mirai-core-api/src/commonTest/kotlin/utils/TimeTest.kt +++ b/mirai-core-api/src/commonTest/kotlin/utils/TimeTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/BotFactory.kt b/mirai-core-api/src/jvmMain/kotlin/BotFactory.kt index 85dbeccf9..9cb19246f 100644 --- a/mirai-core-api/src/jvmMain/kotlin/BotFactory.kt +++ b/mirai-core-api/src/jvmMain/kotlin/BotFactory.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith") @@ -42,6 +42,12 @@ public actual interface BotFactory { configuration: BotConfiguration ): Bot + /** + * 使用指定的 [配置][configuration] 构造 [Bot] 实例 + */ + @JvmName("newBot") + public fun Bot(qq: Long, password: String, configuration: BotConfiguration = BotConfiguration.Default): Bot + /** * 使用指定的 [配置][configuration] 构造 [Bot] 实例 */ @@ -53,15 +59,33 @@ public actual interface BotFactory { configuration: BotConfiguration ): Bot + /** + * 使用指定的 [配置][configuration] 构造 [Bot] 实例 + */ + @JvmName("newBot") + public fun Bot( + qq: Long, + passwordMd5: ByteArray, + configuration: BotConfiguration + ): Bot + @SinceMirai("1.3.0") public actual companion object INSTANCE : BotFactory { override fun Bot(context: Context, qq: Long, password: String, configuration: BotConfiguration): Bot { return factory.Bot(context, qq, password, configuration) } + override fun Bot(qq: Long, password: String, configuration: BotConfiguration): Bot { + return factory.Bot(qq, password, configuration) + } + override fun Bot(context: Context, qq: Long, passwordMd5: ByteArray, configuration: BotConfiguration): Bot { return factory.Bot(context, qq, passwordMd5, configuration) } + + override fun Bot(qq: Long, passwordMd5: ByteArray, configuration: BotConfiguration): Bot { + return factory.Bot(qq, passwordMd5, configuration) + } } } diff --git a/mirai-core-api/src/jvmMain/kotlin/BotJavaFriendlyAPI.kt b/mirai-core-api/src/jvmMain/kotlin/BotJavaFriendlyAPI.kt deleted file mode 100644 index a74e9ea4a..000000000 --- a/mirai-core-api/src/jvmMain/kotlin/BotJavaFriendlyAPI.kt +++ /dev/null @@ -1,208 +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 - -import kotlinx.coroutines.* -import net.mamoe.mirai.contact.recall -import net.mamoe.mirai.message.MessageReceipt -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.message.data.queryUrl -import net.mamoe.mirai.network.LoginFailedException -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 { - - /** - * 登录, 或重新登录. - * 这个函数总是关闭一切现有网路任务, 然后重新登录并重新缓存好友列表和群列表. - * - * 一般情况下不需要重新登录. Mirai 能够自动处理掉线情况. - * - * 最终调用 [net.mamoe.mirai.network.BotNetworkHandler.closeEverythingAndRelogin] - * - * @throws LoginFailedException - */ - @Throws(LoginFailedException::class) - @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 { image.queryUrl() } - } - - /** - * 阻塞当前线程直到 [Bot] 下线. - */ - @JvmName("join") - fun __joinBlockingForJava__() { - runBlocking { join() } - } - - /** - * 异步调用 [__loginBlockingForJava__] - */ - @JvmName("loginAsync") - fun __loginAsyncForJava__(): Future<Unit> { - return future { login() } - } - - /** - * 异步调用 [__recallBlockingForJava__] - */ - @JvmName("recallAsync") - fun __recallAsyncForJava__(source: MessageSource): Future<Unit> { - return future { recall(source) } - } - - /** - * 异步调用 [__recallBlockingForJava__] - */ - @JvmName("recallAsync") - fun __recallAsyncForJava__(source: MessageChain): Future<Unit> { - return future { recall(source) } - } - - /** - * 异步调用 [__queryImageUrlBlockingForJava__] - */ - @JvmName("queryImageUrlAsync") - fun __queryImageUrlAsyncForJava__(image: Image): Future<String> { - return future { image.queryUrl() } - } -} - -private inline fun <R> BotJavaFriendlyAPI.future(crossinline block: suspend Bot.() -> R): Future<R> { - return (this as CoroutineScope).run { future { block(this as Bot) } } -} - -private inline fun <R> BotJavaFriendlyAPI.runBlocking(crossinline block: suspend Bot.() -> R): R { - return kotlinx.coroutines.runBlocking { block(this@runBlocking as Bot) } -} - -@OptIn(ExperimentalCoroutinesApi::class) -internal fun <R, C : CoroutineScope> C.future(block: suspend C.() -> R): Future<R> { - val future = object : Future<R> { - val value: CompletableDeferred<R> = 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-api/src/jvmMain/kotlin/contact/ContactJavaFriendlyAPI.kt b/mirai-core-api/src/jvmMain/kotlin/contact/ContactJavaFriendlyAPI.kt deleted file mode 100644 index b2593d4b2..000000000 --- a/mirai-core-api/src/jvmMain/kotlin/contact/ContactJavaFriendlyAPI.kt +++ /dev/null @@ -1,365 +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.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.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 net.mamoe.mirai.utils.UnstableExternalImage -import java.awt.image.BufferedImage -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 interface ContactJavaFriendlyAPI { - /** - * 向这个对象发送消息. - * - * 单条消息最大可发送 4500 字符或 50 张图片. - * - * @see FriendMessageSendEvent 发送好友信息事件, cancellable - * @see GroupMessageSendEvent 发送群消息事件. cancellable - * - * @throws EventCancelledException 当发送消息事件被取消时抛出 - * @throws BotIsBeingMutedException 发送群消息时若 [Bot] 被禁言抛出 - * @throws MessageTooLargeException 当消息过长时抛出 - * - * @return 消息回执. 可 [引用回复][MessageReceipt.quote](仅群聊)或 [撤回][MessageReceipt.recall] 这条消息. - */ - @Throws(EventCancelledException::class, IllegalStateException::class) - @JvmName("sendMessage") - fun __sendMessageBlockingForJava__(message: Message): MessageReceipt<Contact> { - return runBlocking { sendMessage(message) } - } - - @Throws(EventCancelledException::class, IllegalStateException::class) - @JvmName("sendMessage") - fun __sendMessageBlockingForJava__(message: String): MessageReceipt<Contact> { - return runBlocking { sendMessage(message) } - } - - /** - * 上传一个图片以备发送. - * - * @see BeforeImageUploadEvent 图片发送前事件, cancellable - * @see ImageUploadEvent 图片发送完成事件 - * - * @throws EventCancelledException 当发送消息事件被取消 - * @throws OverFileSizeMaxException 当图片文件过大而被服务器拒绝上传时. (最大大小约为 20 MB) - */ - @UnstableExternalImage - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - fun __uploadImageBlockingForJava__(image: ExternalImage): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @Suppress("DEPRECATION") - @JvmName("uploadImage") - fun __uploadImageBlockingForJava__(image: URL): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - fun __uploadImageBlockingForJava__(image: InputStream): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Deprecated( - "已弃用对 kotlinx.io 的支持", - level = DeprecationLevel.ERROR - ) - @Suppress("DEPRECATION_ERROR") - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - fun __uploadImageBlockingForJava__(image: Input): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将文件作为图片上传, 但不发送 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - fun __uploadImageBlockingForJava__(image: File): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将图片上传, 但不发送. 不会保存临时文件 - * @throws OverFileSizeMaxException - */ - @Throws(OverFileSizeMaxException::class) - @JvmName("uploadImage") - fun __uploadImageBlockingForJava__(image: BufferedImage): Image { - return runBlocking { uploadImage(image) } - } - - /** - * 发送消息 - * @see Contact.sendMessage - */ - @JvmName("sendMessageAsync") - @Deprecated("已停止支持 Java async API", level = DeprecationLevel.WARNING) - fun __sendMessageAsyncForJava__(message: Message): Future<MessageReceipt<Contact>> { - return future { sendMessage(message) } - } - - /** - * 发送消息 - * @see Contact.sendMessage - */ - @JvmName("sendMessageAsync") - @Deprecated("已停止支持 Java async API", level = DeprecationLevel.WARNING) - fun __sendMessageAsyncForJava__(message: String): Future<MessageReceipt<Contact>> { - return future { sendMessage(message) } - } - - /** - * 上传一个图片以备发送. - * - * @see BeforeImageUploadEvent 图片发送前事件, cancellable - * @see ImageUploadEvent 图片发送完成事件 - */ - @UnstableExternalImage - @JvmName("uploadImageAsync") - @Deprecated("已停止支持 Java async API", level = DeprecationLevel.WARNING) - fun __uploadImageAsyncForJava__(image: ExternalImage): Future<Image> { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中下载 [URL] 到临时文件并将其作为图片上传, 但不发送 - */ - @Deprecated("已停止支持 Java async API", level = DeprecationLevel.WARNING) - @Suppress("DEPRECATION") - @JvmName("uploadImageAsync") - fun __uploadImageAsyncForJava__(image: URL): Future<Image> { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [InputStream] 到临时文件并将其作为图片上传, 但不发送 - */ - @Deprecated("已停止支持 Java async API", level = DeprecationLevel.WARNING) - @JvmName("uploadImageAsync") - fun __uploadImageAsyncForJava__(image: InputStream): Future<Image> { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中读取 [Input] 到临时文件并将其作为图片上传, 但不发送 - */ - @Suppress("DEPRECATION_ERROR") - @Deprecated( - "已弃用对 kotlinx.io 的支持", - level = DeprecationLevel.ERROR - ) - @JvmName("uploadImageAsync") - fun __uploadImageAsyncForJava__(image: Input): Future<Image> { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将文件作为图片上传, 但不发送 - */ - @JvmName("uploadImageAsync") - @Deprecated("已停止支持 Java async API", level = DeprecationLevel.WARNING) - fun __uploadImageAsyncForJava__(image: File): Future<Image> { - return future { uploadImage(image) } - } - - /** - * 在 [Dispatchers.IO] 中将图片上传, 但不发送. 不会保存临时文件 - */ - @JvmName("uploadImageAsync") - @Deprecated("已停止支持 Java async API", level = DeprecationLevel.WARNING) - fun __uploadImageAsyncForJava__(image: BufferedImage): Future<Image> { - return future { uploadImage(image) } - } -} - -@JavaFriendlyAPI -private inline fun <R> ContactJavaFriendlyAPI.runBlocking(crossinline block: suspend Contact.() -> R): R { - @Suppress("CAST_NEVER_SUCCEEDS") - return kotlinx.coroutines.runBlocking { block(this@runBlocking as Contact) } -} - -@JavaFriendlyAPI -private inline fun <R> ContactJavaFriendlyAPI.future(crossinline block: suspend Contact.() -> R): Future<R> { - @Suppress("CAST_NEVER_SUCCEEDS") - return (this as Contact).run { future { block() } } -} - -@Suppress("INAPPLICABLE_JVM_NAME", "FunctionName", "unused", "unused", "DEPRECATION_ERROR") -@JavaFriendlyAPI -internal actual interface MemberJavaFriendlyAPI { - - - /** - * 禁言. - * - * QQ 中最小操作和显示的时间都是一分钟. - * 机器人可以实现精确到秒, 会被客户端显示为 1 分钟但不影响实际禁言时间. - * - * 管理员可禁言成员, 群主可禁言管理员和群员. - * - * @param seconds 持续时间. 精确到秒. 范围区间表示为 `(0s, 30days]`. 超过范围则会抛出异常. - * @return 机器人无权限时返回 `false` - * - * @see Int.minutesToSeconds - * @see Int.hoursToSeconds - * @see Int.daysToSeconds - * - * @see MemberMuteEvent 成员被禁言事件 - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("mute") - fun __muteBlockingForJava__(seconds: Int) { - runBlocking { mute(seconds) } - } - - /** - * 解除禁言. - * - * 管理员可解除成员的禁言, 群主可解除管理员和群员的禁言. - * - * @see MemberUnmuteEvent 成员被取消禁言事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("unmute") - fun __unmuteBlockingForJava__() { - runBlocking { unmute() } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kick") - fun __kickBlockingForJava__(message: String = "") { - runBlocking { kick(message) } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kick") - fun __kickBlockingForJava__() = __kickBlockingForJava__("") - - - /** - * 禁言. - * - * QQ 中最小操作和显示的时间都是一分钟. - * 机器人可以实现精确到秒, 会被客户端显示为 1 分钟但不影响实际禁言时间. - * - * 管理员可禁言成员, 群主可禁言管理员和群员. - * - * @param seconds 持续时间. 精确到秒. 范围区间表示为 `(0s, 30days]`. 超过范围则会抛出异常. - * @return 机器人无权限时返回 `false` - * - * @see Int.minutesToSeconds - * @see Int.hoursToSeconds - * @see Int.daysToSeconds - * - * @see MemberMuteEvent 成员被禁言事件 - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("muteAsync") - fun __muteAsyncForJava__(seconds: Int): Future<Unit> { - return future { mute(seconds) } - } - - /** - * 解除禁言. - * - * 管理员可解除成员的禁言, 群主可解除管理员和群员的禁言. - * - * @see MemberUnmuteEvent 成员被取消禁言事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("unmuteAsync") - fun __unmuteAsyncForJava__(): Future<Unit> { - return future { unmute() } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kickAsync") - fun __kickAsyncForJava__(message: String = ""): Future<Unit> { - return future { kick(message) } - } - - /** - * 踢出该成员. - * - * 管理员可踢出成员, 群主可踢出管理员和群员. - * - * @see MemberLeaveEvent.Kick 成员被踢出事件. - * @throws PermissionDeniedException 无权限修改时 - */ - @JvmName("kickAsync") - fun __kickAsyncForJava__(): Future<Unit> = __kickAsyncForJava__("") -} - -@JavaFriendlyAPI -private inline fun <R> MemberJavaFriendlyAPI.future(crossinline block: suspend Member.() -> R): Future<R> { - @Suppress("CAST_NEVER_SUCCEEDS") - return (this as Member).run { future { block() } } -} - -@JavaFriendlyAPI -private inline fun <R> MemberJavaFriendlyAPI.runBlocking(crossinline block: suspend Member.() -> R): R { - @Suppress("CAST_NEVER_SUCCEEDS") - return kotlinx.coroutines.runBlocking { block(this@runBlocking as Member) } -} \ No newline at end of file diff --git a/mirai-core-api/src/jvmMain/kotlin/event/JvmMethodListeners.kt b/mirai-core-api/src/jvmMain/kotlin/event/JvmMethodListeners.kt index 6e2f89f8f..71cbf599a 100644 --- a/mirai-core-api/src/jvmMain/kotlin/event/JvmMethodListeners.kt +++ b/mirai-core-api/src/jvmMain/kotlin/event/JvmMethodListeners.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/jvmMain/kotlin/event/internal/EventInternalJvm.kt b/mirai-core-api/src/jvmMain/kotlin/event/internal/EventInternalJvm.kt index a3a5438e9..6ca7e8b57 100644 --- a/mirai-core-api/src/jvmMain/kotlin/event/internal/EventInternalJvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/event/internal/EventInternalJvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") diff --git a/mirai-core-api/src/jvmMain/kotlin/event/internal/GlobalEventListeners.kt b/mirai-core-api/src/jvmMain/kotlin/event/internal/GlobalEventListeners.kt index 87d3c1bdf..295b9c130 100644 --- a/mirai-core-api/src/jvmMain/kotlin/event/internal/GlobalEventListeners.kt +++ b/mirai-core-api/src/jvmMain/kotlin/event/internal/GlobalEventListeners.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event.internal diff --git a/mirai-core-api/src/jvmMain/kotlin/event/internal/MiraiAtomicBoolean.kt b/mirai-core-api/src/jvmMain/kotlin/event/internal/MiraiAtomicBoolean.kt index d48b715e9..6244a19ab 100644 --- a/mirai-core-api/src/jvmMain/kotlin/event/internal/MiraiAtomicBoolean.kt +++ b/mirai-core-api/src/jvmMain/kotlin/event/internal/MiraiAtomicBoolean.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event.internal diff --git a/mirai-core-api/src/jvmMain/kotlin/findMiraiInstance.kt b/mirai-core-api/src/jvmMain/kotlin/findMiraiInstance.kt new file mode 100644 index 000000000..47f9983b4 --- /dev/null +++ b/mirai-core-api/src/jvmMain/kotlin/findMiraiInstance.kt @@ -0,0 +1,17 @@ +/* + * 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + +package net.mamoe.mirai + +import java.util.* + +internal actual fun findMiraiInstance(): Mirai { + return ServiceLoader.load(Mirai::class.java).findFirst() as Mirai? + ?: Class.forName("net.mamoe.mirai.internal.MiraiImpl").kotlin.objectInstance as Mirai +} \ No newline at end of file diff --git a/mirai-core-api/src/jvmMain/kotlin/message/MessageEventPlatform.kt b/mirai-core-api/src/jvmMain/kotlin/message/MessageEventPlatform.kt index 718e07c9c..121c5a103 100644 --- a/mirai-core-api/src/jvmMain/kotlin/message/MessageEventPlatform.kt +++ b/mirai-core-api/src/jvmMain/kotlin/message/MessageEventPlatform.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused") diff --git a/mirai-core-api/src/jvmMain/kotlin/message/SendImageUtilsJvm.kt b/mirai-core-api/src/jvmMain/kotlin/message/SendImageUtilsJvm.kt index 24ccf0a11..ee66b75b9 100644 --- a/mirai-core-api/src/jvmMain/kotlin/message/SendImageUtilsJvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/message/SendImageUtilsJvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ /** @@ -96,7 +96,7 @@ public suspend fun File.uploadAsImage(contact: Contact): Image { * @throws OverFileSizeMaxException */ @Throws(OverFileSizeMaxException::class) -@MiraiExperimentalAPI("语音支持处于实验性阶段") +@MiraiExperimentalApi("语音支持处于实验性阶段") @SinceMirai("1.2.0") public suspend fun InputStream.uploadAsGroupVoice(group: Group): Voice { return group.uploadVoice(this) diff --git a/mirai-core-api/src/jvmMain/kotlin/message/data/Image.kt b/mirai-core-api/src/jvmMain/kotlin/message/data/Image.kt index 4e61931a3..fbd27c3de 100644 --- a/mirai-core-api/src/jvmMain/kotlin/message/data/Image.kt +++ b/mirai-core-api/src/jvmMain/kotlin/message/data/Image.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass @@ -83,14 +83,4 @@ public actual interface Image : Message, MessageContent, CodableMessage { * @see Image 使用 id 构造图片 */ public actual val imageId: String - - - @Deprecated( - """ - 不要自行实现 OnlineGroupImage, 它必须由协议模块实现, 否则会无法发送也无法解析. - """, level = DeprecationLevel.HIDDEN - ) - @Suppress("WRONG_MODIFIER_CONTAINING_DECLARATION", "PropertyName", "unused") - @get:JvmSynthetic - internal actual val DoNotImplementThisClass: Nothing? } \ No newline at end of file diff --git a/mirai-core-api/src/jvmMain/kotlin/message/deprecated.kt b/mirai-core-api/src/jvmMain/kotlin/message/deprecated.kt index 039c44c16..a8d909f3d 100644 --- a/mirai-core-api/src/jvmMain/kotlin/message/deprecated.kt +++ b/mirai-core-api/src/jvmMain/kotlin/message/deprecated.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DEPRECATION", "DEPRECATION_ERROR") diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/BotConfiguration.kt b/mirai-core-api/src/jvmMain/kotlin/utils/BotConfiguration.kt index 686be7d26..bcf58c31c 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/BotConfiguration.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/BotConfiguration.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("unused", "DEPRECATION_ERROR", "EXPOSED_SUPER_CLASS") diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/Context.kt b/mirai-core-api/src/jvmMain/kotlin/utils/Context.kt index 0be69b114..a79bd379a 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/Context.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/Context.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/DeviceInfoUtils.kt b/mirai-core-api/src/jvmMain/kotlin/utils/DeviceInfoUtils.kt index eb5fd98e3..bdc2a166b 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/DeviceInfoUtils.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/DeviceInfoUtils.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/ExternalImageJvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/ExternalImageJvm.kt index 387cf7aea..3c048cad7 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/ExternalImageJvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/ExternalImageJvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused") diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/FileCacheStrategy.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/FileCacheStrategy.jvm.kt index 5004da957..f24984f39 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/FileCacheStrategy.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/FileCacheStrategy.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("MemberVisibilityCanBePrivate") @@ -29,13 +29,13 @@ import javax.imageio.ImageIO * * @see BotConfiguration.fileCacheStrategy 为 [Bot] 指定缓存策略 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public actual interface FileCacheStrategy { /** * 将 [input] 缓存为 [ExternalImage]. * 此函数应 close 这个 [Input] */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public actual fun newImageCache(input: Input): ExternalImage @@ -43,7 +43,7 @@ public actual interface FileCacheStrategy { * 将 [input] 缓存为 [ExternalImage]. * 此函数应 close 这个 [InputStream] */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public fun newImageCache(input: InputStream): ExternalImage @@ -51,7 +51,7 @@ public actual interface FileCacheStrategy { * 将 [input] 缓存为 [ExternalImage]. * 此 [input] 的内容应是不变的. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public actual fun newImageCache(input: ByteArray): ExternalImage @@ -59,53 +59,53 @@ public actual interface FileCacheStrategy { * 将 [input] 缓存为 [ExternalImage]. * 此 [input] 的内容应是不变的. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public fun newImageCache(input: BufferedImage, format: String = "png"): ExternalImage /** * 将 [input] 缓存为 [ExternalImage]. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) public fun newImageCache(input: URL): ExternalImage /** * 默认的缓存方案, 使用系统临时文件夹存储. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public actual object PlatformDefault : FileCacheStrategy by TempCache(null) /** * 使用内存直接存储所有图片文件. */ public actual object MemoryCache : FileCacheStrategy { - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) actual override fun newImageCache(input: Input): ExternalImage { return newImageCache(input.readBytes()) } - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) override fun newImageCache(input: InputStream): ExternalImage { return newImageCache(input.readBytes()) } - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) actual override fun newImageCache(input: ByteArray): ExternalImage { return ExternalImage(input.asReusableInput()) } - @MiraiExperimentalAPI + @MiraiExperimentalApi override fun newImageCache(input: BufferedImage, format: String): ExternalImage { val out = ByteArrayOutputStream() ImageIO.write(input, format, out) return newImageCache(out.toByteArray()) } - @MiraiExperimentalAPI + @MiraiExperimentalApi override fun newImageCache(input: URL): ExternalImage { val out = ByteArrayOutputStream() input.openConnection().getInputStream().use { it.copyTo(out) } @@ -116,14 +116,14 @@ public actual interface FileCacheStrategy { /** * 使用系统临时文件夹缓存图片文件. 在图片使用完毕后删除临时文件. */ - @MiraiExperimentalAPI + @MiraiExperimentalApi public class TempCache @JvmOverloads constructor( /** * 缓存图片存放位置. 为 `null` 时使用主机系统的临时文件夹 */ public val directory: File? = null ) : FileCacheStrategy { - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) override fun newImageCache(input: Input): ExternalImage { return ExternalImage(createTempFile(directory = directory).apply { @@ -132,7 +132,7 @@ public actual interface FileCacheStrategy { }.asReusableInput(true)) } - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) override fun newImageCache(input: InputStream): ExternalImage { return ExternalImage(createTempFile(directory = directory).apply { @@ -141,13 +141,13 @@ public actual interface FileCacheStrategy { }.asReusableInput(true)) } - @MiraiExperimentalAPI + @MiraiExperimentalApi @Throws(IOException::class) override fun newImageCache(input: ByteArray): ExternalImage { return ExternalImage(input.asReusableInput()) } - @MiraiExperimentalAPI + @MiraiExperimentalApi override fun newImageCache(input: BufferedImage, format: String): ExternalImage { val file = createTempFile(directory = directory).apply { deleteOnExit() } @@ -177,7 +177,7 @@ public actual interface FileCacheStrategy { return ExternalImage(file.asReusableInput(true, digest.digest())) } - @MiraiExperimentalAPI + @MiraiExperimentalApi override fun newImageCache(input: URL): ExternalImage { return ExternalImage(createTempFile(directory = directory).apply { deleteOnExit() diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/FileLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/FileLogger.kt index 83a5cf6c4..322ebcb3d 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/FileLogger.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/FileLogger.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/HyperLinkLabel.kt b/mirai-core-api/src/jvmMain/kotlin/utils/HyperLinkLabel.kt index ba0bbd1ee..64b07f3c0 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/HyperLinkLabel.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/HyperLinkLabel.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/LoggerAdapters.kt b/mirai-core-api/src/jvmMain/kotlin/utils/LoggerAdapters.kt index b35382c1b..3f5e388e4 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/LoggerAdapters.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/LoggerAdapters.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt index afdff098a..4800e0431 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils @@ -33,7 +33,7 @@ import kotlin.coroutines.CoroutineContext /** * 自动选择 [SwingSolver] 或 [StandardCharImageLoginSolver] */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public class DefaultLoginSolver( public val input: suspend () -> String, public val overrideLogger: MiraiLogger? = null @@ -64,7 +64,7 @@ public class DefaultLoginSolver( /** * 使用字符图片展示验证码, 使用 [input] 获取输入, 使用 [overrideLogger] 输出 */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public class StandardCharImageLoginSolver( input: suspend () -> String, /** diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.swing.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.swing.jvm.kt index 3972579da..9cfd3dd55 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.swing.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.swing.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils @@ -19,7 +19,7 @@ import javax.swing.JLabel /** * @author Karlatemp <karlatemp@vip.qq.com> <https://github.com/Karlatemp> */ -@MiraiExperimentalAPI +@MiraiExperimentalApi public object SwingSolver : LoginSolver() { public override suspend fun onSolvePicCaptcha(bot: Bot, data: ByteArray): String? { return openWindow("Mirai PicCaptcha(${bot.id})") { diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/OverFileSizeMaxException.kt b/mirai-core-api/src/jvmMain/kotlin/utils/OverFileSizeMaxException.kt index 8dad5642c..ec4ee5df2 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/OverFileSizeMaxException.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/OverFileSizeMaxException.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/PlatformLogger.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/PlatformLogger.jvm.kt index a8f9a782f..73c195c10 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/PlatformLogger.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/PlatformLogger.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmName("Utils") @@ -112,7 +112,7 @@ public actual open class PlatformLogger @JvmOverloads constructor( private val currentTimeFormatted get() = timeFormat.format(Date()) - @MiraiExperimentalAPI("This is subject to change.") + @MiraiExperimentalApi("This is subject to change.") @SinceMirai("1.1.0") protected enum class Color(private val format: String) { RESET("\u001b[0m"), diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/PlatformUtilsJvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/PlatformUtilsJvm.kt index 9b74c65d6..2ab9a6f58 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/PlatformUtilsJvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/PlatformUtilsJvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/WeakRef.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/WeakRef.jvm.kt index 5182ad485..557b0bf8d 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/WeakRef.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/WeakRef.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/WindowHelperJvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/WindowHelperJvm.kt index 950671986..6b0a6bb01 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/WindowHelperJvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/WindowHelperJvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/internal/DeferredReusableInput.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/DeferredReusableInput.jvm.kt index acc4bea23..b2f401d01 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/internal/DeferredReusableInput.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/DeferredReusableInput.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/internal/asReusableInput.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/asReusableInput.jvm.kt index 91684ea6d..6daac0cd7 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/internal/asReusableInput.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/asReusableInput.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/JdkLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/JdkLogger.kt index 69f1f8869..1365cbc1c 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/JdkLogger.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/JdkLogger.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal.logging diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Log4jLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Log4jLogger.kt index 668926445..5a825b46c 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Log4jLogger.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Log4jLogger.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal.logging diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Slf4jLogger.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Slf4jLogger.kt index 2a3bcea7a..bdd97bbae 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Slf4jLogger.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/logging/Slf4jLogger.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal.logging diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/internal/md5.jvm.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/md5.jvm.kt index 0347563db..902a98d05 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/internal/md5.jvm.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/md5.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused") diff --git a/mirai-core-api/src/jvmMain/kotlin/utils/internal/runBlocking.kt b/mirai-core-api/src/jvmMain/kotlin/utils/internal/runBlocking.kt index c51b9b0ae..8d63864f7 100644 --- a/mirai-core-api/src/jvmMain/kotlin/utils/internal/runBlocking.kt +++ b/mirai-core-api/src/jvmMain/kotlin/utils/internal/runBlocking.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.utils.internal diff --git a/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java b/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java index 3cd8058fa..b97fc8a9d 100644 --- a/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java +++ b/mirai-core-api/src/jvmTest/java/net/mamoe/mirai/event/JvmMethodEventsTestJava.java @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event; diff --git a/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt b/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt index 05c97841c..1e6c67c2f 100644 --- a/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/CancelScopeTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event diff --git a/mirai-core-api/src/jvmTest/kotlin/event/EventTests.kt b/mirai-core-api/src/jvmTest/kotlin/event/EventTests.kt index 5b165f963..4df3252c9 100644 --- a/mirai-core-api/src/jvmTest/kotlin/event/EventTests.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/EventTests.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.event diff --git a/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt index 30a917590..e14070ffd 100644 --- a/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/event/JvmMethodEventsTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("RedundantSuspendModifier", "unused", "UNUSED_PARAMETER") diff --git a/mirai-core-api/src/jvmTest/kotlin/message/SubscribingGetTest.kt b/mirai-core-api/src/jvmTest/kotlin/message/SubscribingGetTest.kt index 4e0f6d676..959c9458f 100644 --- a/mirai-core-api/src/jvmTest/kotlin/message/SubscribingGetTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/message/SubscribingGetTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 diff --git a/mirai-core-api/src/jvmTest/kotlin/package.kt b/mirai-core-api/src/jvmTest/kotlin/package.kt index eb9e446d0..5d50126be 100644 --- a/mirai-core-api/src/jvmTest/kotlin/package.kt +++ b/mirai-core-api/src/jvmTest/kotlin/package.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 \ No newline at end of file diff --git a/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt b/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt index c60eea92e..ea1e515ed 100644 --- a/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt +++ b/mirai-core-api/src/jvmTest/kotlin/utils/LockFreeLinkedListTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("RemoveRedundantBackticks", "NonAsciiCharacters") @@ -12,8 +12,6 @@ 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 @@ -22,7 +20,7 @@ import kotlin.test.assertFalse import kotlin.test.assertTrue @Suppress("UnusedEquals") -@MiraiExperimentalAPI +@MiraiExperimentalApi internal class LockFreeLinkedListTest { @Test fun addAndGetSingleThreaded() { @@ -274,7 +272,7 @@ internal class LockFreeLinkedListTest { } @OptIn(ExperimentalCoroutinesApi::class) -@MiraiExperimentalAPI +@MiraiExperimentalApi internal suspend inline fun <E : LockFreeLinkedList<*>> E.concurrentDo( numberOfCoroutines: Int, times: Int, diff --git a/mirai-core-api/src/jvmTest/kotlin/utils/StepUtil.kt b/mirai-core-api/src/jvmTest/kotlin/utils/StepUtil.kt index d4ee71775..9b7af052b 100644 --- a/mirai-core-api/src/jvmTest/kotlin/utils/StepUtil.kt +++ b/mirai-core-api/src/jvmTest/kotlin/utils/StepUtil.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 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 许可证的约束, 可以在以下链接找到该许可证. diff --git a/mirai-core-api/src/main/AndroidManifest.xml b/mirai-core-api/src/main/AndroidManifest.xml index 544a92e64..decfa82ab 100644 --- a/mirai-core-api/src/main/AndroidManifest.xml +++ b/mirai-core-api/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + ~ + ~ https://github.com/mamoe/mirai/blob/master/LICENSE + --> + <manifest package="net.mamoe.mirai" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> diff --git a/mirai-core/build.gradle.kts b/mirai-core/build.gradle.kts index b0e6c91f0..a69216df2 100644 --- a/mirai-core/build.gradle.kts +++ b/mirai-core/build.gradle.kts @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("UNUSED_VARIABLE") import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet diff --git a/mirai-core/src/commonMain/kotlin/BotAccount.kt b/mirai-core/src/commonMain/kotlin/BotAccount.kt index 9c457ab81..d5361cce3 100644 --- a/mirai-core/src/commonMain/kotlin/BotAccount.kt +++ b/mirai-core/src/commonMain/kotlin/BotAccount.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") @@ -12,14 +12,14 @@ package net.mamoe.mirai.internal import kotlinx.io.core.toByteArray import net.mamoe.mirai.internal.utils.MiraiPlatformUtils -import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiExperimentalApi import kotlin.jvm.JvmSynthetic internal data class BotAccount( @JvmSynthetic internal val id: Long, @JvmSynthetic - @MiraiExperimentalAPI + @MiraiExperimentalApi val passwordMd5: ByteArray // md5 ) { constructor(id: Long, passwordPlainText: String) : this(id, MiraiPlatformUtils.md5(passwordPlainText.toByteArray())) diff --git a/mirai-core/src/commonMain/kotlin/BotFactory.kt b/mirai-core/src/commonMain/kotlin/BotFactory.kt index 87640c0e3..85b0ff000 100644 --- a/mirai-core/src/commonMain/kotlin/BotFactory.kt +++ b/mirai-core/src/commonMain/kotlin/BotFactory.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress( "FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith", @@ -15,7 +15,7 @@ package net.mamoe.mirai.internal import net.mamoe.mirai.Bot import net.mamoe.mirai.BotFactory -import net.mamoe.mirai.internal.QQAndroid.Bot +import net.mamoe.mirai.internal.BotFactoryImpl.Bot import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.Context import kotlin.jvm.JvmName @@ -24,7 +24,7 @@ import kotlin.jvm.JvmName * QQ for Android */ @Suppress("INAPPLICABLE_JVM_NAME") -expect object QQAndroid : BotFactory { +expect object BotFactoryImpl : BotFactory { /** * 使用指定的 [配置][configuration] 构造 [Bot] 实例 diff --git a/mirai-core/src/commonMain/kotlin/BotImpl.kt b/mirai-core/src/commonMain/kotlin/BotImpl.kt index d00791d40..712042e17 100644 --- a/mirai-core/src/commonMain/kotlin/BotImpl.kt +++ b/mirai-core/src/commonMain/kotlin/BotImpl.kt @@ -1,11 +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. + * 此源代码的使用受 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 */ + @file:Suppress( "EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR", diff --git a/mirai-core/src/commonMain/kotlin/MiraiImpl.kt b/mirai-core/src/commonMain/kotlin/MiraiImpl.kt new file mode 100644 index 000000000..c9cd6c37b --- /dev/null +++ b/mirai-core/src/commonMain/kotlin/MiraiImpl.kt @@ -0,0 +1,845 @@ +/* + * 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. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + +package net.mamoe.mirai.internal + +import io.ktor.client.request.* +import io.ktor.client.request.forms.* +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.withContext +import kotlinx.serialization.json.int +import kotlinx.serialization.json.jsonObject +import kotlinx.serialization.json.jsonPrimitive +import net.mamoe.mirai.* +import net.mamoe.mirai.contact.* +import net.mamoe.mirai.data.* +import net.mamoe.mirai.event.broadcast +import net.mamoe.mirai.event.events.BotInvitedJoinGroupRequestEvent +import net.mamoe.mirai.event.events.MemberJoinRequestEvent +import net.mamoe.mirai.event.events.MessageRecallEvent +import net.mamoe.mirai.event.events.NewFriendRequestEvent +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.highway.HighwayHelper +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.utils.BotConfiguration +import net.mamoe.mirai.utils.MiraiExperimentalApi +import net.mamoe.mirai.utils.currentTimeSeconds +import kotlin.jvm.JvmSynthetic +import kotlin.math.absoluteValue +import kotlin.random.Random + +@OptIn(LowLevelApi::class) +internal object MiraiImpl : Mirai, LowLevelApiAccessor { + override val BotFactory: BotFactory + get() = BotFactoryImpl + + @OptIn(LowLevelApi::class) + override suspend fun acceptNewFriendRequest(event: NewFriendRequestEvent) { + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + check(event.responded.compareAndSet(expect = false, update = true)) { + "the request $this has already been responded" + } + + check(!event.bot.friends.contains(event.fromId)) { + "the request $event is outdated: You had already responded it on another device." + } + + _lowLevelSolveNewFriendRequestEvent( + event.bot, + eventId = event.eventId, + fromId = event.fromId, + fromNick = event.fromNick, + accept = true, + blackList = false + ) + } + + override suspend fun rejectNewFriendRequest(event: NewFriendRequestEvent, blackList: Boolean) { + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + check(event.responded.compareAndSet(false, true)) { + "the request $event has already been responded" + } + + check(!event.bot.friends.contains(event.fromId)) { + "the request $event is outdated: You had already responded it on another device." + } + + _lowLevelSolveNewFriendRequestEvent( + event.bot, + eventId = event.eventId, + fromId = event.fromId, + fromNick = event.fromNick, + accept = false, + blackList = blackList + ) + } + + override suspend fun acceptMemberJoinRequest(event: MemberJoinRequestEvent) { + @Suppress("DuplicatedCode") + checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" } + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + check(event.responded.compareAndSet(expect = false, update = true)) { + "the request $this has already been responded" + } + + check(!event.group.members.contains(event.fromId)) { + "the request $this is outdated: Another operator has already responded it." + } + + _lowLevelSolveMemberJoinRequestEvent( + bot = event.bot, + eventId = event.eventId, + fromId = event.fromId, + fromNick = event.fromNick, + groupId = event.groupId, + accept = true, + blackList = false + ) + } + + @Suppress("DuplicatedCode") + override suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean, message: String) { + checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" } + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + check(event.responded.compareAndSet(false, true)) { + "the request $this has already been responded" + } + + check(!event.group.members.contains(event.fromId)) { + "the request $this is outdated: Another operator has already responded it." + } + + _lowLevelSolveMemberJoinRequestEvent( + bot = event.bot, + eventId = event.eventId, + fromId = event.fromId, + fromNick = event.fromNick, + groupId = event.groupId, + accept = false, + blackList = blackList, + message = message + ) + } + + private inline fun checkGroupPermission(eventBot: Bot, eventGroup: Group, eventName: () -> String) { + val group = eventBot.getGroupOrNull(eventGroup.id) + ?: kotlin.run { + error( + "A ${eventName()} is outdated. Group ${eventGroup.id} not found for bot ${eventBot.id}. " + + "This is because bot isn't in the group anymore" + ) + + } + + group.checkBotPermission(MemberPermission.ADMINISTRATOR) + } + + override suspend fun ignoreMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean) { + checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" } + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + check(event.responded.compareAndSet(expect = false, update = true)) { + "the request $this has already been responded" + } + + _lowLevelSolveMemberJoinRequestEvent( + bot = event.bot, + eventId = event.eventId, + fromId = event.fromId, + fromNick = event.fromNick, + groupId = event.groupId, + accept = null, + blackList = blackList + ) + } + + override suspend fun acceptInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) = + solveInvitedJoinGroupRequest(event, accept = true) + + override suspend fun ignoreInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) = + solveInvitedJoinGroupRequest(event, accept = false) + + + private suspend fun solveInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent, accept: Boolean) { + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + check(event.responded.compareAndSet(false, true)) { + "the request $this has already been responded" + } + + check(!event.bot.groups.contains(event.groupId)) { + "the request $this is outdated: Bot has been already in the group." + } + + _lowLevelSolveBotInvitedJoinGroupRequestEvent( + bot = event.bot, + eventId = event.eventId, + invitorId = event.invitorId, + groupId = event.groupId, + accept = accept + ) + } + + @LowLevelApi + override fun _lowLevelNewFriend(bot: Bot, friendInfo: FriendInfo): Friend { + return FriendImpl( + bot.asQQAndroidBot(), + bot.coroutineContext + SupervisorJob(bot.supervisorJob), + friendInfo.uin, + friendInfo + ) + } + + + @OptIn(LowLevelApi::class) + override suspend fun _lowLevelQueryGroupList(bot: Bot): Sequence<Long> { + bot.asQQAndroidBot() + return bot.network.run { + FriendList.GetTroopListSimplify(bot.client) + .sendAndExpect<FriendList.GetTroopListSimplify.Response>(retry = 2) + }.groups.asSequence().map { it.groupUin.shl(32) and it.groupCode } + } + + @OptIn(LowLevelApi::class) + override suspend fun _lowLevelQueryGroupMemberList( + bot: Bot, + groupUin: Long, + groupCode: Long, + ownerId: Long + ): Sequence<MemberInfo> = + bot.asQQAndroidBot().network.run { + var nextUin = 0L + var sequence = sequenceOf<MemberInfoImpl>() + while (true) { + val data = FriendList.GetTroopMemberList( + client = bot.client, + targetGroupUin = groupUin, + targetGroupCode = groupCode, + nextUin = nextUin + ).sendAndExpect<FriendList.GetTroopMemberList.Response>(retry = 3) + sequence += data.members.asSequence().map { troopMemberInfo -> + MemberInfoImpl(troopMemberInfo, ownerId) + } + nextUin = data.nextUin + if (nextUin == 0L) { + break + } + } + return sequence + } + + @Suppress("RemoveExplicitTypeArguments") // false positive + override suspend fun recall(bot: Bot, source: MessageSource) = bot.asQQAndroidBot().run { + check(source is MessageSourceInternal) + + source.ensureSequenceIdAvailable() + + @Suppress("BooleanLiteralArgument", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") // false positive + check(!source.isRecalledOrPlanned.value && source.isRecalledOrPlanned.compareAndSet(false, true)) { + "$source had already been recalled." + } + + val response: PbMessageSvc.PbMsgWithDraw.Response = when (source) { + is MessageSourceToGroupImpl, + is MessageSourceFromGroupImpl + -> { + val group = when (source) { + is MessageSourceToGroupImpl -> source.target + is MessageSourceFromGroupImpl -> source.group + else -> error("stub") + } + if (bot.id != source.fromId) { + group.checkBotPermission(MemberPermission.ADMINISTRATOR) + } + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + MessageRecallEvent.GroupRecall( + bot, + source.fromId, + source.id, + source.internalId, + source.time, + null, + group + ).broadcast() + + network.run { + PbMessageSvc.PbMsgWithDraw.createForGroupMessage( + bot.asQQAndroidBot().client, + group.id, + source.sequenceId, + source.internalId + ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() + } + } + is MessageSourceFromFriendImpl, + is MessageSourceToFriendImpl + -> network.run { + check(source.fromId == bot.id) { + "can only recall a message sent by bot" + } + PbMessageSvc.PbMsgWithDraw.createForFriendMessage( + bot.client, + source.targetId, + source.sequenceId, + source.internalId, + source.time + ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() + } + is MessageSourceFromTempImpl, + is MessageSourceToTempImpl + -> network.run { + check(source.fromId == bot.id) { + "can only recall a message sent by bot" + } + source as MessageSourceToTempImpl + PbMessageSvc.PbMsgWithDraw.createForTempMessage( + bot.client, + (source.target.group as GroupImpl).uin, + source.targetId, + source.sequenceId, + source.internalId, + source.time + ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() + } + is OfflineMessageSource -> network.run { + when (source.kind) { + OfflineMessageSource.Kind.FRIEND -> { + check(source.fromId == bot.id) { + "can only recall a message sent by bot" + } + PbMessageSvc.PbMsgWithDraw.createForFriendMessage( + bot.client, + source.targetId, + source.sequenceId, + source.internalId, + source.time + ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() + } + OfflineMessageSource.Kind.TEMP -> { + check(source.fromId == bot.id) { + "can only recall a message sent by bot" + } + PbMessageSvc.PbMsgWithDraw.createForTempMessage( + bot.client, + source.targetId, // groupUin + source.targetId, // memberUin + source.sequenceId, + source.internalId, + source.time + ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() + } + OfflineMessageSource.Kind.GROUP -> { + PbMessageSvc.PbMsgWithDraw.createForGroupMessage( + bot.client, + source.targetId, + source.sequenceId, + source.internalId + ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() + } + } + } + else -> error("stub!") + } + + + // 1001: No message meets the requirements (实际上是没权限, 管理员在尝试撤回群主的消息) + // 154: timeout + // 3: <no message> + check(response is PbMessageSvc.PbMsgWithDraw.Response.Success) { "Failed to recall message #${source.id}: $response" } + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelGetAnnouncements( + bot: Bot, + groupId: Long, + page: Int, + amount: Int + ): GroupAnnouncementList = bot.asQQAndroidBot().run { + val rep = bot.asQQAndroidBot().network.run { + MiraiPlatformUtils.Http.post<String> { + url("https://web.qun.qq.com/cgi-bin/announce/list_announce") + body = MultiPartFormDataContent(formData { + append("qid", groupId) + append("bkn", bot.bkn) + append("ft", 23) //好像是一个用来识别应用的参数 + append("s", if (page == 1) 0 else -(page * amount + 1)) // 第一页这里的参数应该是-1 + append("n", amount) + append("ni", if (page == 1) 1 else 0) + append("format", "json") + }) + headers { + append( + "cookie", + "uin=o${id}; skey=${client.wLoginSigInfo.sKey.data.encodeToString()}; p_uin=o${id};" + ) + } + } + } +// bot.network.logger.error(rep) + return bot.json.decodeFromString(GroupAnnouncementList.serializer(), rep) + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelSendAnnouncement(bot: Bot, groupId: Long, announcement: GroupAnnouncement): String = + bot.asQQAndroidBot().run { + val rep = withContext(network.coroutineContext) { + MiraiPlatformUtils.Http.post<String> { + url("https://web.qun.qq.com/cgi-bin/announce/add_qun_notice") + body = MultiPartFormDataContent(formData { + append("qid", groupId) + append("bkn", bkn) + append("text", announcement.msg.text) + append("pinned", announcement.pinned) + append( + "settings", + json.encodeToString( + GroupAnnouncementSettings.serializer(), + announcement.settings ?: GroupAnnouncementSettings() + ) + ) + append("format", "json") + }) + headers { + append( + "cookie", + "uin=o${id};" + + " skey=${client.wLoginSigInfo.sKey.data.encodeToString()};" + + " p_uin=o${id};" + + " p_skey=${client.wLoginSigInfo.psKeyMap["qun.qq.com"]?.data?.encodeToString()}; " + ) + } + } + } + val jsonObj = json.parseToJsonElement(rep) + return jsonObj.jsonObject["new_fid"]?.jsonPrimitive?.content + ?: throw throw IllegalStateException("Send Announcement fail group:$groupId msg:${jsonObj.jsonObject["em"]} content:${announcement.msg.text}") + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelDeleteAnnouncement(bot: Bot, groupId: Long, fid: String) = bot.asQQAndroidBot().run { + val data = withContext(network.coroutineContext) { + MiraiPlatformUtils.Http.post<String> { + url("https://web.qun.qq.com/cgi-bin/announce/del_feed") + body = MultiPartFormDataContent(formData { + append("qid", groupId) + append("bkn", bkn) + append("fid", fid) + append("format", "json") + }) + headers { + append( + "cookie", + "uin=o${id};" + + " skey=${client.wLoginSigInfo.sKey.data.encodeToString()};" + + " p_uin=o${id};" + + " p_skey=${client.wLoginSigInfo.psKeyMap["qun.qq.com"]?.data?.encodeToString()}; " + ) + } + } + } + val jsonObj = json.parseToJsonElement(data) + if (jsonObj.jsonObject["ec"]?.jsonPrimitive?.int ?: 1 != 0) { + throw throw IllegalStateException("delete Announcement fail group:$groupId msg:${jsonObj.jsonObject["em"]} fid:$fid") + } + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelGetAnnouncement(bot: Bot, groupId: Long, fid: String): GroupAnnouncement = + bot.asQQAndroidBot().run { + val rep = network.run { + MiraiPlatformUtils.Http.post<String> { + url("https://web.qun.qq.com/cgi-bin/announce/get_feed") + body = MultiPartFormDataContent(formData { + append("qid", groupId) + append("bkn", bkn) + append("fid", fid) + append("format", "json") + }) + headers { + append( + "cookie", + "uin=o${id}; skey=${client.wLoginSigInfo.sKey.data.encodeToString()}; p_uin=o${id};" + ) + } + } + } + +// bot.network.logger.error(rep) + return json.decodeFromString(GroupAnnouncement.serializer(), rep) + + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelGetGroupActiveData(bot: Bot, groupId: Long, page: Int): GroupActiveData = + bot.asQQAndroidBot().run { + val rep = network.run { + MiraiPlatformUtils.Http.get<String> { + url("https://qqweb.qq.com/c/activedata/get_mygroup_data") + parameter("bkn", bkn) + parameter("gc", groupId) + if (page != -1) { + parameter("page", page) + } + headers { + append( + "cookie", + "uin=o${id}; skey=${client.wLoginSigInfo.sKey.data.encodeToString()}; p_uin=o${id};" + ) + } + } + } + return json.decodeFromString(GroupActiveData.serializer(), rep) + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelGetGroupHonorListData( + bot: Bot, + groupId: Long, + type: GroupHonorType + ): GroupHonorListData? = bot.asQQAndroidBot().run { + val rep = network.run { + MiraiPlatformUtils.Http.get<String> { + url("https://qun.qq.com/interactive/honorlist") + parameter("gc", groupId) + parameter("type", type.value) + headers { + append( + "cookie", + "uin=o${id};" + + " skey=${client.wLoginSigInfo.sKey.data.encodeToString()};" + + " p_uin=o${id};" + + " p_skey=${client.wLoginSigInfo.psKeyMap["qun.qq.com"]?.data?.encodeToString()}; " + ) + } + } + } + val jsonText = Regex("""window.__INITIAL_STATE__=(.+?)</script>""").find(rep)?.groupValues?.get(1) + return jsonText?.let { json.decodeFromString(GroupHonorListData.serializer(), it) } + } + + @JvmSynthetic + @LowLevelApi + @MiraiExperimentalApi + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + internal suspend fun lowLevelSendGroupLongOrForwardMessage( + bot: Bot, + groupCode: Long, + message: Collection<ForwardMessage.INode>, + isLong: Boolean, + forwardMessage: ForwardMessage? + ): MessageReceipt<Group> = bot.asQQAndroidBot().run { + message.forEach { + it.message.ensureSequenceIdAvailable() + } + + val group = getGroup(groupCode) + + val time = currentTimeSeconds + val sequenceId = client.atomicNextMessageSequenceId() + + network.run { + val data = message.calculateValidationDataForGroup( + sequenceId = sequenceId, + random = Random.nextInt().absoluteValue, + groupCode = groupCode + ) + + val response = + MultiMsg.ApplyUp.createForGroupLongMessage( + buType = if (isLong) 1 else 2, + client = bot.client, + messageData = data, + dstUin = Group.calculateGroupUinByGroupCode(groupCode) + ).sendAndExpect<MultiMsg.ApplyUp.Response>() + + val resId: String + when (response) { + is MultiMsg.ApplyUp.Response.MessageTooLarge -> + error( + "Internal error: message is too large, but this should be handled before sending. " + ) + is MultiMsg.ApplyUp.Response.RequireUpload -> { + resId = response.proto.msgResid + + val body = LongMsg.ReqBody( + subcmd = 1, + platformType = 9, + termType = 5, + msgUpReq = listOf( + LongMsg.MsgUpReq( + msgType = 3, // group + dstUin = Group.calculateGroupUinByGroupCode(groupCode), + msgId = 0, + msgUkey = response.proto.msgUkey, + needCache = 0, + storeType = 2, + msgContent = data.data + ) + ) + ).toByteArray(LongMsg.ReqBody.serializer()) + + HighwayHelper.uploadImageToServers( + bot, + response.proto.uint32UpIp.zip(response.proto.uint32UpPort), + response.proto.msgSig, + MiraiPlatformUtils.md5(body), + net.mamoe.mirai.utils.internal.asReusableInput0(body), // don't use toLongUnsigned: Overload resolution ambiguity + "group long message", + 27 + ) + } + } + + return if (isLong) { + group.sendMessage( + RichMessage.longMessage( + brief = message.joinToString(limit = 27) { it.message.contentToString() }, + resId = resId, + timeSeconds = time + ) + ) + } else { + checkNotNull(forwardMessage) { "Internal error: forwardMessage is null when sending forward" } + group.sendMessage( + RichMessage.forwardMessage( + resId = resId, + timeSeconds = time, + // preview = message.take(5).joinToString { + // """ + // <title size="26" color="#777777" maxLines="2" lineSpace="12">${it.message.asMessageChain().joinToString(limit = 10)}</title> + // """.trimIndent() + // }, + preview = forwardMessage.displayStrategy.generatePreview(forwardMessage).take(4) + .map { + """<title size="26" color="#777777" maxLines="2" lineSpace="12">$it</title>""" + }.joinToString(""), + title = forwardMessage.displayStrategy.generateTitle(forwardMessage), + brief = forwardMessage.displayStrategy.generateBrief(forwardMessage), + source = forwardMessage.displayStrategy.generateSource(forwardMessage), + summary = forwardMessage.displayStrategy.generateSummary(forwardMessage) + ) + ) + } + } + } + + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelSolveNewFriendRequestEvent( + bot: Bot, + eventId: Long, + fromId: Long, + fromNick: String, + accept: Boolean, + blackList: Boolean + ): Unit = bot.asQQAndroidBot().run { + network.apply { + NewContact.SystemMsgNewFriend.Action( + bot.client, + eventId = eventId, + fromId = fromId, + accept = accept, + blackList = blackList + ).sendWithoutExpect() + @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + bot.friends.delegate.addLast(_lowLevelNewFriend(bot, object : FriendInfo { + override val uin: Long get() = fromId + override val nick: String get() = fromNick + override val remark: String get() = "" + })) + } + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelSolveBotInvitedJoinGroupRequestEvent( + bot: Bot, + eventId: Long, + invitorId: Long, + groupId: Long, + accept: Boolean + ) = bot.asQQAndroidBot().run { + network.run { + NewContact.SystemMsgNewGroup.Action( + bot.client, + eventId = eventId, + fromId = invitorId, + groupId = groupId, + isInvited = true, + accept = accept + ).sendWithoutExpect() + } + } + + @LowLevelApi + @MiraiExperimentalApi + override suspend fun _lowLevelSolveMemberJoinRequestEvent( + bot: Bot, + eventId: Long, + fromId: Long, + fromNick: String, + groupId: Long, + accept: Boolean?, + blackList: Boolean, + message: String + ) = bot.asQQAndroidBot().run { + network.run { + NewContact.SystemMsgNewGroup.Action( + bot.client, + eventId = eventId, + fromId = fromId, + groupId = groupId, + isInvited = false, + accept = accept, + blackList = blackList, + message = message + ).sendWithoutExpect() + } + + if (accept ?: return@run) + groups[groupId].apply { + @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + members.delegate.addLast(newMember(object : MemberInfo { + override val nameCard: String get() = "" + override val permission: MemberPermission get() = MemberPermission.MEMBER + override val specialTitle: String get() = "" + override val muteTimestamp: Int get() = 0 + override val uin: Long get() = fromId + override val nick: String get() = fromNick + override val remark: String + get() = "" + })) + } + } + + @OptIn(ExperimentalStdlibApi::class) + @LowLevelApi + override suspend fun _lowLevelQueryGroupVoiceDownloadUrl( + bot: Bot, + md5: ByteArray, + groupId: Long, + dstUin: Long + ): String { + bot.asQQAndroidBot().network.run { + val response: PttStore.GroupPttDown.Response.DownLoadInfo = + PttStore.GroupPttDown(bot.client, groupId, dstUin, md5).sendAndExpect() + return "http://${response.strDomain}${response.downPara.encodeToString()}" + } + } + + @LowLevelApi + override suspend fun _lowLevelUploadVoice(bot: Bot, md5: ByteArray, groupId: Long) { + + } + + override fun createImage(imageId: String): Image { + return when { + imageId matches FRIEND_IMAGE_ID_REGEX_1 -> OfflineFriendImage(imageId) + imageId matches FRIEND_IMAGE_ID_REGEX_2 -> OfflineFriendImage(imageId) + imageId matches GROUP_IMAGE_ID_REGEX -> OfflineGroupImage(imageId) + else -> + @Suppress("INVISIBLE_MEMBER") + throw IllegalArgumentException("Illegal imageId: $imageId. $ILLEGAL_IMAGE_ID_EXCEPTION_MESSAGE") + } + } + + @Suppress("DEPRECATION", "OverridingDeprecatedMember") + override suspend fun queryImageUrl(bot: Bot, image: Image): String = when (image) { + is ConstOriginUrlAware -> image.originUrl + is DeferredOriginUrlAware -> image.getUrl(bot) + is SuspendDeferredOriginUrlAware -> image.getUrl(bot) + else -> error("Internal error: unsupported image class: ${image::class.simpleName}") + } + + @Suppress("CANNOT_OVERRIDE_INVISIBLE_MEMBER") + override suspend fun sendNudge(bot: Bot, nudge: Nudge, receiver: Contact): Boolean { + if (bot.configuration.protocol != BotConfiguration.MiraiProtocol.ANDROID_PHONE) { + throw UnsupportedOperationException("nudge is supported only with protocol ANDROID_PHONE") + } + bot.asQQAndroidBot() + + bot.network.run { + return if (receiver is Group) { + receiver.checkIsGroupImpl() + NudgePacket.troopInvoke( + client = bot.client, + messageReceiverGroupCode = receiver.id, + nudgeTargetId = nudge.target.id, + ).sendAndExpect<NudgePacket.Response>().success + } else { + NudgePacket.friendInvoke( + client = bot.client, + messageReceiverUin = receiver.id, + nudgeTargetId = nudge.target.id, + ).sendAndExpect<NudgePacket.Response>().success + } + } + } + + override fun constructMessageSource( + bot: Bot, + kind: OfflineMessageSource.Kind, + fromUin: Long, + targetUin: Long, + id: Int, + time: Int, + internalId: Int, + originalMessage: MessageChain + ): OfflineMessageSource { + return object : OfflineMessageSource(), MessageSourceInternal { + override val kind: Kind get() = kind + override val id: Int get() = id + override val bot: Bot get() = bot + override val time: Int get() = time + override val fromId: Long get() = fromUin + override val targetId: Long get() = targetUin + override val originalMessage: MessageChain get() = originalMessage + override val sequenceId: Int = id + override val internalId: Int = internalId + + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + override var isRecalledOrPlanned: net.mamoe.mirai.event.internal.MiraiAtomicBoolean = + net.mamoe.mirai.event.internal.MiraiAtomicBoolean(false) + + override fun toJceData(): ImMsgBody.SourceMsg { + return ImMsgBody.SourceMsg( + origSeqs = listOf(sequenceId), + senderUin = fromUin, + toUin = 0, + flag = 1, + elems = originalMessage.toRichTextElems(forGroup = kind == Kind.GROUP, withGeneralFlags = false), + type = 0, + time = time, + pbReserve = EMPTY_BYTE_ARRAY, + srcMsg = EMPTY_BYTE_ARRAY + ) + } + } + } + +} \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/QQAndroidBot.common.kt b/mirai-core/src/commonMain/kotlin/QQAndroidBot.common.kt index 03c7fcc96..cfb3b83a6 100644 --- a/mirai-core/src/commonMain/kotlin/QQAndroidBot.common.kt +++ b/mirai-core/src/commonMain/kotlin/QQAndroidBot.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") @@ -12,53 +12,23 @@ package net.mamoe.mirai.internal import io.ktor.client.request.* import io.ktor.client.request.forms.* -import kotlinx.coroutines.CoroutineName -import kotlinx.coroutines.async import kotlinx.coroutines.sync.Mutex -import kotlinx.coroutines.withContext -import kotlinx.serialization.json.int -import kotlinx.serialization.json.jsonObject -import kotlinx.serialization.json.jsonPrimitive import net.mamoe.mirai.Bot -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.* import net.mamoe.mirai.data.* -import net.mamoe.mirai.event.broadcast -import net.mamoe.mirai.event.events.BotInvitedJoinGroupRequestEvent -import net.mamoe.mirai.event.events.MemberJoinRequestEvent -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.utils.* -import kotlin.collections.asSequence import kotlin.contracts.contract import kotlin.coroutines.CoroutineContext import kotlin.jvm.JvmField -import kotlin.jvm.JvmSynthetic -import kotlin.math.absoluteValue -import kotlin.random.Random import net.mamoe.mirai.internal.network.protocol.data.jce.FriendInfo as JceFriendInfo internal fun Bot.asQQAndroidBot(): QQAndroidBot { @@ -74,184 +44,7 @@ internal class QQAndroidBot constructor( context: Context, account: BotAccount, configuration: BotConfiguration -) : QQAndroidBotBase(context, account, configuration) { - - @OptIn(LowLevelAPI::class) - override suspend fun acceptNewFriendRequest(event: NewFriendRequestEvent) { - check(event.bot === this) { - "the request $event is from Bot ${event.bot.id} but you are responding with bot ${this.id}" - } - - check(event.responded.compareAndSet(false, true)) { - "the request $this has already been responded" - } - - check(!friends.contains(event.fromId)) { - "the request $event is outdated: You had already responded it on another device." - } - - _lowLevelSolveNewFriendRequestEvent( - eventId = event.eventId, - fromId = event.fromId, - fromNick = event.fromNick, - accept = true, - blackList = false - ) - } - - override suspend fun rejectNewFriendRequest(event: NewFriendRequestEvent, blackList: Boolean) { - check(event.bot === this) { - "the request $event is from Bot ${event.bot.id} but you are responding with bot ${this.id}" - } - - check(event.responded.compareAndSet(false, true)) { - "the request $event has already been responded" - } - - check(!friends.contains(event.fromId)) { - "the request $event is outdated: You had already responded it on another device." - } - - _lowLevelSolveNewFriendRequestEvent( - eventId = event.eventId, - fromId = event.fromId, - fromNick = event.fromNick, - accept = false, - blackList = blackList - ) - } - - @OptIn(LowLevelAPI::class) - override suspend fun acceptMemberJoinRequest(event: MemberJoinRequestEvent) { - @Suppress("DuplicatedCode") - checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" } - check(event.responded.compareAndSet(false, true)) { - "the request $this has already been responded" - } - - check(!event.group.members.contains(event.fromId)) { - "the request $this is outdated: Another operator has already responded it." - } - - _lowLevelSolveMemberJoinRequestEvent( - eventId = event.eventId, - fromId = event.fromId, - fromNick = event.fromNick, - groupId = event.groupId, - accept = true, - blackList = false - ) - } - - @Suppress("DuplicatedCode") - @OptIn(LowLevelAPI::class) - override suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean) { - rejectMemberJoinRequest(event, blackList, "") - } - - @Suppress("DuplicatedCode") - @OptIn(LowLevelAPI::class) - override suspend fun rejectMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean, message: String) { - checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" } - check(event.responded.compareAndSet(false, true)) { - "the request $this has already been responded" - } - - check(!event.group.members.contains(event.fromId)) { - "the request $this is outdated: Another operator has already responded it." - } - - _lowLevelSolveMemberJoinRequestEvent( - eventId = event.eventId, - fromId = event.fromId, - fromNick = event.fromNick, - groupId = event.groupId, - accept = false, - blackList = blackList, - message = message - ) - } - - private inline fun checkGroupPermission(eventBot: Bot, eventGroup: Group, eventName: () -> String) { - val group = this.getGroupOrNull(eventGroup.id) - ?: kotlin.run { - if (this == eventBot) { - error( - "A ${eventName()} is outdated. Group ${eventGroup.id} not found for bot ${this.id}. " + - "This is because bot isn't in the group anymore" - ) - } else { - error("A ${eventName()} is from bot ${eventBot.id}, but you are trying to respond it using bot ${this.id} who isn't a member of the group ${eventGroup.id}") - } - } - - group.checkBotPermission(MemberPermission.ADMINISTRATOR) - } - - override suspend fun ignoreMemberJoinRequest(event: MemberJoinRequestEvent, blackList: Boolean) { - checkGroupPermission(event.bot, event.group) { event::class.simpleName ?: "<anonymous class>" } - check(event.responded.compareAndSet(false, true)) { - "the request $this has already been responded" - } - - _lowLevelSolveMemberJoinRequestEvent( - eventId = event.eventId, - fromId = event.fromId, - fromNick = event.fromNick, - groupId = event.groupId, - accept = null, - blackList = blackList - ) - } - - override suspend fun acceptInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) = - solveInvitedJoinGroupRequest(event, accept = true) - - override suspend fun ignoreInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent) = - solveInvitedJoinGroupRequest(event, accept = false) - - - private suspend fun solveInvitedJoinGroupRequest(event: BotInvitedJoinGroupRequestEvent, accept: Boolean) { - check(event.responded.compareAndSet(false, true)) { - "the request $this has already been responded" - } - - check(!groups.contains(event.groupId)) { - "the request $this is outdated: Bot has been already in the group." - } - - _lowLevelSolveBotInvitedJoinGroupRequestEvent( - eventId = event.eventId, - invitorId = event.invitorId, - groupId = event.groupId, - accept = accept - ) - } - - @Suppress("CANNOT_OVERRIDE_INVISIBLE_MEMBER") - override suspend fun sendNudge(nudge: Nudge, receiver: Contact): Boolean { - if (configuration.protocol != BotConfiguration.MiraiProtocol.ANDROID_PHONE) { - throw UnsupportedOperationException("nudge is supported only with protocol ANDROID_PHONE") - } - - network.run { - return if (receiver is Group) { - receiver.checkIsGroupImpl() - NudgePacket.troopInvoke( - client = client, - messageReceiverGroupCode = receiver.id, - nudgeTargetId = nudge.target.id, - ).sendAndExpect<NudgePacket.Response>().success - } else { - NudgePacket.friendInvoke( - client = client, - messageReceiverUin = receiver.id, - nudgeTargetId = nudge.target.id, - ).sendAndExpect<NudgePacket.Response>().success - } - } - } -} +) : QQAndroidBotBase(context, account, configuration) internal abstract class QQAndroidBotBase constructor( @@ -271,7 +64,7 @@ internal abstract class QQAndroidBotBase constructor( override val id: Long get() = account.id - private inline val json get() = configuration.json + inline val json get() = configuration.json override val friends: ContactList<Friend> = ContactList(LockFreeLinkedList()) @@ -285,9 +78,9 @@ internal abstract class QQAndroidBotBase constructor( nick = it.nick } - override val selfQQ: Friend by lazy { - @OptIn(LowLevelAPI::class) - _lowLevelNewFriend(object : FriendInfo { + override val asFriend: Friend by lazy { + @OptIn(LowLevelApi::class) + Mirai._lowLevelNewFriend(this, object : FriendInfo { override val uin: Long get() = this@QQAndroidBotBase.id override val nick: String get() = this@QQAndroidBotBase.nick override val remark: String get() = "" @@ -305,16 +98,6 @@ internal abstract class QQAndroidBotBase constructor( } } - @LowLevelAPI - override fun _lowLevelNewFriend(friendInfo: FriendInfo): Friend { - return FriendImpl( - this as QQAndroidBot, - coroutineContext + CoroutineName("Friend(${friendInfo.uin}"), - friendInfo.uin, - friendInfo - ) - } - override fun createNetworkHandler(coroutineContext: CoroutineContext): QQAndroidBotNetworkHandler { return QQAndroidBotNetworkHandler(coroutineContext, this as QQAndroidBot) } @@ -334,601 +117,10 @@ internal abstract class QQAndroidBotBase constructor( return groups.firstOrNull { it.checkIsGroupImpl(); it.uin == uin } } - @OptIn(LowLevelAPI::class) - override suspend fun _lowLevelQueryGroupList(): Sequence<Long> { - return network.run { - FriendList.GetTroopListSimplify(bot.client) - .sendAndExpect<FriendList.GetTroopListSimplify.Response>(retry = 2) - }.groups.asSequence().map { it.groupUin.shl(32) and it.groupCode } - } - - @Suppress( - "DeprecatedCallableAddReplaceWith", - "FunctionName", - "RedundantSuspendModifier", - "unused", - "unused_parameter" - ) - @Deprecated("") - @OptIn(LowLevelAPI::class) - suspend fun _lowLevelQueryGroupInfo(groupCode: Long, stTroopNum: StTroopNum): GroupInfo = network.run { - error("This should not be invoked") - /* - TroopManagement.GetGroupInfo( - client = bot.client, - groupCode = groupCode - ).sendAndExpect<GroupInfoImpl>(retry = 3).also { it.stTroopNum = stTroopNum }*/ - } - - @OptIn(LowLevelAPI::class) - override suspend fun _lowLevelQueryGroupMemberList( - groupUin: Long, - groupCode: Long, - ownerId: Long - ): Sequence<MemberInfo> = - network.run { - var nextUin = 0L - var sequence = sequenceOf<MemberInfoImpl>() - while (true) { - val data = FriendList.GetTroopMemberList( - client = bot.client, - targetGroupUin = groupUin, - targetGroupCode = groupCode, - nextUin = nextUin - ).sendAndExpect<FriendList.GetTroopMemberList.Response>(retry = 3) - sequence += data.members.asSequence().map { troopMemberInfo -> - MemberInfoImpl(troopMemberInfo, ownerId) - } - nextUin = data.nextUin - if (nextUin == 0L) { - break - } - } - return sequence - } - - @Suppress("RemoveExplicitTypeArguments") // false positive - override suspend fun recall(source: MessageSource) { - check(source is MessageSourceInternal) - source.ensureSequenceIdAvailable() - - @Suppress("BooleanLiteralArgument") // false positive - check(!source.isRecalledOrPlanned.value && source.isRecalledOrPlanned.compareAndSet(false, true)) { - "$source had already been recalled." - } - - val response: PbMessageSvc.PbMsgWithDraw.Response = when (source) { - is MessageSourceToGroupImpl, - is MessageSourceFromGroupImpl - -> { - val group = when (source) { - is MessageSourceToGroupImpl -> source.target - is MessageSourceFromGroupImpl -> source.group - else -> error("stub") - } - if (this.id != source.fromId) { - group.checkBotPermission(MemberPermission.ADMINISTRATOR) - } - MessageRecallEvent.GroupRecall( - this, - source.fromId, - source.id, - source.internalId, - source.time, - null, - group - ).broadcast() - - network.run { - PbMessageSvc.PbMsgWithDraw.createForGroupMessage( - bot.asQQAndroidBot().client, - group.id, - source.sequenceId, - source.internalId - ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() - } - } - is MessageSourceFromFriendImpl, - is MessageSourceToFriendImpl - -> network.run { - check(source.fromId == this@QQAndroidBotBase.id) { - "can only recall a message sent by bot" - } - PbMessageSvc.PbMsgWithDraw.createForFriendMessage( - bot.client, - source.targetId, - source.sequenceId, - source.internalId, - source.time - ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() - } - is MessageSourceFromTempImpl, - is MessageSourceToTempImpl - -> network.run { - check(source.fromId == this@QQAndroidBotBase.id) { - "can only recall a message sent by bot" - } - source as MessageSourceToTempImpl - PbMessageSvc.PbMsgWithDraw.createForTempMessage( - bot.client, - (source.target.group as GroupImpl).uin, - source.targetId, - source.sequenceId, - source.internalId, - source.time - ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() - } - is OfflineMessageSource -> network.run { - when (source.kind) { - OfflineMessageSource.Kind.FRIEND -> { - check(source.fromId == this@QQAndroidBotBase.id) { - "can only recall a message sent by bot" - } - PbMessageSvc.PbMsgWithDraw.createForFriendMessage( - bot.client, - source.targetId, - source.sequenceId, - source.internalId, - source.time - ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() - } - OfflineMessageSource.Kind.TEMP -> { - check(source.fromId == this@QQAndroidBotBase.id) { - "can only recall a message sent by bot" - } - PbMessageSvc.PbMsgWithDraw.createForTempMessage( - bot.client, - source.targetId, // groupUin - source.targetId, // memberUin - source.sequenceId, - source.internalId, - source.time - ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() - } - OfflineMessageSource.Kind.GROUP -> { - PbMessageSvc.PbMsgWithDraw.createForGroupMessage( - bot.client, - source.targetId, - source.sequenceId, - source.internalId - ).sendAndExpect<PbMessageSvc.PbMsgWithDraw.Response>() - } - } - } - else -> error("stub!") - } - - - // 1001: No message meets the requirements (实际上是没权限, 管理员在尝试撤回群主的消息) - // 154: timeout - // 3: <no message> - check(response is PbMessageSvc.PbMsgWithDraw.Response.Success) { "Failed to recall message #${source.id}: $response" } - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelGetAnnouncements(groupId: Long, page: Int, amount: Int): GroupAnnouncementList { - val data = network.async { - MiraiPlatformUtils.Http.post<String> { - url("https://web.qun.qq.com/cgi-bin/announce/list_announce") - body = MultiPartFormDataContent(formData { - append("qid", groupId) - append("bkn", bkn) - append("ft", 23) //好像是一个用来识别应用的参数 - append("s", if (page == 1) 0 else -(page * amount + 1)) // 第一页这里的参数应该是-1 - append("n", amount) - append("ni", if (page == 1) 1 else 0) - append("format", "json") - }) - headers { - append( - "cookie", - "uin=o${id}; skey=${client.wLoginSigInfo.sKey.data.encodeToString()}; p_uin=o${id};" - ) - } - } - } - - val rep = data.await() -// bot.network.logger.error(rep) - return json.decodeFromString(GroupAnnouncementList.serializer(), rep) - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelSendAnnouncement(groupId: Long, announcement: GroupAnnouncement): String { - val rep = withContext(network.coroutineContext) { - MiraiPlatformUtils.Http.post<String> { - url("https://web.qun.qq.com/cgi-bin/announce/add_qun_notice") - body = MultiPartFormDataContent(formData { - append("qid", groupId) - append("bkn", bkn) - append("text", announcement.msg.text) - append("pinned", announcement.pinned) - append( - "settings", - json.encodeToString( - GroupAnnouncementSettings.serializer(), - announcement.settings ?: GroupAnnouncementSettings() - ) - ) - append("format", "json") - }) - headers { - append( - "cookie", - "uin=o${id};" + - " skey=${client.wLoginSigInfo.sKey.data.encodeToString()};" + - " p_uin=o${id};" + - " p_skey=${client.wLoginSigInfo.psKeyMap["qun.qq.com"]?.data?.encodeToString()}; " - ) - } - } - } - val jsonObj = json.parseToJsonElement(rep) - return jsonObj.jsonObject["new_fid"]?.jsonPrimitive?.content - ?: throw throw IllegalStateException("Send Announcement fail group:$groupId msg:${jsonObj.jsonObject["em"]} content:${announcement.msg.text}") - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelDeleteAnnouncement(groupId: Long, fid: String) { - val data = withContext(network.coroutineContext) { - MiraiPlatformUtils.Http.post<String> { - url("https://web.qun.qq.com/cgi-bin/announce/del_feed") - body = MultiPartFormDataContent(formData { - append("qid", groupId) - append("bkn", bkn) - append("fid", fid) - append("format", "json") - }) - headers { - append( - "cookie", - "uin=o${id};" + - " skey=${client.wLoginSigInfo.sKey.data.encodeToString()};" + - " p_uin=o${id};" + - " p_skey=${client.wLoginSigInfo.psKeyMap["qun.qq.com"]?.data?.encodeToString()}; " - ) - } - } - } - val jsonObj = json.parseToJsonElement(data) - if (jsonObj.jsonObject["ec"]?.jsonPrimitive?.int ?: 1 != 0) { - throw throw IllegalStateException("delete Announcement fail group:$groupId msg:${jsonObj.jsonObject["em"]} fid:$fid") - } - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelGetAnnouncement(groupId: Long, fid: String): GroupAnnouncement { - val data = network.async { - MiraiPlatformUtils.Http.post<String> { - url("https://web.qun.qq.com/cgi-bin/announce/get_feed") - body = MultiPartFormDataContent(formData { - append("qid", groupId) - append("bkn", bkn) - append("fid", fid) - append("format", "json") - }) - headers { - append( - "cookie", - "uin=o${id}; skey=${client.wLoginSigInfo.sKey.data.encodeToString()}; p_uin=o${id};" - ) - } - } - } - - val rep = data.await() -// bot.network.logger.error(rep) - return json.decodeFromString(GroupAnnouncement.serializer(), rep) - - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelGetGroupActiveData(groupId: Long, page: Int): GroupActiveData { - val data = network.async { - MiraiPlatformUtils.Http.get<String> { - url("https://qqweb.qq.com/c/activedata/get_mygroup_data") - parameter("bkn", bkn) - parameter("gc", groupId) - if (page != -1) { - parameter("page", page) - } - headers { - append( - "cookie", - "uin=o${id}; skey=${client.wLoginSigInfo.sKey.data.encodeToString()}; p_uin=o${id};" - ) - } - } - } - val rep = data.await() - return json.decodeFromString(GroupActiveData.serializer(), rep) - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelGetGroupHonorListData(groupId: Long, type: GroupHonorType): GroupHonorListData? { - val data = network.async { - MiraiPlatformUtils.Http.get<String> { - url("https://qun.qq.com/interactive/honorlist") - parameter("gc", groupId) - parameter("type", type.value) - headers { - append( - "cookie", - "uin=o${id};" + - " skey=${client.wLoginSigInfo.sKey.data.encodeToString()};" + - " p_uin=o${id};" + - " p_skey=${client.wLoginSigInfo.psKeyMap["qun.qq.com"]?.data?.encodeToString()}; " - ) - } - } - } - val rep = data.await() - val jsonText = Regex("""window.__INITIAL_STATE__=(.+?)</script>""").find(rep)?.groupValues?.get(1) - return jsonText?.let { json.decodeFromString(GroupHonorListData.serializer(), it) } - } - - @JvmSynthetic - @LowLevelAPI - @MiraiExperimentalAPI - internal suspend fun lowLevelSendGroupLongOrForwardMessage( - groupCode: Long, - message: Collection<ForwardMessage.INode>, - isLong: Boolean, - forwardMessage: ForwardMessage? - ): MessageReceipt<Group> { - message.forEach { - it.message.ensureSequenceIdAvailable() - } - - val group = getGroup(groupCode) - - val time = currentTimeSeconds - val sequenceId = client.atomicNextMessageSequenceId() - - network.run { - val data = message.calculateValidationDataForGroup( - sequenceId = sequenceId, - random = Random.nextInt().absoluteValue, - groupCode = groupCode - ) - - val response = - MultiMsg.ApplyUp.createForGroupLongMessage( - buType = if (isLong) 1 else 2, - client = this@QQAndroidBotBase.client, - messageData = data, - dstUin = Group.calculateGroupUinByGroupCode(groupCode) - ).sendAndExpect<MultiMsg.ApplyUp.Response>() - - val resId: String - when (response) { - is MultiMsg.ApplyUp.Response.MessageTooLarge -> - error( - "Internal error: message is too large, but this should be handled before sending. " - ) - is MultiMsg.ApplyUp.Response.RequireUpload -> { - resId = response.proto.msgResid - - val body = LongMsg.ReqBody( - subcmd = 1, - platformType = 9, - termType = 5, - msgUpReq = listOf( - LongMsg.MsgUpReq( - msgType = 3, // group - dstUin = Group.calculateGroupUinByGroupCode(groupCode), - msgId = 0, - msgUkey = response.proto.msgUkey, - needCache = 0, - storeType = 2, - msgContent = data.data - ) - ) - ).toByteArray(LongMsg.ReqBody.serializer()) - - HighwayHelper.uploadImageToServers( - bot, - response.proto.uint32UpIp.zip(response.proto.uint32UpPort), - response.proto.msgSig, - MiraiPlatformUtils.md5(body), - @Suppress("INVISIBLE_REFERENCE") - net.mamoe.mirai.utils.internal.asReusableInput0(body), // don't use toLongUnsigned: Overload resolution ambiguity - "group long message", - 27 - ) - } - } - - return if (isLong) { - group.sendMessage( - RichMessage.longMessage( - brief = message.joinToString(limit = 27) { it.message.contentToString() }, - resId = resId, - timeSeconds = time - ) - ) - } else { - checkNotNull(forwardMessage) { "Internal error: forwardMessage is null when sending forward" } - group.sendMessage( - RichMessage.forwardMessage( - resId = resId, - timeSeconds = time, - // preview = message.take(5).joinToString { - // """ - // <title size="26" color="#777777" maxLines="2" lineSpace="12">${it.message.asMessageChain().joinToString(limit = 10)}</title> - // """.trimIndent() - // }, - preview = forwardMessage.displayStrategy.generatePreview(forwardMessage).take(4) - .map { - """<title size="26" color="#777777" maxLines="2" lineSpace="12">$it</title>""" - }.joinToString(""), - title = forwardMessage.displayStrategy.generateTitle(forwardMessage), - brief = forwardMessage.displayStrategy.generateBrief(forwardMessage), - source = forwardMessage.displayStrategy.generateSource(forwardMessage), - summary = forwardMessage.displayStrategy.generateSummary(forwardMessage) - ) - ) - } - } - } - - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelSolveNewFriendRequestEvent( - eventId: Long, - fromId: Long, - fromNick: String, - accept: Boolean, - blackList: Boolean - ) { - network.apply { - NewContact.SystemMsgNewFriend.Action( - bot.client, - eventId = eventId, - fromId = fromId, - accept = accept, - blackList = blackList - ).sendWithoutExpect() - bot.friends.delegate.addLast(bot._lowLevelNewFriend(object : FriendInfo { - override val uin: Long get() = fromId - override val nick: String get() = fromNick - override val remark: String get() = "" - })) - } - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelSolveBotInvitedJoinGroupRequestEvent( - eventId: Long, - invitorId: Long, - groupId: Long, - accept: Boolean - ) { - network.run { - NewContact.SystemMsgNewGroup.Action( - bot.client, - eventId = eventId, - fromId = invitorId, - groupId = groupId, - isInvited = true, - accept = accept - ).sendWithoutExpect() - } - } - - @LowLevelAPI - @MiraiExperimentalAPI - override suspend fun _lowLevelSolveMemberJoinRequestEvent( - eventId: Long, - fromId: Long, - fromNick: String, - groupId: Long, - accept: Boolean?, - blackList: Boolean, - message: String - ) { - network.apply { - NewContact.SystemMsgNewGroup.Action( - bot.client, - eventId = eventId, - fromId = fromId, - groupId = groupId, - isInvited = false, - accept = accept, - blackList = blackList, - message = message - ).sendWithoutExpect() - if (accept ?: return) - groups[groupId].apply { - members.delegate.addLast(newMember(object : MemberInfo { - override val nameCard: String get() = "" - override val permission: MemberPermission get() = MemberPermission.MEMBER - override val specialTitle: String get() = "" - override val muteTimestamp: Int get() = 0 - override val uin: Long get() = fromId - override val nick: String get() = fromNick - override val remark: String get() = "" - })) - } - } - } - - @OptIn(ExperimentalStdlibApi::class) - @LowLevelAPI - override suspend fun _lowLevelQueryGroupVoiceDownloadUrl( - md5: ByteArray, - groupId: Long, - dstUin: Long - ): String { - network.run { - val response: PttStore.GroupPttDown.Response.DownLoadInfo = - PttStore.GroupPttDown(client, groupId, dstUin, md5).sendAndExpect() - return "http://${response.strDomain}${response.downPara.encodeToString()}" - } - } - - @LowLevelAPI - override suspend fun _lowLevelUploadVoice(md5: ByteArray, groupId: Long) { - - } - - @Suppress("DEPRECATION", "OverridingDeprecatedMember") - override suspend fun queryImageUrl(image: Image): String = when (image) { - is ConstOriginUrlAware -> image.originUrl - is DeferredOriginUrlAware -> image.getUrl(this) - is SuspendDeferredOriginUrlAware -> image.getUrl(this) - else -> error("Internal error: unsupported image class: ${image::class.simpleName}") - } - - override fun constructMessageSource( - kind: OfflineMessageSource.Kind, - fromUin: Long, - targetUin: Long, - id: Int, - time: Int, - internalId: Int, - originalMessage: MessageChain - ): OfflineMessageSource { - return object : OfflineMessageSource(), MessageSourceInternal { - override val kind: Kind get() = kind - override val id: Int get() = id - override val bot: Bot get() = this@QQAndroidBotBase - override val time: Int get() = time - override val fromId: Long get() = fromUin - override val targetId: Long get() = targetUin - override val originalMessage: MessageChain get() = originalMessage - override val sequenceId: Int = id - override val internalId: Int = internalId - override var isRecalledOrPlanned: MiraiAtomicBoolean = MiraiAtomicBoolean(false) - - override fun toJceData(): ImMsgBody.SourceMsg { - return ImMsgBody.SourceMsg( - origSeqs = listOf(sequenceId), - senderUin = fromUin, - toUin = 0, - flag = 1, - elems = originalMessage.toRichTextElems(forGroup = kind == Kind.GROUP, withGeneralFlags = false), - type = 0, - time = time, - pbReserve = EMPTY_BYTE_ARRAY, - srcMsg = EMPTY_BYTE_ARRAY - ) - } - } - } - /** * 获取 获取群公告 所需的 bkn 参数 * */ - private val bkn: Int + val bkn: Int get() = client.wLoginSigInfo.sKey.data .fold(5381) { acc: Int, b: Byte -> acc + acc.shl(5) + b.toInt() } } diff --git a/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt index 0f12d8e3b..55dd84a8d 100644 --- a/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt @@ -1,13 +1,13 @@ /* * 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. + * 此源代码的使用受 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 */ -@file:OptIn(LowLevelAPI::class) +@file:OptIn(LowLevelApi::class) @file:Suppress( "EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR", @@ -23,7 +23,7 @@ import kotlinx.atomicfu.atomic import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import kotlinx.io.core.Closeable -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.data.FriendInfo import net.mamoe.mirai.event.broadcast @@ -134,7 +134,7 @@ internal class FriendImpl( @Suppress("UNCHECKED_CAST", "DEPRECATION") when (response) { - is LongConn.OffPicUp.Response.FileExists -> net.mamoe.mirai.message.data.OfflineFriendImage(response.resourceId) + is LongConn.OffPicUp.Response.FileExists -> net.mamoe.mirai.internal.message.OfflineFriendImage(response.resourceId) .also { ImageUploadEvent.Succeed(this@FriendImpl, image, it).broadcast() } @@ -168,7 +168,7 @@ internal class FriendImpl( )*/ // 为什么不能 ?? - net.mamoe.mirai.message.data.OfflineFriendImage(response.resourceId).also { + net.mamoe.mirai.internal.message.OfflineFriendImage(response.resourceId).also { ImageUploadEvent.Succeed(this@FriendImpl, image, it).broadcast() } } diff --git a/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt index 4144f40ba..07ec202ae 100644 --- a/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt @@ -1,14 +1,14 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -@file:OptIn(LowLevelAPI::class) +@file:OptIn(LowLevelApi::class) package net.mamoe.mirai.internal.contact @@ -16,14 +16,17 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.launch import kotlinx.io.core.Closeable -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.* 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.MiraiImpl import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.message.MessageSourceToGroupImpl +import net.mamoe.mirai.internal.message.OfflineGroupImage import net.mamoe.mirai.internal.message.ensureSequenceIdAvailable import net.mamoe.mirai.internal.message.firstIsInstanceOrNull import net.mamoe.mirai.internal.network.highway.HighwayHelper @@ -251,7 +254,7 @@ internal class GroupImpl( override fun newMember(memberInfo: MemberInfo): Member { return MemberImpl( - bot._lowLevelNewFriend(memberInfo) as FriendImpl, + Mirai._lowLevelNewFriend(bot, memberInfo) as FriendImpl, this, this.coroutineContext, memberInfo @@ -313,7 +316,7 @@ internal class GroupImpl( ) } - return bot.lowLevelSendGroupLongOrForwardMessage(this.id, message.nodeList, false, message) + return MiraiImpl.lowLevelSendGroupLongOrForwardMessage(bot, this.id, message.nodeList, false, message) } val msg: MessageChain = if (message !is LongMessage && message !is ForwardMessageInternal) { @@ -338,7 +341,8 @@ internal class GroupImpl( } if (length > 702 || imageCnt > 2) { - return bot.lowLevelSendGroupLongOrForwardMessage( + return MiraiImpl.lowLevelSendGroupLongOrForwardMessage( + bot, this.id, listOf( ForwardMessage.Node( @@ -402,7 +406,7 @@ internal class GroupImpl( @Suppress("DEPRECATION") @OptIn(ExperimentalTime::class) @JvmSynthetic - override suspend fun uploadImage(image: ExternalImage): OfflineGroupImage = try { + override suspend fun uploadImage(image: ExternalImage): Image = try { @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") if (image.input is net.mamoe.mirai.utils.internal.DeferredReusableInput) { image.input.init(bot.configuration.fileCacheStrategy) @@ -456,7 +460,7 @@ internal class GroupImpl( * @throws EventCancelledException 当发送消息事件被取消 * @throws OverFileSizeMaxException 当语音文件过大而被服务器拒绝上传时. (最大大小约为 1 MB) */ - @MiraiExperimentalAPI + @MiraiExperimentalApi @SinceMirai("1.2.0") override suspend fun uploadVoice(input: InputStream): Voice { val content = ByteArray(input.available()) diff --git a/mirai-core/src/commonMain/kotlin/contact/MemberImpl.kt b/mirai-core/src/commonMain/kotlin/contact/MemberImpl.kt index bb1dee4c5..18140f0df 100644 --- a/mirai-core/src/commonMain/kotlin/contact/MemberImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/MemberImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @@ -14,7 +14,7 @@ package net.mamoe.mirai.internal.contact import kotlinx.atomicfu.AtomicInt import kotlinx.atomicfu.atomic import kotlinx.coroutines.* -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi import net.mamoe.mirai.contact.* import net.mamoe.mirai.data.MemberInfo import net.mamoe.mirai.event.broadcast @@ -38,7 +38,7 @@ import kotlin.contracts.contract import kotlin.coroutines.CoroutineContext import kotlin.jvm.JvmSynthetic -@OptIn(LowLevelAPI::class) +@OptIn(LowLevelApi::class) @Suppress("MemberVisibilityCanBePrivate") internal class MemberImpl constructor( val qq: FriendImpl, // 不要 WeakRef @@ -258,7 +258,7 @@ internal fun Member.checkIsMemberImpl(): MemberImpl { return this } -@OptIn(LowLevelAPI::class) +@OptIn(LowLevelApi::class) internal class MemberInfoImpl( jceInfo: StTroopMemberInfo, groupOwnerId: Long diff --git a/mirai-core/src/commonMain/kotlin/contact/util.kt b/mirai-core/src/commonMain/kotlin/contact/util.kt index b254a8837..750f9c67b 100644 --- a/mirai-core/src/commonMain/kotlin/contact/util.kt +++ b/mirai-core/src/commonMain/kotlin/contact/util.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core/src/commonMain/kotlin/message/FlashImageImpl.kt b/mirai-core/src/commonMain/kotlin/message/FlashImageImpl.kt index 81e23b104..70dc689db 100644 --- a/mirai-core/src/commonMain/kotlin/message/FlashImageImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/FlashImageImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DEPRECATION_ERROR", "UnusedImport") diff --git a/mirai-core/src/commonMain/kotlin/message/atImpl.kt b/mirai-core/src/commonMain/kotlin/message/atImpl.kt index 89189cd92..72dc6c315 100644 --- a/mirai-core/src/commonMain/kotlin/message/atImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/atImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.message diff --git a/mirai-core/src/commonMain/kotlin/message/conversions.kt b/mirai-core/src/commonMain/kotlin/message/conversions.kt index 34c407767..390c47701 100644 --- a/mirai-core/src/commonMain/kotlin/message/conversions.kt +++ b/mirai-core/src/commonMain/kotlin/message/conversions.kt @@ -1,13 +1,13 @@ /* * 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. + * 此源代码的使用受 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 */ -@file:OptIn(LowLevelAPI::class) +@file:OptIn(LowLevelApi::class) @file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") package net.mamoe.mirai.internal.message @@ -17,7 +17,7 @@ import kotlinx.io.core.discardExact import kotlinx.io.core.readUInt import kotlinx.io.core.toByteArray import net.mamoe.mirai.Bot -import net.mamoe.mirai.LowLevelAPI +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 diff --git a/mirai-core/src/commonMain/kotlin/message/faceImpl.kt b/mirai-core/src/commonMain/kotlin/message/faceImpl.kt index 48cf715d6..d23d607a8 100644 --- a/mirai-core/src/commonMain/kotlin/message/faceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/faceImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.message diff --git a/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt b/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt index 2bc01a59d..31aa8f78c 100644 --- a/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt @@ -1,20 +1,28 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DEPRECATION_ERROR") package net.mamoe.mirai.internal.message +import kotlinx.serialization.Serializable +import net.mamoe.mirai.Bot +import net.mamoe.mirai.contact.Contact +import net.mamoe.mirai.contact.Group +import net.mamoe.mirai.internal.MiraiImpl 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.utils.ExternalImage +import net.mamoe.mirai.utils.MiraiExperimentalApi +import net.mamoe.mirai.utils.SinceMirai +import kotlin.jvm.JvmSynthetic internal class OnlineGroupImageImpl( internal val delegate: ImMsgBody.CustomFace @@ -23,8 +31,10 @@ OnlineGroupImage() { override val imageId: String = ExternalImage.generateImageId(delegate.md5) override val originUrl: String get() = if (delegate.origUrl.isBlank()) { - "http://gchat.qpic.cn/gchatpic_new/0/0-0-${imageId.substring(1..36) - .replace("-", "")}/0?term=2" + "http://gchat.qpic.cn/gchatpic_new/0/0-0-${ + imageId.substring(1..36) + .replace("-", "") + }/0?term=2" } else "http://gchat.qpic.cn" + delegate.origUrl override fun equals(other: Any?): Boolean { @@ -86,4 +96,136 @@ internal fun OfflineFriendImage.toJceData(): ImMsgBody.NotOnlineImage { original = 1, pbReserve = byteArrayOf(0x78, 0x02) ) -} \ No newline at end of file +} + + +/** + * 所有 [Image] 实现的基类. + */ +internal abstract class AbstractImage : Image { // make sealed in 1.3.0 ? + private var _stringValue: String? = null + get() = field ?: kotlin.run { + field = "[mirai:image:$imageId]" + field + } + + final override fun toString(): String = _stringValue!! + final override fun contentToString(): String = "[图片]" +} + +internal interface ConstOriginUrlAware : Image { + val originUrl: String +} + +internal interface DeferredOriginUrlAware : Image { + fun getUrl(bot: Bot): String +} + +internal interface SuspendDeferredOriginUrlAware : Image { + suspend fun getUrl(bot: Bot): String +} + +/** + * 由 [ExternalImage] 委托的 [Image] 类型. + */ +@SinceMirai("1.1.0") +@MiraiExperimentalApi("Will be renamed to OfflineImage on 1.2.0") +@Suppress("DEPRECATION_ERROR") +internal class ExperimentalDeferredImage internal constructor( + @Suppress("CanBeParameter") private val externalImage: ExternalImage // for future use +) : AbstractImage(), SuspendDeferredOriginUrlAware { + override suspend fun getUrl(bot: Bot): String { + TODO() + } + + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + override val imageId: String = externalImage.calculateImageResourceId() +} + +internal val firstOnlineBotInstance: Bot get() = Bot.botInstancesSequence.firstOrNull() ?: error("No Bot available") + +@Suppress("EXPOSED_SUPER_INTERFACE") +internal interface OnlineImage : Image, ConstOriginUrlAware { + companion object Key : Message.Key<OnlineImage> { + override val typeName: String get() = "OnlineImage" + } + + override val originUrl: String +} + +/** + * 离线的图片, 即为客户端主动上传到服务器而获得的 [Image] 实例. + * 不能直接获取它在服务器上的链接. 需要通过 [Bot.queryImageUrl] 查询 + * + * 一般由 [Contact.uploadImage] 得到 + */ +internal interface OfflineImage : Image { + companion object Key : Message.Key<OfflineImage> { + override val typeName: String get() = "OfflineImage" + } +} + +@JvmSynthetic +internal suspend fun OfflineImage.queryUrl(): String { + @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") + val bot = Bot._instances.peekFirst()?.get() ?: error("No Bot available to query image url") + return MiraiImpl.queryImageUrl(bot, this) +} + +/** + * 通过 [Group.uploadImage] 上传得到的 [GroupImage]. 它的链接需要查询 [Bot.queryImageUrl] + * + * @param imageId 参考 [Image.imageId] + */ +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@Serializable +internal data class OfflineGroupImage( + override val imageId: String +) : GroupImage(), OfflineImage, DeferredOriginUrlAware { + override fun getUrl(bot: Bot): String { + return "http://gchat.qpic.cn/gchatpic_new/${bot.id}/0-0-${ + imageId.substring(1..36) + .replace("-", "") + }/0?term=2" + } + + init { + @Suppress("DEPRECATION") + require(imageId matches GROUP_IMAGE_ID_REGEX) { + "Illegal imageId. It must matches GROUP_IMAGE_ID_REGEX" + } + } +} + +/** + * 接收消息时获取到的 [GroupImage]. 它可以直接获取下载链接 [originUrl] + */ +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +internal abstract class OnlineGroupImage : GroupImage(), OnlineImage + +/** + * 通过 [Group.uploadImage] 上传得到的 [GroupImage]. 它的链接需要查询 [Bot.queryImageUrl] + * + * @param imageId 参考 [Image.imageId] + */ +@Serializable +internal data class OfflineFriendImage( + override val imageId: String +) : FriendImage(), OfflineImage, DeferredOriginUrlAware { + override fun getUrl(bot: Bot): String { + return "http://c2cpicdw.qpic.cn/offpic_new/${bot.id}/${this.imageId}/0?term=2" + } + + init { + require(imageId matches FRIEND_IMAGE_ID_REGEX_1 || imageId matches FRIEND_IMAGE_ID_REGEX_2) { + "Illegal imageId. It must matches either FRIEND_IMAGE_ID_REGEX_1 or FRIEND_IMAGE_ID_REGEX_2" + } + } +} + +/** + * 接收消息时获取到的 [FriendImage]. 它可以直接获取下载链接 [originUrl] + */ +internal abstract class OnlineFriendImage : FriendImage(), OnlineImage + +// endregion diff --git a/mirai-core/src/commonMain/kotlin/message/incomingSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/incomingSourceImpl.kt index 769d234a4..f7f044c7a 100644 --- a/mirai-core/src/commonMain/kotlin/message/incomingSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/incomingSourceImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") diff --git a/mirai-core/src/commonMain/kotlin/message/offlineSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/offlineSourceImpl.kt index 822487a0e..49829880f 100644 --- a/mirai-core/src/commonMain/kotlin/message/offlineSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/offlineSourceImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") diff --git a/mirai-core/src/commonMain/kotlin/message/outgoingSourceImpl.kt b/mirai-core/src/commonMain/kotlin/message/outgoingSourceImpl.kt index 6e31f1bd8..0bf142171 100644 --- a/mirai-core/src/commonMain/kotlin/message/outgoingSourceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/outgoingSourceImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE", "INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") diff --git a/mirai-core/src/commonMain/kotlin/network/BotNetworkHandler.kt b/mirai-core/src/commonMain/kotlin/network/BotNetworkHandler.kt index 0f9b6ba7a..77569974f 100644 --- a/mirai-core/src/commonMain/kotlin/network/BotNetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/network/BotNetworkHandler.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE") @@ -18,7 +18,7 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import net.mamoe.mirai.Bot -import net.mamoe.mirai.utils.MiraiInternalAPI +import net.mamoe.mirai.utils.MiraiInternalApi import net.mamoe.mirai.utils.MiraiLogger import net.mamoe.mirai.utils.WeakRefProperty @@ -72,7 +72,7 @@ internal abstract class BotNetworkHandler : CoroutineScope { * @throws WrongPasswordException 密码错误时 */ @Suppress("SpellCheckingInspection") - @MiraiInternalAPI + @MiraiInternalApi abstract suspend fun closeEverythingAndRelogin(host: String, port: Int, cause: Throwable? = null) /** @@ -80,7 +80,7 @@ internal abstract class BotNetworkHandler : CoroutineScope { * * 不要使用这个 API. 它会在登录完成后被自动调用. */ - @MiraiInternalAPI + @MiraiInternalApi open suspend fun init() { } diff --git a/mirai-core/src/commonMain/kotlin/network/Packet.kt b/mirai-core/src/commonMain/kotlin/network/Packet.kt index e994dc53e..715d7eed5 100644 --- a/mirai-core/src/commonMain/kotlin/network/Packet.kt +++ b/mirai-core/src/commonMain/kotlin/network/Packet.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network diff --git a/mirai-core/src/commonMain/kotlin/network/QQAndroidBotNetworkHandler.kt b/mirai-core/src/commonMain/kotlin/network/QQAndroidBotNetworkHandler.kt index c5e5ffbea..456f11eee 100644 --- a/mirai-core/src/commonMain/kotlin/network/QQAndroidBotNetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/network/QQAndroidBotNetworkHandler.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @@ -19,6 +19,7 @@ import kotlinx.coroutines.sync.withLock import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.buildPacket import kotlinx.io.core.use +import net.mamoe.mirai.Mirai import net.mamoe.mirai.event.* import net.mamoe.mirai.event.events.BotOfflineEvent import net.mamoe.mirai.event.events.BotOnlineEvent @@ -276,7 +277,8 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo coroutineContext = bot.coroutineContext, id = groupCode, groupInfo = GroupInfoImpl(this), - members = bot._lowLevelQueryGroupMemberList( + members = Mirai._lowLevelQueryGroupMemberList( + bot, groupUin, groupCode, dwGroupOwnerUin @@ -395,7 +397,7 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo private suspend fun syncMessageSvc() { logger.info { "Syncing friend message history..." } withTimeoutOrNull(30000) { - launch(CoroutineName("Syncing friend message history")) { syncFromEvent<MessageSvcPbGetMsg.GetMsgSuccess, Unit> { Unit } } + launch(CoroutineName("Syncing friend message history")) { syncFromEvent<MessageSvcPbGetMsg.GetMsgSuccess, Unit> { } } MessageSvcPbGetMsg(bot.client, MsgSvc.SyncFlag.START, null).sendAndExpect<Packet>() } ?: error("timeout syncing friend message history") diff --git a/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt b/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt index ec1459bba..985078cd2 100644 --- a/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt +++ b/mirai-core/src/commonMain/kotlin/network/QQAndroidClient.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") @@ -155,7 +155,7 @@ internal open class QQAndroidClient( } } - @MiraiInternalAPI("Do not use directly. Get from the lambda param of buildSsoPacket") + @MiraiInternalApi("Do not use directly. Get from the lambda param of buildSsoPacket") internal fun nextSsoSequenceId() = _ssoSequenceId.addAndGet(2) var openAppId: Long = 715019303L diff --git a/mirai-core/src/commonMain/kotlin/network/Ticket.kt b/mirai-core/src/commonMain/kotlin/network/Ticket.kt index be06d29c1..c9e8e02b6 100644 --- a/mirai-core/src/commonMain/kotlin/network/Ticket.kt +++ b/mirai-core/src/commonMain/kotlin/network/Ticket.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network diff --git a/mirai-core/src/commonMain/kotlin/network/highway/HighwayHelper.kt b/mirai-core/src/commonMain/kotlin/network/highway/HighwayHelper.kt index ced1b329f..709feeef1 100644 --- a/mirai-core/src/commonMain/kotlin/network/highway/HighwayHelper.kt +++ b/mirai-core/src/commonMain/kotlin/network/highway/HighwayHelper.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") diff --git a/mirai-core/src/commonMain/kotlin/network/highway/highway.kt b/mirai-core/src/commonMain/kotlin/network/highway/highway.kt index bd7a98e5e..da80421e3 100644 --- a/mirai-core/src/commonMain/kotlin/network/highway/highway.kt +++ b/mirai-core/src/commonMain/kotlin/network/highway/highway.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/LoginType.kt b/mirai-core/src/commonMain/kotlin/network/protocol/LoginType.kt index f7beda74d..e2baf73c1 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/LoginType.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/LoginType.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/SyncingCacheList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/SyncingCacheList.kt index 366a629c8..2dd5e18b0 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/SyncingCacheList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/SyncingCacheList.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/ConfigPush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/ConfigPush.kt index e68276f81..fbefabf5b 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/ConfigPush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/ConfigPush.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/FriendList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/FriendList.kt index d556cd2ac..8a7bcb168 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/FriendList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/FriendList.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/GroupMngReq.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/GroupMngReq.kt index 9c61b603b..dd5ed29d6 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/GroupMngReq.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/GroupMngReq.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/MsgType0x210.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/MsgType0x210.kt index fc0f76193..63b45e3ce 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/MsgType0x210.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/MsgType0x210.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/OnlinePushPack.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/OnlinePushPack.kt index 7ea01f2b5..642fa2d3e 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/OnlinePushPack.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/OnlinePushPack.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/PushNotifyPack.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/PushNotifyPack.kt index c6b9da922..a29a78621 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/PushNotifyPack.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/PushNotifyPack.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestMSFForceOffline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestMSFForceOffline.kt index 34f6dd9da..d44d38817 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestMSFForceOffline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestMSFForceOffline.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPacket.kt index e1b57c435..863fc4216 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPacket.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPushForceOffline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPushForceOffline.kt index 1ed8759a0..a67a072cc 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPushForceOffline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/RequestPushForceOffline.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/SvcReqRegister.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/SvcReqRegister.kt index f5cc87441..cb95ae346 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/SvcReqRegister.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/SvcReqRegister.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/TroopList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/TroopList.kt index 53400b573..63cb892c9 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/TroopList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/jce/TroopList.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.jce import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x352.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x352.kt index e8c969828..e5eab5bd5 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x352.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x352.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt index 6ad0d6e68..dda1b9bd8 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x857.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x857.kt index 7b000abd4..a9e225057 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x857.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x857.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("SpellCheckingInspection") package net.mamoe.mirai.internal.network.protocol.data.proto diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x858.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x858.kt index 9e544c4ac..b463cd086 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x858.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x858.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("SpellCheckingInspection") package net.mamoe.mirai.internal.network.protocol.data.proto diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Define.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Define.kt index 69b3b9d00..93037e37b 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Define.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Define.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/FriendListCommon.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/FriendListCommon.kt index 480568c01..f965a30a8 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/FriendListCommon.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/FriendListCommon.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("SpellCheckingInspection") package net.mamoe.mirai.internal.network.protocol.data.proto diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Group.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Group.kt index d054d85fb..07d5a9038 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Group.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Group.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Highway.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Highway.kt index bf1c168b2..6b3b46e2a 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Highway.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Highway.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/HummerCommelem.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/HummerCommelem.kt index 885c1b46f..252ea40ce 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/HummerCommelem.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/HummerCommelem.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImageRequest.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImageRequest.kt index 5d3532674..4764716b2 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImageRequest.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImageRequest.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/LongMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/LongMsg.kt index 2d68e9814..b34769ab6 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/LongMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/LongMsg.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Msg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Msg.kt index 35ff35b4f..937f541ef 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Msg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Msg.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgCommon.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgCommon.kt index 422add782..0cb2b05cc 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgCommon.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgCommon.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgRevokeUserDef.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgRevokeUserDef.kt index 354f52b2c..4cc007323 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgRevokeUserDef.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgRevokeUserDef.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgSvc.kt index c32202fb7..d03ec5b19 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgSvc.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgTransmit.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgTransmit.kt index 67a94e8bc..21777dfa3 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgTransmit.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MsgTransmit.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MultiMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MultiMsg.kt index 428a9385a..038fcc73c 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MultiMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/MultiMsg.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OIDB.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OIDB.kt index 6a74d4d1f..a86256533 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OIDB.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OIDB.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Oidb0x769.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Oidb0x769.kt index 936940226..83ebfbbff 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Oidb0x769.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Oidb0x769.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OnlinePush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OnlinePush.kt index 018c0a006..0e7ec76fc 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OnlinePush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/OnlinePush.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/PbReserve.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/PbReserve.kt index a30a1fd87..83155cad5 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/PbReserve.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/PbReserve.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StatSvcGetOnline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StatSvcGetOnline.kt index 7d83d0a35..7639dbaa8 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StatSvcGetOnline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StatSvcGetOnline.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StructMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StructMsg.kt index 78be7d4a0..19de52a8b 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StructMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/StructMsg.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/SyncCookie.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/SyncCookie.kt index 832451894..cf03f5500 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/SyncCookie.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/SyncCookie.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.data.proto import kotlinx.serialization.Serializable diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/msgType0x210.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/msgType0x210.kt index dd0d64307..a0a990bd8 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/msgType0x210.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/msgType0x210.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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + @file:Suppress("unused", "SpellCheckingInspection") package net.mamoe.mirai.internal.network.protocol.data.proto diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt index 24d0f58ab..319580ddd 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/EncryptMethod.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacketAndroid.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacketAndroid.kt index 772ab4ed7..7fe04860e 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacketAndroid.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacketAndroid.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt index d6bbcf4e9..33414dc83 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/PacketFactory.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt index 93bac6fa3..005994fb6 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/Tlv.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE") diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/ChatType.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/ChatType.kt index 80f60100f..f2e50d8b0 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/ChatType.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/ChatType.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt index ae8b21fad..f657ad03d 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/MultiMsg.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE") diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt index ecdb29218..3e23ba537 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NewContact.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER") diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt index 363ae5938..e56353c5e 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/NudgePacket.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt index b19d335ae..389081974 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/PbMessageSvc.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE") diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt index 31f9a463b..d647f595e 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/TroopManagement.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat @@ -13,7 +13,7 @@ import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.buildPacket import kotlinx.io.core.readBytes import kotlinx.io.core.toByteArray -import net.mamoe.mirai.LowLevelAPI +import net.mamoe.mirai.LowLevelApi import net.mamoe.mirai.contact.Member import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet @@ -30,7 +30,7 @@ import net.mamoe.mirai.internal.utils.io.serialization.* import net.mamoe.mirai.utils.daysToSeconds import net.mamoe.mirai.data.GroupInfo as MiraiGroupInfo -@OptIn(LowLevelAPI::class) +@OptIn(LowLevelApi::class) internal class GroupInfoImpl( private val stTroopNum: StTroopNum ) : MiraiGroupInfo, Packet, Packet.NoLog { diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt index 19a0f534d..258f6b862 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat.image diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt index f6eb833e8..3f5800595 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/LongConn.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat.image diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt index 316c9765b..74393f031 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbDeleteMsg.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat.receive diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt index 1237b1de5..f135528d1 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbGetMsg.kt @@ -1,17 +1,16 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") package net.mamoe.mirai.internal.network.protocol.packet.chat.receive -import kotlinx.atomicfu.loop import kotlinx.coroutines.CoroutineName import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.delay @@ -20,6 +19,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.sync.withLock import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.discardExact +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.MemberPermission import net.mamoe.mirai.data.MemberInfo @@ -455,7 +455,8 @@ internal suspend fun QQAndroidBot.getNewGroup(groupCode: Long): Group? { coroutineContext = coroutineContext, id = groupCode, groupInfo = GroupInfoImpl(troopNum), - members = _lowLevelQueryGroupMemberList( + members = Mirai._lowLevelQueryGroupMemberList( + this, troopNum.groupUin, troopNum.groupCode, troopNum.dwGroupOwnerUin diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt index 45a5e68ec..9b9eb450c 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PbSendMsg.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat.receive diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt index 120c311a8..070f78c6c 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushForceOffline.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat.receive diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt index 479920c2c..965c5f0ac 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/MessageSvc.PushNotify.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.chat.receive diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt index f47ff8393..bb6c30284 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushGroupMsg.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt index 8c199265e..6fb53e0a0 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.PbPushTransMsg.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt index 1d595d2ba..ba0c02e37 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/receive/OnlinePush.ReqPush.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @@ -21,6 +21,7 @@ import kotlinx.io.core.readUInt import kotlinx.serialization.Serializable import kotlinx.serialization.protobuf.ProtoNumber import net.mamoe.mirai.JavaFriendlyAPI +import net.mamoe.mirai.Mirai import net.mamoe.mirai.contact.Friend import net.mamoe.mirai.contact.Member import net.mamoe.mirai.data.FriendInfo @@ -133,7 +134,7 @@ internal object OnlinePushReqPush : IncomingPacketFactory<OnlinePushReqPush.ReqP } } - override suspend fun QQAndroidBot.handle(packet: ReqPushDecoded, sequenceId: Int): OutgoingPacket? { + override suspend fun QQAndroidBot.handle(packet: ReqPushDecoded, sequenceId: Int): OutgoingPacket { return buildResponseUniPacket(client) { writeJceStruct( RequestPacket.serializer(), @@ -456,7 +457,7 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf( 0xB3L to lambda528 { bot -> // 08 01 12 52 08 A2 FF 8C F0 03 10 00 1D 15 3D 90 5E 22 2E E6 88 91 E4 BB AC E5 B7 B2 E7 BB 8F E6 98 AF E5 A5 BD E5 8F 8B E5 95 A6 EF BC 8C E4 B8 80 E8 B5 B7 E6 9D A5 E8 81 8A E5 A4 A9 E5 90 A7 21 2A 09 48 69 6D 31 38 38 6D 6F 65 30 07 38 03 48 DD F1 92 B7 07 val body = vProtobuf.loadAs(Submsgtype0xb3.SubMsgType0xb3.MsgBody.serializer()) - val new = bot._lowLevelNewFriend(object : FriendInfo { + val new = Mirai._lowLevelNewFriend(bot, object : FriendInfo { override val uin: Long get() = body.msgAddFrdNotify.fuin override val nick: String get() = body.msgAddFrdNotify.fuinNick override val remark: String get() = "" @@ -512,9 +513,9 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf( //戳一戳 1134L, 1135L, 1136L, 10043L -> { //预置数据,服务器将不会提供己方已知消息 - var from: Friend = bot.selfQQ + var from: Friend = bot.asFriend var action = "" - var target: Friend = bot.selfQQ + var target: Friend = bot.asFriend var suffix = "" body.msgTemplParam?.asSequence()?.map { it.name.decodeToString() to it.value.decodeToString() diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt index 4cf3a62f9..a6ca53e28 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/voice/PttStore.kt @@ -1,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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + package net.mamoe.mirai.internal.network.protocol.packet.chat.voice import kotlinx.io.core.ByteReadPacket diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt index ef519e527..00943485c 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/FriendList.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.list diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt index 2c8858ca2..fa3a76999 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/list/ProfileService.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.list diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt index cc2473eb1..d33748697 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/ConfigPushSvc.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.login diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt index d155f7b87..99888cbef 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/Heartbeat.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.login diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt index 4e045b184..bd2a3329c 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/StatSvc.kt @@ -1,10 +1,10 @@ /* * Copyright 2019-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.internal.network.protocol.packet.login diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt index 7f8979570..384b75eb4 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/login/WtLogin.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.network.protocol.packet.login diff --git a/mirai-core/src/commonMain/kotlin/utils/AtomicResizeCacheList.kt b/mirai-core/src/commonMain/kotlin/utils/AtomicResizeCacheList.kt index 9deb0a6be..1c9326f96 100644 --- a/mirai-core/src/commonMain/kotlin/utils/AtomicResizeCacheList.kt +++ b/mirai-core/src/commonMain/kotlin/utils/AtomicResizeCacheList.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonMain/kotlin/utils/ByteArrayPool.kt b/mirai-core/src/commonMain/kotlin/utils/ByteArrayPool.kt index 8b1b136b8..a366b4f21 100644 --- a/mirai-core/src/commonMain/kotlin/utils/ByteArrayPool.kt +++ b/mirai-core/src/commonMain/kotlin/utils/ByteArrayPool.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonMain/kotlin/utils/GuidSource.kt b/mirai-core/src/commonMain/kotlin/utils/GuidSource.kt index 3afd02b6d..e6d82eab8 100644 --- a/mirai-core/src/commonMain/kotlin/utils/GuidSource.kt +++ b/mirai-core/src/commonMain/kotlin/utils/GuidSource.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmName("Utils") diff --git a/mirai-core/src/commonMain/kotlin/utils/LinkedList.common.kt b/mirai-core/src/commonMain/kotlin/utils/LinkedList.common.kt index a7e069d2a..498b3d04b 100644 --- a/mirai-core/src/commonMain/kotlin/utils/LinkedList.common.kt +++ b/mirai-core/src/commonMain/kotlin/utils/LinkedList.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonMain/kotlin/utils/MiraiPlatformUtils.common.kt b/mirai-core/src/commonMain/kotlin/utils/MiraiPlatformUtils.common.kt index 7dcd6826d..6e4ca5c75 100644 --- a/mirai-core/src/commonMain/kotlin/utils/MiraiPlatformUtils.common.kt +++ b/mirai-core/src/commonMain/kotlin/utils/MiraiPlatformUtils.common.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonMain/kotlin/utils/NetworkType.kt b/mirai-core/src/commonMain/kotlin/utils/NetworkType.kt index 0e520fc8c..ac83b7ade 100644 --- a/mirai-core/src/commonMain/kotlin/utils/NetworkType.kt +++ b/mirai-core/src/commonMain/kotlin/utils/NetworkType.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt b/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt index a4704bbe8..da23812ba 100644 --- a/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt +++ b/mirai-core/src/commonMain/kotlin/utils/PlatformDatagramChannel.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt b/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt index b5d90a02b..26f72229c 100644 --- a/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt +++ b/mirai-core/src/commonMain/kotlin/utils/PlatformSocket.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonMain/kotlin/utils/byteArrays.kt b/mirai-core/src/commonMain/kotlin/utils/byteArrays.kt index f0bdd7612..d7ff1c11c 100644 --- a/mirai-core/src/commonMain/kotlin/utils/byteArrays.kt +++ b/mirai-core/src/commonMain/kotlin/utils/byteArrays.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "NOTHING_TO_INLINE", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") diff --git a/mirai-core/src/commonMain/kotlin/utils/contentToString.kt b/mirai-core/src/commonMain/kotlin/utils/contentToString.kt index bb1ad1c7d..59c42b3b0 100644 --- a/mirai-core/src/commonMain/kotlin/utils/contentToString.kt +++ b/mirai-core/src/commonMain/kotlin/utils/contentToString.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "unused", "NO_REFLECTION_IN_CLASS_PATH") diff --git a/mirai-core/src/commonMain/kotlin/utils/conversion.kt b/mirai-core/src/commonMain/kotlin/utils/conversion.kt index 89467f4b4..e8a65f44f 100644 --- a/mirai-core/src/commonMain/kotlin/utils/conversion.kt +++ b/mirai-core/src/commonMain/kotlin/utils/conversion.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "EXPERIMENTAL_API_USAGE", "unused") diff --git a/mirai-core/src/commonMain/kotlin/utils/cryptor/ECDH.kt b/mirai-core/src/commonMain/kotlin/utils/cryptor/ECDH.kt index c4dc7eecd..1d0456baf 100644 --- a/mirai-core/src/commonMain/kotlin/utils/cryptor/ECDH.kt +++ b/mirai-core/src/commonMain/kotlin/utils/cryptor/ECDH.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.cryptor diff --git a/mirai-core/src/commonMain/kotlin/utils/cryptor/TEA.kt b/mirai-core/src/commonMain/kotlin/utils/cryptor/TEA.kt index 01d646599..86bacd815 100644 --- a/mirai-core/src/commonMain/kotlin/utils/cryptor/TEA.kt +++ b/mirai-core/src/commonMain/kotlin/utils/cryptor/TEA.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.cryptor diff --git a/mirai-core/src/commonMain/kotlin/utils/flags.kt b/mirai-core/src/commonMain/kotlin/utils/flags.kt index 9802b1a59..250b15df2 100644 --- a/mirai-core/src/commonMain/kotlin/utils/flags.kt +++ b/mirai-core/src/commonMain/kotlin/utils/flags.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmName("Utils") diff --git a/mirai-core/src/commonMain/kotlin/utils/io/JceStruct.kt b/mirai-core/src/commonMain/kotlin/utils/io/JceStruct.kt index 88a4362d0..669485e06 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/JceStruct.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/JceStruct.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.io diff --git a/mirai-core/src/commonMain/kotlin/utils/io/ProtoBuf.kt b/mirai-core/src/commonMain/kotlin/utils/io/ProtoBuf.kt index 6a4f94561..8d1538d62 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/ProtoBuf.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/ProtoBuf.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.io diff --git a/mirai-core/src/commonMain/kotlin/utils/io/input.kt b/mirai-core/src/commonMain/kotlin/utils/io/input.kt index c539ca818..bffcdaa9a 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/input.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/input.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_UNSIGNED_LITERALS", "NOTHING_TO_INLINE") diff --git a/mirai-core/src/commonMain/kotlin/utils/io/output.kt b/mirai-core/src/commonMain/kotlin/utils/io/output.kt index ca8e07036..ce46a8e6f 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/output.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/output.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "NOTHING_TO_INLINE") diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt index ef89b9a55..9cff4d651 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/ProtoBufWithNullableSupport.kt @@ -1,8 +1,10 @@ /* - * Copyright 2017-2019 JetBrains s.r.o. - * Use of this source code is governed by the Apache 2.0 license. + * Copyright 2019-2020 Mamoe Technologies and contributors. * - * Some code changed by Mamoe is annotated around "MIRAI MODIFY START" and "MIRAI MODIFY END" + * 此源代码的使用受 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("DEPRECATION_ERROR") diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt index 2e13cd405..eecec9143 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/Tars.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("MemberVisibilityCanBePrivate", "unused") diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/TarsId.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/TarsId.kt index f8268aed1..0d31df958 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/TarsId.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/TarsId.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.io.serialization.tars diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt index bdec63ab4..79b1ec404 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsDecoder.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("PrivatePropertyName") diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt index 7317f5d90..9cc2ab648 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsInput.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.io.serialization.tars.internal diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt index 337e8f57e..c8ef2526e 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsOld.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.io.serialization.tars.internal diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt index a5a7ff6f0..1b487becf 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/tars/internal/TarsTag.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.io.serialization.tars.internal diff --git a/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt b/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt index edf37132e..18bb900e6 100644 --- a/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt +++ b/mirai-core/src/commonMain/kotlin/utils/io/serialization/utils.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmName("SerializationUtils") diff --git a/mirai-core/src/commonMain/kotlin/utils/numbers.kt b/mirai-core/src/commonMain/kotlin/utils/numbers.kt index d34bef4a4..9a14d7f8e 100644 --- a/mirai-core/src/commonMain/kotlin/utils/numbers.kt +++ b/mirai-core/src/commonMain/kotlin/utils/numbers.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmMultifileClass diff --git a/mirai-core/src/commonMain/kotlin/utils/tryNTimes.kt b/mirai-core/src/commonMain/kotlin/utils/tryNTimes.kt index 7fd6d05a2..bb93d76cd 100644 --- a/mirai-core/src/commonMain/kotlin/utils/tryNTimes.kt +++ b/mirai-core/src/commonMain/kotlin/utils/tryNTimes.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("DuplicatedCode") diff --git a/mirai-core/src/commonMain/kotlin/utils/type.kt b/mirai-core/src/commonMain/kotlin/utils/type.kt index ef98579a7..adbb7e7ad 100644 --- a/mirai-core/src/commonMain/kotlin/utils/type.kt +++ b/mirai-core/src/commonMain/kotlin/utils/type.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:JvmName("Utils") diff --git a/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt b/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt index 8787af920..1f7d659d0 100644 --- a/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt +++ b/mirai-core/src/commonTest/kotlin/PlatformUtilsTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonTest/kotlin/TypeConversionTest.kt b/mirai-core/src/commonTest/kotlin/TypeConversionTest.kt index 2b383c996..a09c873a7 100644 --- a/mirai-core/src/commonTest/kotlin/TypeConversionTest.kt +++ b/mirai-core/src/commonTest/kotlin/TypeConversionTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/commonTest/kotlin/samples/CustomMessageSamples.kt b/mirai-core/src/commonTest/kotlin/samples/CustomMessageSamples.kt index 9b16f58e1..339d62607 100644 --- a/mirai-core/src/commonTest/kotlin/samples/CustomMessageSamples.kt +++ b/mirai-core/src/commonTest/kotlin/samples/CustomMessageSamples.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_OVERRIDE") diff --git a/mirai-core/src/commonTest/kotlin/test/printing.kt b/mirai-core/src/commonTest/kotlin/test/printing.kt index 63f3c05e0..285925a4f 100644 --- a/mirai-core/src/commonTest/kotlin/test/printing.kt +++ b/mirai-core/src/commonTest/kotlin/test/printing.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE") diff --git a/mirai-core/src/jvmMain/kotlin/QQAndroid.kt b/mirai-core/src/jvmMain/kotlin/BotFactoryImpl.kt similarity index 71% rename from mirai-core/src/jvmMain/kotlin/QQAndroid.kt rename to mirai-core/src/jvmMain/kotlin/BotFactoryImpl.kt index d798e4d71..80e269c93 100644 --- a/mirai-core/src/jvmMain/kotlin/QQAndroid.kt +++ b/mirai-core/src/jvmMain/kotlin/BotFactoryImpl.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("FunctionName", "OverridingDeprecatedMember") @@ -12,7 +12,7 @@ package net.mamoe.mirai.internal import net.mamoe.mirai.Bot import net.mamoe.mirai.BotFactory -import net.mamoe.mirai.internal.QQAndroid.Bot +import net.mamoe.mirai.internal.BotFactoryImpl.Bot import net.mamoe.mirai.utils.BotConfiguration import net.mamoe.mirai.utils.Context @@ -20,7 +20,7 @@ import net.mamoe.mirai.utils.Context * QQ for Android */ @Suppress("INAPPLICABLE_JVM_NAME") -actual object QQAndroid : BotFactory { +actual object BotFactoryImpl : BotFactory { /** * 使用指定的 [配置][configuration] 构造 [Bot] 实例 @@ -34,7 +34,7 @@ actual object QQAndroid : BotFactory { * 使用指定的 [配置][configuration] 构造 [Bot] 实例 */ @JvmName("newBot") - fun Bot(qq: Long, password: String, configuration: BotConfiguration = BotConfiguration.Default): Bot = + override fun Bot(qq: Long, password: String, configuration: BotConfiguration): Bot = QQAndroidBot(BotAccount(qq, password), configuration) /** @@ -52,7 +52,7 @@ actual object QQAndroid : BotFactory { * 使用指定的 [配置][configuration] 构造 [Bot] 实例 */ @JvmName("newBot") - fun Bot( + override fun Bot( qq: Long, passwordMd5: ByteArray, configuration: BotConfiguration @@ -62,5 +62,5 @@ actual object QQAndroid : BotFactory { /** * 使用指定的 [配置][configuration] 构造 [Bot] 实例 */ -inline fun QQAndroid.Bot(qq: Long, password: String, configuration: (BotConfiguration.() -> Unit)): Bot = +inline fun BotFactoryImpl.Bot(qq: Long, password: String, configuration: (BotConfiguration.() -> Unit)): Bot = this.Bot(qq, password, BotConfiguration().apply(configuration)) \ No newline at end of file diff --git a/mirai-core/src/jvmMain/kotlin/QQAndroidBot.jvm.kt b/mirai-core/src/jvmMain/kotlin/QQAndroidBot.jvm.kt index 2d2610f14..006dda379 100644 --- a/mirai-core/src/jvmMain/kotlin/QQAndroidBot.jvm.kt +++ b/mirai-core/src/jvmMain/kotlin/QQAndroidBot.jvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal diff --git a/mirai-core/src/jvmMain/kotlin/utils/LinkedList.kt b/mirai-core/src/jvmMain/kotlin/utils/LinkedList.kt index c0cc2637e..1bbd954b4 100644 --- a/mirai-core/src/jvmMain/kotlin/utils/LinkedList.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/LinkedList.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/jvmMain/kotlin/utils/MiraiPlatformUtils.kt b/mirai-core/src/jvmMain/kotlin/utils/MiraiPlatformUtils.kt index cb48a01e7..734e46c9b 100644 --- a/mirai-core/src/jvmMain/kotlin/utils/MiraiPlatformUtils.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/MiraiPlatformUtils.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ @file:Suppress("NOTHING_TO_INLINE") diff --git a/mirai-core/src/jvmMain/kotlin/utils/PlatformSocket.kt b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocket.kt index 7b0a82250..610eb42d9 100644 --- a/mirai-core/src/jvmMain/kotlin/utils/PlatformSocket.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocket.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/jvmMain/kotlin/utils/PlatformSocketJvm.kt b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocketJvm.kt index fc51d9817..07fba68c4 100644 --- a/mirai-core/src/jvmMain/kotlin/utils/PlatformSocketJvm.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/PlatformSocketJvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/jvmMain/kotlin/utils/addSuppressedMirai.kt b/mirai-core/src/jvmMain/kotlin/utils/addSuppressedMirai.kt index c21ab4440..36cfa2464 100644 --- a/mirai-core/src/jvmMain/kotlin/utils/addSuppressedMirai.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/addSuppressedMirai.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/jvmMain/kotlin/utils/cryptor/ECDHJvm.kt b/mirai-core/src/jvmMain/kotlin/utils/cryptor/ECDHJvm.kt index 8e307762b..c4558e463 100644 --- a/mirai-core/src/jvmMain/kotlin/utils/cryptor/ECDHJvm.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/cryptor/ECDHJvm.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils.cryptor diff --git a/mirai-core/src/jvmMain/kotlin/utils/setVisible.kt b/mirai-core/src/jvmMain/kotlin/utils/setVisible.kt index 741d9252c..10de59387 100644 --- a/mirai-core/src/jvmMain/kotlin/utils/setVisible.kt +++ b/mirai-core/src/jvmMain/kotlin/utils/setVisible.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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.internal.utils diff --git a/mirai-core/src/jvmTest/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java b/mirai-core/src/jvmTest/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java index faf12d2b5..6d32a221c 100644 --- a/mirai-core/src/jvmTest/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java +++ b/mirai-core/src/jvmTest/java/net/mamoe/mirai/javatest/SimpleListenerHostTest.java @@ -1,12 +1,10 @@ /* + * 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 AGPLv3 license that can be found through the following link. * + * https://github.com/mamoe/mirai/blob/master/LICENSE */ package net.mamoe.mirai.javatest; diff --git a/mirai-core/src/jvmTest/kotlin/AtomicResizeCacheListTest.kt b/mirai-core/src/jvmTest/kotlin/AtomicResizeCacheListTest.kt index 8fe377528..157d298b9 100644 --- a/mirai-core/src/jvmTest/kotlin/AtomicResizeCacheListTest.kt +++ b/mirai-core/src/jvmTest/kotlin/AtomicResizeCacheListTest.kt @@ -1,10 +1,10 @@ /* * 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. + * 此源代码的使用受 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 */ /* diff --git a/mirai-core/src/main/AndroidManifest.xml b/mirai-core/src/main/AndroidManifest.xml index b1d2174fb..d7ceff5df 100644 --- a/mirai-core/src/main/AndroidManifest.xml +++ b/mirai-core/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + ~ 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. + ~ + ~ https://github.com/mamoe/mirai/blob/master/LICENSE + --> + <manifest package="net.mamoe.mirai.internal" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> diff --git a/settings.gradle.kts b/settings.gradle.kts index fb3abcb78..159bf6401 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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 AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/master/LICENSE + */ + pluginManagement { repositories { mavenLocal()