mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
ShamrockPublic
: 自発メッセージ同期ロジックの変更 x2
Signed-off-by: WhiteChi <whitechi73@outlook.com>
This commit is contained in:
parent
c3c14d6ead
commit
6043c21de5
@ -126,12 +126,32 @@ internal object AioListener: IKernelMsgListener {
|
|||||||
override fun onMsgInfoListUpdate(msgList: ArrayList<MsgRecord>?) {
|
override fun onMsgInfoListUpdate(msgList: ArrayList<MsgRecord>?) {
|
||||||
msgList?.forEach { record ->
|
msgList?.forEach { record ->
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
if (!ShamrockConfig.enableSelfMsg())
|
if (record.sendStatus == MsgConstant.KSENDSTATUSFAILED
|
||||||
|
|| record.sendStatus == MsgConstant.KSENDSTATUSSENDING) {
|
||||||
return@launch
|
return@launch
|
||||||
|
}
|
||||||
|
|
||||||
val msgHash = MessageHelper.generateMsgIdHash(record.chatType, record.msgId)
|
val msgHash = MessageHelper.generateMsgIdHash(record.chatType, record.msgId)
|
||||||
|
|
||||||
MessageDB.getInstance().messageMappingDao().updateMsgSeqByMsgHash(msgHash, record.msgSeq.toInt())
|
val mapping = MessageHelper.getMsgMappingByHash(msgHash)
|
||||||
|
if (mapping == null) {
|
||||||
|
MessageHelper.saveMsgMapping(
|
||||||
|
hash = msgHash,
|
||||||
|
qqMsgId = record.msgId,
|
||||||
|
chatType = record.chatType,
|
||||||
|
subChatType = record.chatType,
|
||||||
|
peerId = record.peerUin.toString(),
|
||||||
|
msgSeq = record.msgSeq.toInt(),
|
||||||
|
time = record.msgTime
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ShamrockConfig.enableSelfMsg())
|
||||||
|
return@launch
|
||||||
|
|
||||||
|
LogCenter.log("Update message info from ${mapping?.msgSeq} to ${record.msgSeq}", Level.INFO)
|
||||||
|
MessageDB.getInstance().messageMappingDao()
|
||||||
|
.updateMsgSeqByMsgHash(msgHash, record.msgSeq.toInt())
|
||||||
|
|
||||||
val rawMsg = record.elements.toCQCode(record.chatType, record.peerUin.toString())
|
val rawMsg = record.elements.toCQCode(record.chatType, record.peerUin.toString())
|
||||||
if (rawMsg.isEmpty()) return@launch
|
if (rawMsg.isEmpty()) return@launch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user