mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-19 13:29:17 +08:00
Re-categorize MessageProtocol packages
This commit is contained in:
parent
c1a7dd9843
commit
e6b094031c
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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.protocol
|
||||
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.pipeline.AbstractProcessorPipeline
|
||||
import net.mamoe.mirai.internal.pipeline.PipelineConfiguration
|
||||
import net.mamoe.mirai.message.data.SingleMessage
|
||||
import net.mamoe.mirai.utils.*
|
||||
|
||||
|
||||
internal open class MessageEncoderPipelineImpl :
|
||||
AbstractProcessorPipeline<MessageEncoderProcessor<*>, MessageEncoderContext, SingleMessage, ImMsgBody.Elem>(
|
||||
PipelineConfiguration(stopWhenConsumed = true),
|
||||
@OptIn(TestOnly::class)
|
||||
defaultTraceLogging
|
||||
),
|
||||
MessageEncoderPipeline {
|
||||
|
||||
private inner class MessageEncoderContextImpl(attributes: TypeSafeMap) : MessageEncoderContext,
|
||||
BaseContextImpl(attributes) {
|
||||
override var generalFlags: ImMsgBody.Elem by lateinitMutableProperty {
|
||||
ImMsgBody.Elem(generalFlags = ImMsgBody.GeneralFlags(pbReserve = PB_RESERVE_FOR_ELSE))
|
||||
}
|
||||
}
|
||||
|
||||
override fun createContext(attributes: TypeSafeMap): MessageEncoderContext = MessageEncoderContextImpl(attributes)
|
||||
|
||||
companion object {
|
||||
private val PB_RESERVE_FOR_ELSE = "78 00 F8 01 00 C8 02 00".hexToBytes()
|
||||
|
||||
@TestOnly
|
||||
val defaultTraceLogging: MiraiLoggerWithSwitch by lazy {
|
||||
MiraiLogger.Factory.create(MessageEncoderPipelineImpl::class, "MessageEncoderPipeline")
|
||||
.withSwitch(systemProp("mirai.message.encoder.pipeline.log.full", false))
|
||||
}
|
||||
}
|
||||
}
|
@ -9,6 +9,8 @@
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol
|
||||
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.message.data.SingleMessage
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
@ -15,6 +15,8 @@ import net.mamoe.mirai.internal.message.DeepMessageRefiner.refineDeep
|
||||
import net.mamoe.mirai.internal.message.EmptyRefineContext
|
||||
import net.mamoe.mirai.internal.message.LightMessageRefiner.refineLight
|
||||
import net.mamoe.mirai.internal.message.RefineContext
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.*
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.*
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.utils.runCoroutineInPlace
|
||||
import net.mamoe.mirai.message.data.*
|
||||
|
@ -7,30 +7,12 @@
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol
|
||||
package net.mamoe.mirai.internal.message.protocol.decode
|
||||
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.pipeline.PipelineConsumptionMarker
|
||||
import net.mamoe.mirai.internal.pipeline.Processor
|
||||
import net.mamoe.mirai.internal.pipeline.ProcessorPipeline
|
||||
import net.mamoe.mirai.internal.pipeline.ProcessorPipelineContext
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
import net.mamoe.mirai.message.data.MessageSourceKind
|
||||
import net.mamoe.mirai.utils.TypeKey
|
||||
import kotlin.coroutines.RestrictsSuspension
|
||||
|
||||
internal interface MessageDecoderPipeline : ProcessorPipeline<MessageDecoderProcessor, ImMsgBody.Elem, Message>
|
||||
|
||||
|
||||
@RestrictsSuspension // Implementor can only call `MessageDecoderContext.process` and `processAlso` so there will be no suspension point
|
||||
internal interface MessageDecoderContext : ProcessorPipelineContext<ImMsgBody.Elem, Message> {
|
||||
companion object {
|
||||
val BOT = TypeKey<Bot>("bot")
|
||||
val MESSAGE_SOURCE_KIND = TypeKey<MessageSourceKind>("messageSourceKind")
|
||||
val GROUP_ID = TypeKey<Long>("groupId") // zero if not group
|
||||
}
|
||||
}
|
||||
|
||||
internal interface MessageDecoder : PipelineConsumptionMarker {
|
||||
suspend fun MessageDecoderContext.process(data: ImMsgBody.Elem)
|
@ -7,14 +7,29 @@
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol
|
||||
package net.mamoe.mirai.internal.message.protocol.decode
|
||||
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.pipeline.AbstractProcessorPipeline
|
||||
import net.mamoe.mirai.internal.pipeline.PipelineConfiguration
|
||||
import net.mamoe.mirai.internal.pipeline.ProcessorPipeline
|
||||
import net.mamoe.mirai.internal.pipeline.ProcessorPipelineContext
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
import net.mamoe.mirai.message.data.MessageSourceKind
|
||||
import net.mamoe.mirai.utils.*
|
||||
import kotlin.coroutines.RestrictsSuspension
|
||||
|
||||
internal interface MessageDecoderPipeline : ProcessorPipeline<MessageDecoderProcessor, ImMsgBody.Elem, Message>
|
||||
|
||||
@RestrictsSuspension // Implementor can only call `MessageDecoderContext.process` and `processAlso` so there will be no suspension point
|
||||
internal interface MessageDecoderContext : ProcessorPipelineContext<ImMsgBody.Elem, Message> {
|
||||
companion object {
|
||||
val BOT = TypeKey<Bot>("bot")
|
||||
val MESSAGE_SOURCE_KIND = TypeKey<MessageSourceKind>("messageSourceKind")
|
||||
val GROUP_ID = TypeKey<Long>("groupId") // zero if not group
|
||||
}
|
||||
}
|
||||
|
||||
internal open class MessageDecoderPipelineImpl :
|
||||
AbstractProcessorPipeline<MessageDecoderProcessor, MessageDecoderContext, ImMsgBody.Elem, Message>(
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.protocol.encode
|
||||
|
||||
import net.mamoe.mirai.internal.pipeline.PipelineConsumptionMarker
|
||||
import net.mamoe.mirai.internal.pipeline.Processor
|
||||
import net.mamoe.mirai.message.data.SingleMessage
|
||||
import net.mamoe.mirai.utils.uncheckedCast
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
internal fun interface MessageEncoder<T : SingleMessage> : PipelineConsumptionMarker {
|
||||
suspend fun MessageEncoderContext.process(data: T)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adapter for [MessageEncoder] to be used as [Processor].
|
||||
*/
|
||||
internal class MessageEncoderProcessor<T : SingleMessage>(
|
||||
private val encoder: MessageEncoder<T>,
|
||||
private val elementType: KClass<T>,
|
||||
) : Processor<MessageEncoderContext, SingleMessage> {
|
||||
override suspend fun process(context: MessageEncoderContext, data: SingleMessage) {
|
||||
if (elementType.isInstance(data)) {
|
||||
@Suppress("ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL")
|
||||
encoder.run { context.process(data.uncheckedCast()) }
|
||||
// TODO: 2022/4/27 handle exceptions
|
||||
}
|
||||
}
|
||||
}
|
@ -7,20 +7,18 @@
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol
|
||||
package net.mamoe.mirai.internal.message.protocol.encode
|
||||
|
||||
import net.mamoe.mirai.contact.ContactOrBot
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.pipeline.PipelineConsumptionMarker
|
||||
import net.mamoe.mirai.internal.pipeline.Processor
|
||||
import net.mamoe.mirai.internal.pipeline.AbstractProcessorPipeline
|
||||
import net.mamoe.mirai.internal.pipeline.PipelineConfiguration
|
||||
import net.mamoe.mirai.internal.pipeline.ProcessorPipeline
|
||||
import net.mamoe.mirai.internal.pipeline.ProcessorPipelineContext
|
||||
import net.mamoe.mirai.message.data.MessageChain
|
||||
import net.mamoe.mirai.message.data.SingleMessage
|
||||
import net.mamoe.mirai.utils.TypeKey
|
||||
import net.mamoe.mirai.utils.uncheckedCast
|
||||
import net.mamoe.mirai.utils.*
|
||||
import kotlin.coroutines.RestrictsSuspension
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
internal interface MessageEncoderPipeline :
|
||||
ProcessorPipeline<MessageEncoderProcessor<*>, SingleMessage, ImMsgBody.Elem> {
|
||||
@ -60,23 +58,30 @@ internal interface MessageEncoderContext : ProcessorPipelineContext<SingleMessag
|
||||
}
|
||||
}
|
||||
|
||||
internal open class MessageEncoderPipelineImpl :
|
||||
AbstractProcessorPipeline<MessageEncoderProcessor<*>, MessageEncoderContext, SingleMessage, ImMsgBody.Elem>(
|
||||
PipelineConfiguration(stopWhenConsumed = true),
|
||||
@OptIn(TestOnly::class)
|
||||
defaultTraceLogging
|
||||
),
|
||||
MessageEncoderPipeline {
|
||||
|
||||
internal fun interface MessageEncoder<T : SingleMessage> : PipelineConsumptionMarker {
|
||||
suspend fun MessageEncoderContext.process(data: T)
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapter for [MessageEncoder] to be used as [Processor].
|
||||
*/
|
||||
internal class MessageEncoderProcessor<T : SingleMessage>(
|
||||
private val encoder: MessageEncoder<T>,
|
||||
private val elementType: KClass<T>,
|
||||
) : Processor<MessageEncoderContext, SingleMessage> {
|
||||
override suspend fun process(context: MessageEncoderContext, data: SingleMessage) {
|
||||
if (elementType.isInstance(data)) {
|
||||
@Suppress("ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL")
|
||||
encoder.run { context.process(data.uncheckedCast()) }
|
||||
// TODO: 2022/4/27 handle exceptions
|
||||
private inner class MessageEncoderContextImpl(attributes: TypeSafeMap) : MessageEncoderContext,
|
||||
BaseContextImpl(attributes) {
|
||||
override var generalFlags: ImMsgBody.Elem by lateinitMutableProperty {
|
||||
ImMsgBody.Elem(generalFlags = ImMsgBody.GeneralFlags(pbReserve = PB_RESERVE_FOR_ELSE))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun createContext(attributes: TypeSafeMap): MessageEncoderContext = MessageEncoderContextImpl(attributes)
|
||||
|
||||
companion object {
|
||||
private val PB_RESERVE_FOR_ELSE = "78 00 F8 01 00 C8 02 00".hexToBytes()
|
||||
|
||||
@TestOnly
|
||||
val defaultTraceLogging: MiraiLoggerWithSwitch by lazy {
|
||||
MiraiLogger.Factory.create(MessageEncoderPipelineImpl::class, "MessageEncoderPipeline")
|
||||
.withSwitch(systemProp("mirai.message.encoder.pipeline.log.full", false))
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,12 @@
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.message.data.CustomMessage
|
||||
import net.mamoe.mirai.utils.read
|
||||
|
@ -10,7 +10,12 @@
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import kotlinx.io.core.toByteArray
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
||||
|
@ -11,10 +11,10 @@ package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import kotlinx.io.core.readUShort
|
||||
import net.mamoe.mirai.internal.message.data.FileMessageImpl
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ObjMsg
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.readProtoBuf
|
||||
|
@ -14,9 +14,14 @@ import net.mamoe.mirai.contact.User
|
||||
import net.mamoe.mirai.internal.message.image.OnlineFriendImageImpl
|
||||
import net.mamoe.mirai.internal.message.image.OnlineGroupImageImpl
|
||||
import net.mamoe.mirai.internal.message.image.friendImageId
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.contact
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.contact
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
||||
|
@ -10,7 +10,12 @@
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.flags.InternalFlagOnlyMessage
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.message.data.ForwardMessage
|
||||
import net.mamoe.mirai.message.data.MessageSource
|
||||
|
@ -11,8 +11,13 @@ package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.contact.User
|
||||
import net.mamoe.mirai.internal.message.image.*
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.contact
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.contact
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.CustomFace
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
||||
|
@ -10,8 +10,13 @@
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.data.MarketFaceImpl
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.message.data.Dice
|
||||
import net.mamoe.mirai.message.data.PlainText
|
||||
|
@ -9,10 +9,10 @@
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.message.data.MusicShare
|
||||
import net.mamoe.mirai.message.data.PlainText
|
||||
import net.mamoe.mirai.message.data.content
|
||||
|
@ -9,7 +9,12 @@
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
||||
|
@ -9,11 +9,11 @@
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.message.data.PttMessage
|
||||
import net.mamoe.mirai.utils.hexToBytes
|
||||
|
@ -11,11 +11,16 @@ package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.contact.AnonymousMember
|
||||
import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoderContext.Companion.BOT
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoderContext.Companion.GROUP_ID
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoderContext.Companion.MESSAGE_SOURCE_KIND
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.contact
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext.Companion.BOT
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext.Companion.GROUP_ID
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext.Companion.MESSAGE_SOURCE_KIND
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.contact
|
||||
import net.mamoe.mirai.internal.message.source.MessageSourceInternal
|
||||
import net.mamoe.mirai.internal.message.source.OfflineMessageSourceImplData
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
|
@ -13,8 +13,13 @@ import kotlinx.io.core.toByteArray
|
||||
import net.mamoe.mirai.internal.message.data.ForwardMessageInternal
|
||||
import net.mamoe.mirai.internal.message.data.LightAppInternal
|
||||
import net.mamoe.mirai.internal.message.data.LongMessageInternal
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.collectGeneralFlags
|
||||
import net.mamoe.mirai.internal.message.runWithBugReport
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.message.data.*
|
||||
|
@ -15,10 +15,15 @@ import kotlinx.io.core.readBytes
|
||||
import kotlinx.io.core.readUInt
|
||||
import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.contact.nameCardOrNick
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.CONTACT
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.isForward
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageEncoderContext.Companion.originalMessage
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.CONTACT
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.isForward
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext.Companion.originalMessage
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import net.mamoe.mirai.utils.read
|
||||
|
@ -10,7 +10,12 @@
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.data.UnsupportedMessageImpl
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
|
||||
internal class UnsupportedMessageProtocol : MessageProtocol(priority = PRIORITY_UNSUPPORTED) {
|
||||
|
@ -9,7 +9,12 @@
|
||||
|
||||
package net.mamoe.mirai.internal.message.protocol.impl
|
||||
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.ProcessorCollector
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoder
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.HummerCommelem
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
|
||||
|
@ -15,7 +15,12 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import net.mamoe.mirai.contact.ContactOrBot
|
||||
import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.internal.contact.inferMessageSourceKind
|
||||
import net.mamoe.mirai.internal.message.protocol.*
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocol
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocolFacade
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocolFacadeImpl
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderPipelineImpl
|
||||
import net.mamoe.mirai.internal.message.protocol.decodeAndRefineLight
|
||||
import net.mamoe.mirai.internal.message.protocol.encode.MessageEncoderPipelineImpl
|
||||
import net.mamoe.mirai.internal.network.framework.AbstractMockNetworkHandlerTest
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.notice.processors.GroupExtensions
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
package net.mamoe.mirai.internal.testFramework.message.protocol
|
||||
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoder
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderContext
|
||||
import net.mamoe.mirai.internal.network.protocol.data.proto.ImMsgBody
|
||||
import net.mamoe.mirai.internal.testFramework.codegen.ValueDescAnalyzer
|
||||
import net.mamoe.mirai.internal.testFramework.desensitizer.Desensitizer.Companion.generateAndDesensitize
|
||||
|
@ -12,8 +12,8 @@ package net.mamoe.mirai.internal.bootstrap
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.BotFactory
|
||||
import net.mamoe.mirai.internal.asQQAndroidBot
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageDecoderProcessor
|
||||
import net.mamoe.mirai.internal.message.protocol.MessageProtocolFacade
|
||||
import net.mamoe.mirai.internal.message.protocol.decode.MessageDecoderProcessor
|
||||
import net.mamoe.mirai.internal.testFramework.desensitizer.Desensitizer
|
||||
import net.mamoe.mirai.internal.testFramework.message.protocol.MessageDecodingRecorder
|
||||
import net.mamoe.mirai.utils.BotConfiguration
|
||||
|
Loading…
Reference in New Issue
Block a user