Commit 200a140f authored by Him188's avatar Him188

Fix forward message displaying on TIM PC

parent 1786c95e
......@@ -282,16 +282,16 @@ internal class GroupImpl(
override suspend fun sendMessage(message: Message): MessageReceipt<Group> {
check(!isBotMuted) { throw BotIsBeingMutedException(this) }
return sendMessageImpl(message).also {
return sendMessageImpl(message, false).also {
logMessageSent(message)
}
}
@OptIn(MiraiExperimentalAPI::class)
private suspend fun sendMessageImpl(message: Message): MessageReceipt<Group> {
private suspend fun sendMessageImpl(message: Message, isForward: Boolean): MessageReceipt<Group> {
if (message is MessageChain) {
if (message.anyIsInstance<ForwardMessage>()) {
return sendMessageImpl(message.singleOrNull() ?: error("ForwardMessage must be standalone"))
return sendMessageImpl(message.singleOrNull() ?: error("ForwardMessage must be standalone"), true)
}
}
if (message is ForwardMessage) {
......@@ -333,7 +333,8 @@ internal class GroupImpl(
val response: MessageSvc.PbSendMsg.Response = MessageSvc.PbSendMsg.createToGroup(
bot.client,
this@GroupImpl,
msg
msg,
isForward
) {
source = it
}.sendAndExpect()
......
......@@ -43,6 +43,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushForceOffli
import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushNotify
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgCtrl.MsgCtrl
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import net.mamoe.mirai.qqandroid.network.protocol.data.proto.SyncCookie
import net.mamoe.mirai.qqandroid.network.protocol.packet.*
......@@ -462,6 +463,7 @@ internal class MessageSvc {
client: QQAndroidClient,
group: Group,
message: MessageChain,
isForward: Boolean,
sourceCallback: (MessageSourceToGroupImpl) -> Unit
): OutgoingPacket {
......@@ -475,7 +477,7 @@ internal class MessageSvc {
// sourceMessage = message
)
sourceCallback(source)
return createToGroup(client, group.id, message, source)
return createToGroup(client, group.id, message, isForward, source)
}
/**
......@@ -486,6 +488,7 @@ internal class MessageSvc {
client: QQAndroidClient,
groupCode: Long,
message: MessageChain,
isForward: Boolean,
source: MessageSourceToGroupImpl
): OutgoingPacket = buildOutgoingUniPacket(client) {
///writeFully("0A 08 0A 06 08 89 FC A6 8C 0B 12 06 08 01 10 00 18 00 1A 1F 0A 1D 12 08 0A 06 0A 04 F0 9F 92 A9 12 11 AA 02 0E 88 01 00 9A 01 08 78 00 F8 01 00 C8 02 00 20 9B 7A 28 F4 CA 9B B8 03 32 34 08 92 C2 C4 F1 05 10 92 C2 C4 F1 05 18 E6 ED B9 C3 02 20 89 FE BE A4 06 28 89 84 F9 A2 06 48 DE 8C EA E5 0E 58 D9 BD BB A0 09 60 1D 68 92 C2 C4 F1 05 70 00 40 01".hexToBytes())
......@@ -505,7 +508,10 @@ internal class MessageSvc {
msgSeq = client.atomicNextMessageSequenceId(),
msgRand = source.internalId,
syncCookie = EMPTY_BYTE_ARRAY,
msgVia = 1
msgVia = 1,
msgCtrl = if (isForward) MsgCtrl(
msgFlag = 4
) else null
)
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment