mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: Automatically remove group forward messages
Signed-off-by: 白池 <whitechi73@outlook.com>
This commit is contained in:
parent
a3171b3111
commit
cb7bf00e17
@ -18,6 +18,8 @@ import moe.fuqiuluo.shamrock.helper.db.MessageDB
|
|||||||
import moe.fuqiuluo.shamrock.tools.asJsonObject
|
import moe.fuqiuluo.shamrock.tools.asJsonObject
|
||||||
import moe.fuqiuluo.shamrock.tools.asString
|
import moe.fuqiuluo.shamrock.tools.asString
|
||||||
import moe.fuqiuluo.shamrock.tools.hex2ByteArray
|
import moe.fuqiuluo.shamrock.tools.hex2ByteArray
|
||||||
|
import moe.fuqiuluo.shamrock.utils.PlatformUtils
|
||||||
|
import moe.fuqiuluo.shamrock.utils.PlatformUtils.QQ_9_0_8_VER
|
||||||
|
|
||||||
internal typealias IMsgElementConverter = suspend (Int, String, String, MsgElement) -> MessageSegment
|
internal typealias IMsgElementConverter = suspend (Int, String, String, MsgElement) -> MessageSegment
|
||||||
|
|
||||||
@ -167,6 +169,11 @@ internal object NtMsgElementConverter {
|
|||||||
val originalUrl = image.originImageUrl ?: ""
|
val originalUrl = image.originImageUrl ?: ""
|
||||||
LogCenter.log({ "receive image: $image" }, Level.DEBUG)
|
LogCenter.log({ "receive image: $image" }, Level.DEBUG)
|
||||||
|
|
||||||
|
var storeId = 0
|
||||||
|
if (PlatformUtils.getQQVersionCode() > QQ_9_0_8_VER) {
|
||||||
|
storeId = image.storeID
|
||||||
|
}
|
||||||
|
|
||||||
return MessageSegment(
|
return MessageSegment(
|
||||||
type = "image",
|
type = "image",
|
||||||
data = hashMapOf(
|
data = hashMapOf(
|
||||||
@ -192,6 +199,7 @@ internal object NtMsgElementConverter {
|
|||||||
sha = "",
|
sha = "",
|
||||||
fileSize = image.fileSize.toULong(),
|
fileSize = image.fileSize.toULong(),
|
||||||
peer = peerId,
|
peer = peerId,
|
||||||
|
storeId = storeId
|
||||||
)
|
)
|
||||||
|
|
||||||
MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGuildPicDownUrl(
|
MsgConstant.KCHATTYPEGUILD -> RichProtoSvc.getGuildPicDownUrl(
|
||||||
|
@ -296,7 +296,12 @@ internal object NtV2RichMediaSvc: BaseSvc() {
|
|||||||
contact = contact,
|
contact = contact,
|
||||||
message = ArrayList(messages),
|
message = ArrayList(messages),
|
||||||
uniseq = uniseq.qqMsgId
|
uniseq = uniseq.qqMsgId
|
||||||
) { _, _ -> }
|
) { _, _ ->
|
||||||
|
val kernelService = NTServiceFetcher.kernelService
|
||||||
|
val sessionService = kernelService.wrapperSession
|
||||||
|
val msgService = sessionService.msgService
|
||||||
|
msgService.deleteMsg(contact, arrayListOf(uniseq.qqMsgId), null)
|
||||||
|
}
|
||||||
it.invokeOnCancellation {
|
it.invokeOnCancellation {
|
||||||
RichMediaUploadHandler.removeListener(uniseq.qqMsgId)
|
RichMediaUploadHandler.removeListener(uniseq.qqMsgId)
|
||||||
}
|
}
|
||||||
|
@ -208,9 +208,10 @@ internal object RichProtoSvc: BaseSvc() {
|
|||||||
sha: String = "",
|
sha: String = "",
|
||||||
fileSize: ULong = 0uL,
|
fileSize: ULong = 0uL,
|
||||||
width: UInt = 0u,
|
width: UInt = 0u,
|
||||||
height: UInt = 0u
|
height: UInt = 0u,
|
||||||
|
storeId: Int = 0
|
||||||
): String {
|
): String {
|
||||||
val isNtServer = originalUrl.startsWith("/download")
|
val isNtServer = storeId == 1 || originalUrl.startsWith("/download")
|
||||||
val domain = if (isNtServer) MULTIMEDIA_DOMAIN else C2C_PIC
|
val domain = if (isNtServer) MULTIMEDIA_DOMAIN else C2C_PIC
|
||||||
if (originalUrl.isNotEmpty()) {
|
if (originalUrl.isNotEmpty()) {
|
||||||
if (fileId.isNotEmpty()) getNtPicRKey(
|
if (fileId.isNotEmpty()) getNtPicRKey(
|
||||||
@ -238,7 +239,7 @@ internal object RichProtoSvc: BaseSvc() {
|
|||||||
}
|
}
|
||||||
return "https://$domain$originalUrl"
|
return "https://$domain$originalUrl"
|
||||||
}
|
}
|
||||||
return "https://$domain/offpic_new/0/123-0-${md5}/0?term=2"
|
return "https://$domain/offpic_new/0/0-0-${md5}/0?term=2"
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getGuildPicDownUrl(
|
suspend fun getGuildPicDownUrl(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user