diff --git a/xposed/src/main/java/qq/service/msg/MsgConvertor.kt b/xposed/src/main/java/qq/service/msg/MsgConvertor.kt index 57725cf3..94679017 100644 --- a/xposed/src/main/java/qq/service/msg/MsgConvertor.kt +++ b/xposed/src/main/java/qq/service/msg/MsgConvertor.kt @@ -1,11 +1,13 @@ package qq.service.msg +import com.google.protobuf.ByteString import com.tencent.mobileqq.qroute.QRoute import com.tencent.qqnt.kernel.nativeinterface.MsgConstant import com.tencent.qqnt.kernel.nativeinterface.MsgElement import com.tencent.qqnt.kernel.nativeinterface.MsgRecord import com.tencent.qqnt.msg.api.IMsgService import io.kritor.common.* +import io.kritor.common.Element.ElementType import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withTimeoutOrNull import moe.fuqiuluo.shamrock.helper.ActionMsgException @@ -154,8 +156,8 @@ private object MsgConvertor { val elem = Element.newBuilder() elem.type = ElementType.IMAGE elem.setImage(ImageElement.newBuilder().apply { - this.file = md5 - this.url = when (record.chatType) { + this.file = ByteString.copyFromUtf8(md5) + this.fileUrl = when (record.chatType) { MsgConstant.KCHATTYPEDISC, MsgConstant.KCHATTYPEGROUP -> RichProtoSvc.getGroupPicDownUrl( originalUrl = originalUrl, md5 = md5, @@ -194,7 +196,7 @@ private object MsgConvertor { else -> throw UnsupportedOperationException("Not supported chat type: ${record.chatType}") } this.type = - if (image.isFlashPic == true) ImageType.FLASH else if (image.original) ImageType.ORIGIN else ImageType.COMMON + if (image.isFlashPic == true) ImageElement.ImageType.FLASH else if (image.original) ImageElement.ImageType.ORIGIN else ImageElement.ImageType.COMMON this.subType = image.picSubType }) @@ -211,7 +213,7 @@ private object MsgConvertor { elem.type = ElementType.VOICE elem.setVoice(VoiceElement.newBuilder().apply { - this.url = when (record.chatType) { + this.fileUrl = when (record.chatType) { MsgConstant.KCHATTYPEC2C -> RichProtoSvc.getC2CPttDownUrl("0", ptt.fileUuid) MsgConstant.KCHATTYPEGROUP, MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGroupPttDownUrl( "0", @@ -221,7 +223,7 @@ private object MsgConvertor { else -> throw UnsupportedOperationException("Not supported chat type: ${record.chatType}") } - this.file = md5 + this.file = ByteString.copyFromUtf8(md5) this.magic = ptt.voiceChangeType != MsgConstant.KPTTVOICECHANGETYPENONE }) @@ -240,8 +242,8 @@ private object MsgConvertor { } else video.fileName.split(".")[0].hex2ByteArray() elem.type = ElementType.VIDEO elem.setVideo(VideoElement.newBuilder().apply { - this.file = md5.toHexString() - this.url = when (record.chatType) { + this.file = ByteString.copyFromUtf8(md5.toHexString()) + this.fileUrl = when (record.chatType) { MsgConstant.KCHATTYPEGROUP -> RichProtoSvc.getGroupVideoDownUrl("0", md5, video.fileUuid) MsgConstant.KCHATTYPEC2C -> RichProtoSvc.getC2CVideoDownUrl("0", md5, video.fileUuid) MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGroupVideoDownUrl("0", md5, video.fileUuid) @@ -334,9 +336,9 @@ private object MsgConvertor { } if (sourceRecords.isNullOrEmpty()) { LogCenter.log("无法查询到回复的消息ID: seq = $msgSeq", Level.WARN) - this.messageId = reply.replayMsgId + this.messageId = reply.replayMsgId.toString() } else { - this.messageId = sourceRecords.first().msgId + this.messageId = sourceRecords.first().msgId.toString() } }) return Result.success(elem.build())