From c118180b544eefff8d527d381e1eb2476adedbd7 Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 14 Jan 2022 20:59:58 +0000 Subject: [PATCH] Move messages implementations other than InternalFlagOnlyMessage from `.message` to `.message.data` --- mirai-core/src/commonMain/kotlin/MiraiImpl.kt | 5 +++ .../commonMain/kotlin/contact/FriendImpl.kt | 2 +- .../commonMain/kotlin/contact/GroupImpl.kt | 2 +- .../kotlin/contact/SendMessageHandler.kt | 4 +++ .../kotlin/contact/file/AbsoluteFileImpl.kt | 2 +- .../src/commonMain/kotlin/contact/util.kt | 4 +-- .../kotlin/message/ReceiveMessageHandler.kt | 1 + .../message/{ => data}/FileMessageImpl.kt | 2 +- .../message/{ => data}/LongMessageInternal.kt | 5 ++- .../message/{ => data}/MarketFaceImpl.kt | 4 ++- .../message/{ => data}/MultiMsgUploader.kt | 3 +- .../{ => data}/UnsupportedMessageImpl.kt | 11 +++--- .../kotlin/message/{ => data}/atImpl.kt | 36 +++++++++++-------- .../{OnlineAudioImpl.kt => data/audio.kt} | 4 +-- .../kotlin/message/{ => data}/faceImpl.kt | 12 +++---- .../kotlin/message/{ => data}/lightApp.kt | 4 ++- .../kotlin/message/messageToElems.kt | 3 +- .../commonMain/kotlin/message/rich/package.kt | 11 ++++++ .../message/visitor/MessageVisitorEx.kt | 7 ++-- .../chat/receive/MessageSvc.PbSendMsg.kt | 4 +-- .../commonMain/kotlin/utils/RemoteFileImpl.kt | 2 +- .../src/commonMain/kotlin/utils/type.kt | 2 +- ...oe.mirai.message.data.OfflineAudio.Factory | 4 +-- .../commonTest/kotlin/message/AudioTest.kt | 8 +++-- .../CleanupRubbishMessageElementsTest.kt | 2 ++ .../kotlin/message/data/ForwardRefineTest.kt | 9 +++-- .../kotlin/message/data/MessageReceiptTest.kt | 1 - .../message/data/MessageSerializationTest.kt | 12 +++---- 28 files changed, 101 insertions(+), 65 deletions(-) rename mirai-core/src/commonMain/kotlin/message/{ => data}/FileMessageImpl.kt (98%) rename mirai-core/src/commonMain/kotlin/message/{ => data}/LongMessageInternal.kt (97%) rename mirai-core/src/commonMain/kotlin/message/{ => data}/MarketFaceImpl.kt (96%) rename mirai-core/src/commonMain/kotlin/message/{ => data}/MultiMsgUploader.kt (98%) rename mirai-core/src/commonMain/kotlin/message/{ => data}/UnsupportedMessageImpl.kt (81%) rename mirai-core/src/commonMain/kotlin/message/{ => data}/atImpl.kt (73%) rename mirai-core/src/commonMain/kotlin/message/{OnlineAudioImpl.kt => data/audio.kt} (98%) rename mirai-core/src/commonMain/kotlin/message/{ => data}/faceImpl.kt (67%) rename mirai-core/src/commonMain/kotlin/message/{ => data}/lightApp.kt (97%) create mode 100644 mirai-core/src/commonMain/kotlin/message/rich/package.kt diff --git a/mirai-core/src/commonMain/kotlin/MiraiImpl.kt b/mirai-core/src/commonMain/kotlin/MiraiImpl.kt index bcc4b81c0..a78147e5b 100644 --- a/mirai-core/src/commonMain/kotlin/MiraiImpl.kt +++ b/mirai-core/src/commonMain/kotlin/MiraiImpl.kt @@ -35,6 +35,11 @@ import net.mamoe.mirai.internal.event.EventChannelToEventDispatcherAdapter import net.mamoe.mirai.internal.event.InternalEventMechanism import net.mamoe.mirai.internal.message.* import net.mamoe.mirai.internal.message.DeepMessageRefiner.refineDeep +import net.mamoe.mirai.internal.message.data.* +import net.mamoe.mirai.internal.message.data.FileMessageImpl +import net.mamoe.mirai.internal.message.data.OfflineAudioImpl +import net.mamoe.mirai.internal.message.data.OnlineAudioImpl +import net.mamoe.mirai.internal.message.data.UnsupportedMessageImpl import net.mamoe.mirai.internal.message.image.* import net.mamoe.mirai.internal.message.image.OfflineGroupImage import net.mamoe.mirai.internal.message.image.OnlineFriendImageImpl diff --git a/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt index f5465e800..436befa62 100644 --- a/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/FriendImpl.kt @@ -23,7 +23,7 @@ import net.mamoe.mirai.event.events.FriendMessagePreSendEvent import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.contact.info.FriendInfoImpl import net.mamoe.mirai.internal.contact.roaming.RoamingMessagesImplFriend -import net.mamoe.mirai.internal.message.OfflineAudioImpl +import net.mamoe.mirai.internal.message.data.OfflineAudioImpl import net.mamoe.mirai.internal.network.highway.* import net.mamoe.mirai.internal.network.protocol.data.proto.Cmd0x346 import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody diff --git a/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt index 4d1718eef..c432da697 100644 --- a/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt @@ -26,8 +26,8 @@ import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.contact.announcement.AnnouncementsImpl import net.mamoe.mirai.internal.contact.file.RemoteFilesImpl import net.mamoe.mirai.internal.contact.info.MemberInfoImpl -import net.mamoe.mirai.internal.message.OfflineAudioImpl import net.mamoe.mirai.internal.message.contextualBugReportException +import net.mamoe.mirai.internal.message.data.OfflineAudioImpl import net.mamoe.mirai.internal.message.flags.MiraiInternalMessageFlag import net.mamoe.mirai.internal.message.image.OfflineGroupImage import net.mamoe.mirai.internal.message.image.calculateImageInfo diff --git a/mirai-core/src/commonMain/kotlin/contact/SendMessageHandler.kt b/mirai-core/src/commonMain/kotlin/contact/SendMessageHandler.kt index eab30e924..b413ed262 100644 --- a/mirai-core/src/commonMain/kotlin/contact/SendMessageHandler.kt +++ b/mirai-core/src/commonMain/kotlin/contact/SendMessageHandler.kt @@ -20,6 +20,10 @@ import net.mamoe.mirai.event.nextEvent import net.mamoe.mirai.internal.asQQAndroidBot import net.mamoe.mirai.internal.getMiraiImpl import net.mamoe.mirai.internal.message.* +import net.mamoe.mirai.internal.message.data.ForwardMessageInternal +import net.mamoe.mirai.internal.message.data.checkIsImpl +import net.mamoe.mirai.internal.message.data.forwardMessage +import net.mamoe.mirai.internal.message.data.longMessage import net.mamoe.mirai.internal.message.flags.DontAsLongMessage import net.mamoe.mirai.internal.message.flags.ForceAsLongMessage import net.mamoe.mirai.internal.message.flags.IgnoreLengthCheck diff --git a/mirai-core/src/commonMain/kotlin/contact/file/AbsoluteFileImpl.kt b/mirai-core/src/commonMain/kotlin/contact/file/AbsoluteFileImpl.kt index adeda2bf1..8d5474ff1 100644 --- a/mirai-core/src/commonMain/kotlin/contact/file/AbsoluteFileImpl.kt +++ b/mirai-core/src/commonMain/kotlin/contact/file/AbsoluteFileImpl.kt @@ -12,7 +12,7 @@ package net.mamoe.mirai.internal.contact.file import net.mamoe.mirai.contact.FileSupported import net.mamoe.mirai.contact.file.AbsoluteFile import net.mamoe.mirai.contact.file.AbsoluteFolder -import net.mamoe.mirai.internal.message.FileMessageImpl +import net.mamoe.mirai.internal.message.data.FileMessageImpl import net.mamoe.mirai.internal.network.protocol.packet.chat.FileManagement import net.mamoe.mirai.internal.network.protocol.packet.chat.toResult import net.mamoe.mirai.message.data.FileMessage diff --git a/mirai-core/src/commonMain/kotlin/contact/util.kt b/mirai-core/src/commonMain/kotlin/contact/util.kt index 5669338c8..c56f8bb94 100644 --- a/mirai-core/src/commonMain/kotlin/contact/util.kt +++ b/mirai-core/src/commonMain/kotlin/contact/util.kt @@ -13,8 +13,8 @@ package net.mamoe.mirai.internal.contact import net.mamoe.mirai.Bot import net.mamoe.mirai.contact.* -import net.mamoe.mirai.internal.message.FileMessageImpl -import net.mamoe.mirai.internal.message.LongMessageInternal +import net.mamoe.mirai.internal.message.data.FileMessageImpl +import net.mamoe.mirai.internal.message.data.LongMessageInternal import net.mamoe.mirai.internal.utils.estimateLength import net.mamoe.mirai.message.data.* import net.mamoe.mirai.utils.* diff --git a/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt b/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt index 2b43ce3df..4a097acdd 100644 --- a/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt +++ b/mirai-core/src/commonMain/kotlin/message/ReceiveMessageHandler.kt @@ -19,6 +19,7 @@ import net.mamoe.mirai.internal.message.LightMessageRefiner.refineLight import net.mamoe.mirai.internal.message.ReceiveMessageTransformer.cleanupRubbishMessageElements import net.mamoe.mirai.internal.message.ReceiveMessageTransformer.joinToMessageChain import net.mamoe.mirai.internal.message.ReceiveMessageTransformer.toAudio +import net.mamoe.mirai.internal.message.data.* import net.mamoe.mirai.internal.message.image.OnlineFriendImageImpl import net.mamoe.mirai.internal.message.image.OnlineGroupImageImpl import net.mamoe.mirai.internal.message.source.* diff --git a/mirai-core/src/commonMain/kotlin/message/FileMessageImpl.kt b/mirai-core/src/commonMain/kotlin/message/data/FileMessageImpl.kt similarity index 98% rename from mirai-core/src/commonMain/kotlin/message/FileMessageImpl.kt rename to mirai-core/src/commonMain/kotlin/message/data/FileMessageImpl.kt index 8e1b3e76c..8b5fa62a5 100644 --- a/mirai-core/src/commonMain/kotlin/message/FileMessageImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/FileMessageImpl.kt @@ -8,7 +8,7 @@ */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.firstOrNull diff --git a/mirai-core/src/commonMain/kotlin/message/LongMessageInternal.kt b/mirai-core/src/commonMain/kotlin/message/data/LongMessageInternal.kt similarity index 97% rename from mirai-core/src/commonMain/kotlin/message/LongMessageInternal.kt rename to mirai-core/src/commonMain/kotlin/message/data/LongMessageInternal.kt index c9ebb3261..b4bd561b9 100644 --- a/mirai-core/src/commonMain/kotlin/message/LongMessageInternal.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/LongMessageInternal.kt @@ -7,12 +7,15 @@ * https://github.com/mamoe/mirai/blob/dev/LICENSE */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import net.mamoe.mirai.Bot import net.mamoe.mirai.Mirai import net.mamoe.mirai.internal.asQQAndroidBot import net.mamoe.mirai.internal.getMiraiImpl +import net.mamoe.mirai.internal.message.RefinableMessage +import net.mamoe.mirai.internal.message.RefineContext +import net.mamoe.mirai.internal.message.RefineContextKey import net.mamoe.mirai.internal.message.visitor.ex import net.mamoe.mirai.internal.network.protocol.data.proto.MsgTransmit import net.mamoe.mirai.message.MessageReceipt diff --git a/mirai-core/src/commonMain/kotlin/message/MarketFaceImpl.kt b/mirai-core/src/commonMain/kotlin/message/data/MarketFaceImpl.kt similarity index 96% rename from mirai-core/src/commonMain/kotlin/message/MarketFaceImpl.kt rename to mirai-core/src/commonMain/kotlin/message/data/MarketFaceImpl.kt index e7e1157e1..475c6f2e4 100644 --- a/mirai-core/src/commonMain/kotlin/message/MarketFaceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/MarketFaceImpl.kt @@ -8,12 +8,14 @@ */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.Transient import net.mamoe.mirai.Bot +import net.mamoe.mirai.internal.message.RefinableMessage +import net.mamoe.mirai.internal.message.RefineContext import net.mamoe.mirai.internal.message.visitor.ex import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody import net.mamoe.mirai.message.data.Dice diff --git a/mirai-core/src/commonMain/kotlin/message/MultiMsgUploader.kt b/mirai-core/src/commonMain/kotlin/message/data/MultiMsgUploader.kt similarity index 98% rename from mirai-core/src/commonMain/kotlin/message/MultiMsgUploader.kt rename to mirai-core/src/commonMain/kotlin/message/data/MultiMsgUploader.kt index 4f6b5fc4e..62ade5d5d 100644 --- a/mirai-core/src/commonMain/kotlin/message/MultiMsgUploader.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/MultiMsgUploader.kt @@ -7,12 +7,13 @@ * https://github.com/mamoe/mirai/blob/dev/LICENSE */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import io.ktor.utils.io.core.* import net.mamoe.mirai.internal.contact.SendMessageHandler import net.mamoe.mirai.internal.contact.takeSingleContent import net.mamoe.mirai.internal.message.source.MessageSourceInternal +import net.mamoe.mirai.internal.message.toRichTextElems import net.mamoe.mirai.internal.network.QQAndroidClient import net.mamoe.mirai.internal.network.highway.Highway import net.mamoe.mirai.internal.network.highway.ResourceKind diff --git a/mirai-core/src/commonMain/kotlin/message/UnsupportedMessageImpl.kt b/mirai-core/src/commonMain/kotlin/message/data/UnsupportedMessageImpl.kt similarity index 81% rename from mirai-core/src/commonMain/kotlin/message/UnsupportedMessageImpl.kt rename to mirai-core/src/commonMain/kotlin/message/data/UnsupportedMessageImpl.kt index 2f6d31356..30b28ef9d 100644 --- a/mirai-core/src/commonMain/kotlin/message/UnsupportedMessageImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/UnsupportedMessageImpl.kt @@ -1,14 +1,13 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ - -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName diff --git a/mirai-core/src/commonMain/kotlin/message/atImpl.kt b/mirai-core/src/commonMain/kotlin/message/data/atImpl.kt similarity index 73% rename from mirai-core/src/commonMain/kotlin/message/atImpl.kt rename to mirai-core/src/commonMain/kotlin/message/data/atImpl.kt index 1bdb0b1e4..62a8e032f 100644 --- a/mirai-core/src/commonMain/kotlin/message/atImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/atImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/dev/LICENSE */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import kotlinx.io.core.buildPacket import kotlinx.io.core.readBytes @@ -64,17 +64,23 @@ internal fun At.toJceData( } -internal val atAllData = ImMsgBody.Elem( - text = ImMsgBody.Text( - str = AtAll.display, - attr6Buf = buildPacket { - // MessageForText$AtTroopMemberInfo - writeShort(1) // const - writeShort(0) // startPos - writeShort(AtAll.display.length.toShort()) // textLen - writeByte(1) // flag, may=1 - writeInt(0) // uin - writeShort(0) // const - }.readBytes() +@Suppress("unused") // limit scope +internal val AtAll.jceData + get() = atAllData + +private val atAllData by lazy { + ImMsgBody.Elem( + text = ImMsgBody.Text( + str = AtAll.display, + attr6Buf = buildPacket { + // MessageForText$AtTroopMemberInfo + writeShort(1) // const + writeShort(0) // startPos + writeShort(AtAll.display.length.toShort()) // textLen + writeByte(1) // flag, may=1 + writeInt(0) // uin + writeShort(0) // const + }.readBytes() + ) ) -) +} \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/message/OnlineAudioImpl.kt b/mirai-core/src/commonMain/kotlin/message/data/audio.kt similarity index 98% rename from mirai-core/src/commonMain/kotlin/message/OnlineAudioImpl.kt rename to mirai-core/src/commonMain/kotlin/message/data/audio.kt index 16a94c81f..02d2a404d 100644 --- a/mirai-core/src/commonMain/kotlin/message/OnlineAudioImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/audio.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/dev/LICENSE */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import kotlinx.io.core.toByteArray import kotlinx.serialization.KSerializer diff --git a/mirai-core/src/commonMain/kotlin/message/faceImpl.kt b/mirai-core/src/commonMain/kotlin/message/data/faceImpl.kt similarity index 67% rename from mirai-core/src/commonMain/kotlin/message/faceImpl.kt rename to mirai-core/src/commonMain/kotlin/message/data/faceImpl.kt index c29bf5507..3f4f94270 100644 --- a/mirai-core/src/commonMain/kotlin/message/faceImpl.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/faceImpl.kt @@ -1,13 +1,13 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import kotlinx.io.core.toByteArray import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem @@ -17,7 +17,7 @@ import net.mamoe.mirai.message.data.Face import net.mamoe.mirai.utils.hexToBytes import net.mamoe.mirai.utils.toByteArray -internal val FACE_BUF = "00 01 00 04 52 CC F5 D0".hexToBytes() +private val FACE_BUF = "00 01 00 04 52 CC F5 D0".hexToBytes() internal fun Face.toJceData(): ImMsgBody.Face { return ImMsgBody.Face( diff --git a/mirai-core/src/commonMain/kotlin/message/lightApp.kt b/mirai-core/src/commonMain/kotlin/message/data/lightApp.kt similarity index 97% rename from mirai-core/src/commonMain/kotlin/message/lightApp.kt rename to mirai-core/src/commonMain/kotlin/message/data/lightApp.kt index fc5cd2f1f..34ee0221a 100644 --- a/mirai-core/src/commonMain/kotlin/message/lightApp.kt +++ b/mirai-core/src/commonMain/kotlin/message/data/lightApp.kt @@ -7,12 +7,14 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.internal.message +package net.mamoe.mirai.internal.message.data import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json import net.mamoe.mirai.Bot +import net.mamoe.mirai.internal.message.RefinableMessage +import net.mamoe.mirai.internal.message.RefineContext import net.mamoe.mirai.message.data.* import net.mamoe.mirai.utils.safeCast diff --git a/mirai-core/src/commonMain/kotlin/message/messageToElems.kt b/mirai-core/src/commonMain/kotlin/message/messageToElems.kt index 00e276209..a1b5e08e4 100644 --- a/mirai-core/src/commonMain/kotlin/message/messageToElems.kt +++ b/mirai-core/src/commonMain/kotlin/message/messageToElems.kt @@ -14,6 +14,7 @@ import net.mamoe.mirai.contact.AnonymousMember import net.mamoe.mirai.contact.ContactOrBot import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.User +import net.mamoe.mirai.internal.message.data.* import net.mamoe.mirai.internal.message.flags.InternalFlagOnlyMessage import net.mamoe.mirai.internal.message.image.* import net.mamoe.mirai.internal.message.source.MessageSourceInternal @@ -177,7 +178,7 @@ internal fun MessageChain.toRichTextElems( .also { transformOneMessage(UNSUPPORTED_FLASH_MESSAGE_PLAIN) } - is AtAll -> elements.add(atAllData) + is AtAll -> elements.add(AtAll.jceData) is Face -> elements.add( if (currentMessage.id >= 260) { ImMsgBody.Elem(commonElem = currentMessage.toCommData()) diff --git a/mirai-core/src/commonMain/kotlin/message/rich/package.kt b/mirai-core/src/commonMain/kotlin/message/rich/package.kt new file mode 100644 index 000000000..546972fcc --- /dev/null +++ b/mirai-core/src/commonMain/kotlin/message/rich/package.kt @@ -0,0 +1,11 @@ +/* + * Copyright 2019-2022 Mamoe Technologies and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/mamoe/mirai/blob/dev/LICENSE + */ + +package net.mamoe.mirai.internal.message.rich + diff --git a/mirai-core/src/commonMain/kotlin/message/visitor/MessageVisitorEx.kt b/mirai-core/src/commonMain/kotlin/message/visitor/MessageVisitorEx.kt index c07690873..bb86edb8c 100644 --- a/mirai-core/src/commonMain/kotlin/message/visitor/MessageVisitorEx.kt +++ b/mirai-core/src/commonMain/kotlin/message/visitor/MessageVisitorEx.kt @@ -10,9 +10,12 @@ package net.mamoe.mirai.internal.message.visitor -import net.mamoe.mirai.internal.message.* +import net.mamoe.mirai.internal.message.data.ForwardMessageInternal +import net.mamoe.mirai.internal.message.data.LongMessageInternal +import net.mamoe.mirai.internal.message.data.MarketFaceImpl +import net.mamoe.mirai.internal.message.data.MarketFaceInternal import net.mamoe.mirai.internal.message.flags.* -import net.mamoe.mirai.internal.message.source.* +import net.mamoe.mirai.internal.message.source.MessageSourceInternal import net.mamoe.mirai.message.data.MessageSource import net.mamoe.mirai.message.data.visitor.MessageVisitor import net.mamoe.mirai.utils.castOrNull 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 ba49a761d..4e1310604 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 @@ -20,12 +20,12 @@ import net.mamoe.mirai.contact.Stranger import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.contact.groupCode import net.mamoe.mirai.internal.contact.uin -import net.mamoe.mirai.internal.message.ForwardMessageInternal +import net.mamoe.mirai.internal.message.data.ForwardMessageInternal +import net.mamoe.mirai.internal.message.data.toPtt import net.mamoe.mirai.internal.message.source.OnlineMessageSourceToFriendImpl import net.mamoe.mirai.internal.message.source.OnlineMessageSourceToGroupImpl import net.mamoe.mirai.internal.message.source.OnlineMessageSourceToStrangerImpl import net.mamoe.mirai.internal.message.source.OnlineMessageSourceToTempImpl -import net.mamoe.mirai.internal.message.toPtt import net.mamoe.mirai.internal.message.toRichTextElems import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient diff --git a/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt b/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt index b3b14b675..bbc1d1b07 100644 --- a/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt +++ b/mirai-core/src/commonMain/kotlin/utils/RemoteFileImpl.kt @@ -18,7 +18,7 @@ import net.mamoe.mirai.contact.Group import net.mamoe.mirai.contact.isOperator import net.mamoe.mirai.internal.asQQAndroidBot import net.mamoe.mirai.internal.contact.groupCode -import net.mamoe.mirai.internal.message.FileMessageImpl +import net.mamoe.mirai.internal.message.data.FileMessageImpl import net.mamoe.mirai.internal.message.flags.MiraiInternalMessageFlag import net.mamoe.mirai.internal.network.highway.Highway import net.mamoe.mirai.internal.network.highway.ResourceKind diff --git a/mirai-core/src/commonMain/kotlin/utils/type.kt b/mirai-core/src/commonMain/kotlin/utils/type.kt index a958d10ab..5dffe1832 100644 --- a/mirai-core/src/commonMain/kotlin/utils/type.kt +++ b/mirai-core/src/commonMain/kotlin/utils/type.kt @@ -10,7 +10,7 @@ package net.mamoe.mirai.internal.utils import net.mamoe.mirai.contact.ContactOrBot -import net.mamoe.mirai.internal.message.ForwardMessageInternal +import net.mamoe.mirai.internal.message.data.ForwardMessageInternal import net.mamoe.mirai.message.data.* import net.mamoe.mirai.utils.chineseLength import net.mamoe.mirai.utils.toInt diff --git a/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.message.data.OfflineAudio.Factory b/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.message.data.OfflineAudio.Factory index d995a6641..e42557bfc 100644 --- a/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.message.data.OfflineAudio.Factory +++ b/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.message.data.OfflineAudio.Factory @@ -1,5 +1,5 @@ # -# Copyright 2019-2021 Mamoe Technologies and contributors. +# Copyright 2019-2022 Mamoe Technologies and contributors. # # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -7,4 +7,4 @@ # https://github.com/mamoe/mirai/blob/dev/LICENSE # -net.mamoe.mirai.internal.message.OfflineAudioFactoryImpl \ No newline at end of file +net.mamoe.mirai.internal.message.data.OfflineAudioFactoryImpl \ No newline at end of file diff --git a/mirai-core/src/commonTest/kotlin/message/AudioTest.kt b/mirai-core/src/commonTest/kotlin/message/AudioTest.kt index f02720f3d..69779e668 100644 --- a/mirai-core/src/commonTest/kotlin/message/AudioTest.kt +++ b/mirai-core/src/commonTest/kotlin/message/AudioTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -9,8 +9,10 @@ package net.mamoe.mirai.internal.message -import net.mamoe.mirai.internal.message.OnlineAudioImpl.Companion.DOWNLOAD_URL -import net.mamoe.mirai.internal.message.OnlineAudioImpl.Companion.refineUrl +import net.mamoe.mirai.internal.message.data.OfflineAudioImpl +import net.mamoe.mirai.internal.message.data.OnlineAudioImpl +import net.mamoe.mirai.internal.message.data.OnlineAudioImpl.Companion.DOWNLOAD_URL +import net.mamoe.mirai.internal.message.data.OnlineAudioImpl.Companion.refineUrl import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody import net.mamoe.mirai.internal.test.AbstractTest import net.mamoe.mirai.message.data.AudioCodec diff --git a/mirai-core/src/commonTest/kotlin/message/CleanupRubbishMessageElementsTest.kt b/mirai-core/src/commonTest/kotlin/message/CleanupRubbishMessageElementsTest.kt index c3bc5bddc..b87616541 100644 --- a/mirai-core/src/commonTest/kotlin/message/CleanupRubbishMessageElementsTest.kt +++ b/mirai-core/src/commonTest/kotlin/message/CleanupRubbishMessageElementsTest.kt @@ -10,6 +10,8 @@ package net.mamoe.mirai.internal.message import net.mamoe.mirai.internal.message.ReceiveMessageTransformer.cleanupRubbishMessageElements +import net.mamoe.mirai.internal.message.data.LongMessageInternal +import net.mamoe.mirai.internal.message.data.OnlineAudioImpl import net.mamoe.mirai.internal.message.source.OfflineMessageSourceImplData import net.mamoe.mirai.message.data.* import org.junit.jupiter.api.Test diff --git a/mirai-core/src/jvmTest/kotlin/message/data/ForwardRefineTest.kt b/mirai-core/src/jvmTest/kotlin/message/data/ForwardRefineTest.kt index 5d0485986..8f10f5fdc 100644 --- a/mirai-core/src/jvmTest/kotlin/message/data/ForwardRefineTest.kt +++ b/mirai-core/src/jvmTest/kotlin/message/data/ForwardRefineTest.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.message.data @@ -13,7 +13,6 @@ import net.mamoe.mirai.Bot import net.mamoe.mirai.internal.AbstractTestWithMiraiImpl import net.mamoe.mirai.internal.MockBot import net.mamoe.mirai.internal.message.DeepMessageRefiner.refineDeep -import net.mamoe.mirai.internal.message.ForwardMessageInternal import net.mamoe.mirai.internal.message.SimpleRefineContext import net.mamoe.mirai.internal.test.runBlockingUnit import net.mamoe.mirai.internal.utils.structureToString diff --git a/mirai-core/src/jvmTest/kotlin/message/data/MessageReceiptTest.kt b/mirai-core/src/jvmTest/kotlin/message/data/MessageReceiptTest.kt index 33e4f9a80..3f67af0f7 100644 --- a/mirai-core/src/jvmTest/kotlin/message/data/MessageReceiptTest.kt +++ b/mirai-core/src/jvmTest/kotlin/message/data/MessageReceiptTest.kt @@ -16,7 +16,6 @@ import net.mamoe.mirai.internal.AbstractTestWithMiraiImpl import net.mamoe.mirai.internal.MockBot import net.mamoe.mirai.internal.contact.* import net.mamoe.mirai.internal.contact.info.GroupInfoImpl -import net.mamoe.mirai.internal.message.ForwardMessageInternal import net.mamoe.mirai.internal.message.source.OnlineMessageSourceToGroupImpl import net.mamoe.mirai.internal.network.QQAndroidClient import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopNum diff --git a/mirai-core/src/jvmTest/kotlin/message/data/MessageSerializationTest.kt b/mirai-core/src/jvmTest/kotlin/message/data/MessageSerializationTest.kt index d164bfd93..ac57bbb7c 100644 --- a/mirai-core/src/jvmTest/kotlin/message/data/MessageSerializationTest.kt +++ b/mirai-core/src/jvmTest/kotlin/message/data/MessageSerializationTest.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.message.data @@ -15,10 +15,6 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.json.* import kotlinx.serialization.serializer import net.mamoe.mirai.Mirai -import net.mamoe.mirai.internal.message.FileMessageImpl -import net.mamoe.mirai.internal.message.MarketFaceImpl -import net.mamoe.mirai.internal.message.OnlineAudioImpl -import net.mamoe.mirai.internal.message.UnsupportedMessageImpl import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody import net.mamoe.mirai.internal.utils.structureToString import net.mamoe.mirai.message.MessageSerializers