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

Commit

Permalink
Shamrock: fix 群聊和私聊转发分别处理
Browse files Browse the repository at this point in the history
  • Loading branch information
ikechan8370 committed Mar 14, 2024
1 parent 7d0b602 commit 1d035fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ internal class ElemMaker {
runCatching {
fileInfo.uuid.toUInt()
}.onFailure {
NtV2RichMediaSvc.requestUploadNtPic(file, fileInfo.md5, fileInfo.sha, fileInfo.fileName, picWidth.toUInt(), picHeight.toUInt(), 5) {
NtV2RichMediaSvc.requestUploadNtPic(file, fileInfo.md5, fileInfo.sha, fileInfo.fileName, picWidth.toUInt(), picHeight.toUInt(), 5, chatType) {
when(chatType) {
MsgConstant.KCHATTYPEGROUP -> {
sceneType = 2u
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,14 @@ internal object NtV2RichMediaSvc: BaseSvc() {
width: UInt,
height: UInt,
retryCnt: Int,
chatType: Int = MsgConstant.KCHATTYPEGROUP,
sceneBuilder: suspend SceneInfo.() -> Unit
): Result<UploadRsp> {
return runCatching {
requestUploadNtPic(file, md5, sha, name, width, height, sceneBuilder).getOrThrow()
requestUploadNtPic(file, md5, sha, name, width, height, chatType, sceneBuilder).getOrThrow()
}.onFailure {
if (retryCnt > 0) {
return requestUploadNtPic(file, md5, sha, name, width, height, retryCnt - 1, sceneBuilder)
return requestUploadNtPic(file, md5, sha, name, width, height, retryCnt - 1, chatType, sceneBuilder)
}
}
}
Expand All @@ -422,6 +423,7 @@ internal object NtV2RichMediaSvc: BaseSvc() {
name: String,
width: UInt,
height: UInt,
chatType: Int,
sceneBuilder: suspend SceneInfo.() -> Unit
): Result<UploadRsp> {
val req = NtV2RichMediaReq(
Expand Down Expand Up @@ -466,8 +468,18 @@ internal object NtV2RichMediaSvc: BaseSvc() {
noNeedCompatMsg = true
)
).toByteArray()
val buffer = sendOidbAW("OidbSvcTrpcTcp.0x11c4_100", 4548, 100, req, true, timeout = 3_000)?.slice(4)
?: return Result.failure(Exception("no response: timeout"))
val buffer = when (chatType) {
MsgConstant.KCHATTYPEGROUP -> {
sendOidbAW("OidbSvcTrpcTcp.0x11c4_100", 4548, 100, req, true, timeout = 3_000)?.slice(4)
?: return Result.failure(Exception("no response: timeout"))
}
MsgConstant.KCHATTYPEC2C -> {
sendOidbAW("OidbSvcTrpcTcp.0x11c5_100", 4549, 100, req, true, timeout = 3_000)?.slice(4)
?: return Result.failure(Exception("no response: timeout"))
}

else -> return Result.failure(Exception("unknown chat type: $chatType"))
}
val rspBuffer = buffer.decodeProtobuf<TrpcOidb>().buffer
val rsp = rspBuffer.decodeProtobuf<NtV2RichMediaRsp>()
if (rsp.upload == null) {
Expand Down

1 comment on commit 1d035fa

@fuqiuluo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个提交可能需要为当前的主分支(kritor)单独再提交一次哦。

Please sign in to comment.