Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
fix build err
Browse files Browse the repository at this point in the history
  • Loading branch information
whitechi73 authored Apr 4, 2024
1 parent 9aef71b commit 042f4bd
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions xposed/src/main/java/qq/service/msg/MsgConvertor.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
})

Expand All @@ -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",
Expand All @@ -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
})

Expand All @@ -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)
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 042f4bd

Please sign in to comment.