mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: forward messages resources upload
This commit is contained in:
parent
659d4e5da4
commit
d33cace7aa
@ -370,13 +370,14 @@ internal object NtV2RichMediaSvc: QQInterfaces() {
|
|||||||
width: UInt,
|
width: UInt,
|
||||||
height: UInt,
|
height: UInt,
|
||||||
retryCnt: Int,
|
retryCnt: Int,
|
||||||
|
chatType: Int,
|
||||||
sceneBuilder: suspend SceneInfo.() -> Unit
|
sceneBuilder: suspend SceneInfo.() -> Unit
|
||||||
): Result<UploadRsp> {
|
): Result<UploadRsp> {
|
||||||
return runCatching {
|
return runCatching {
|
||||||
requestUploadNtPic(file, md5, sha, name, width, height, sceneBuilder).getOrThrow()
|
requestUploadNtPic(file, md5, sha, name, width, height, chatType, sceneBuilder).getOrThrow()
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
if (retryCnt > 0) {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,6 +389,7 @@ internal object NtV2RichMediaSvc: QQInterfaces() {
|
|||||||
name: String,
|
name: String,
|
||||||
width: UInt,
|
width: UInt,
|
||||||
height: UInt,
|
height: UInt,
|
||||||
|
chatType: Int,
|
||||||
sceneBuilder: suspend SceneInfo.() -> Unit
|
sceneBuilder: suspend SceneInfo.() -> Unit
|
||||||
): Result<UploadRsp> {
|
): Result<UploadRsp> {
|
||||||
val req = NtV2RichMediaReq(
|
val req = NtV2RichMediaReq(
|
||||||
@ -427,12 +429,20 @@ internal object NtV2RichMediaSvc: QQInterfaces() {
|
|||||||
tryFastUploadCompleted = true,
|
tryFastUploadCompleted = true,
|
||||||
srvSendMsg = false,
|
srvSendMsg = false,
|
||||||
clientRandomId = Random.nextULong(),
|
clientRandomId = Random.nextULong(),
|
||||||
compatQMsgSceneType = 1u,
|
compatQMsgSceneType = 2u,
|
||||||
clientSeq = Random.nextUInt(),
|
clientSeq = Random.nextUInt(),
|
||||||
noNeedCompatMsg = false
|
noNeedCompatMsg = true
|
||||||
)
|
)
|
||||||
).toByteArray()
|
).toByteArray()
|
||||||
val fromServiceMsg = sendOidbAW("OidbSvcTrpcTcp.0x11c5_100", 4549, 100, req, true, timeout = 3.seconds)
|
val fromServiceMsg = when (chatType) {
|
||||||
|
MsgConstant.KCHATTYPEGROUP -> {
|
||||||
|
sendOidbAW("OidbSvcTrpcTcp.0x11c4_100", 4548, 100, req, true, timeout = 3.seconds)
|
||||||
|
}
|
||||||
|
MsgConstant.KCHATTYPEC2C -> {
|
||||||
|
sendOidbAW("OidbSvcTrpcTcp.0x11c5_100", 4549, 100, req, true, timeout = 3.seconds)
|
||||||
|
}
|
||||||
|
else -> return Result.failure(Exception("unknown chat type: $chatType"))
|
||||||
|
}
|
||||||
if (fromServiceMsg == null || fromServiceMsg.wupBuffer == null) {
|
if (fromServiceMsg == null || fromServiceMsg.wupBuffer == null) {
|
||||||
return Result.failure(Exception("unable to request upload nt pic"))
|
return Result.failure(Exception("unable to request upload nt pic"))
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ suspend fun List<Element>.toRichText(contact: Contact): Result<Pair<String, Rich
|
|||||||
runCatching {
|
runCatching {
|
||||||
fileInfo.uuid.toUInt()
|
fileInfo.uuid.toUInt()
|
||||||
}.onFailure {
|
}.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, contact.chatType) {
|
||||||
when(contact.chatType) {
|
when(contact.chatType) {
|
||||||
MsgConstant.KCHATTYPEGROUP -> {
|
MsgConstant.KCHATTYPEGROUP -> {
|
||||||
sceneType = 2u
|
sceneType = 2u
|
||||||
|
Loading…
x
Reference in New Issue
Block a user