mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-18 06:20:29 +00:00
fix: 合并转发
This commit is contained in:
parent
7ecb01dc9f
commit
5cc5149aed
@ -75,6 +75,7 @@ class MessageUniqueWrapper {
|
||||
const hash = crypto.createHash('sha1').update(key);
|
||||
const shortId = parseInt(hash.digest('hex').slice(0, 8), 16);
|
||||
const isExist = this.msgIdMap.getKey(shortId);
|
||||
console.log(`${peer.peerUid} ${msgId} ------- ${shortId}`);
|
||||
if (isExist && isExist === msgId) {
|
||||
return shortId;
|
||||
}
|
||||
@ -84,7 +85,7 @@ class MessageUniqueWrapper {
|
||||
}
|
||||
|
||||
getMsgIdAndPeerByShortId(shortId: number): { MsgId: string; Peer: Peer } | undefined {
|
||||
const data = this.msgIdMap.getKey(shortId);
|
||||
const data = this.msgDataMap.getKey(shortId);
|
||||
if (data) {
|
||||
const [msgId, chatTypeStr, peerUid] = data.split('|');
|
||||
const peer: Peer = {
|
||||
|
||||
@ -52,19 +52,13 @@ msgListener.onGroupFileInfoUpdate = (groupFileListResult: onGroupFileInfoUpdateP
|
||||
}
|
||||
};
|
||||
|
||||
// msgListener.onAddSendMsg = (msgRecord: RawMessage) => {
|
||||
// // console.log("sent msg", msgRecord, sendMessagePool);
|
||||
// for (const [uuid, cb] of sentMsgTasks) {
|
||||
// cb(msgRecord);
|
||||
// sentMsgTasks.delete(uuid);
|
||||
// }
|
||||
// if (sendMessagePool[msgRecord.peerUid]) {
|
||||
// const r = sendMessagePool[msgRecord.peerUid]?.(msgRecord);
|
||||
// if (r instanceof Promise) {
|
||||
// r.then().catch(logError);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
msgListener.onAddSendMsg = (msgRecord: RawMessage) => {
|
||||
// console.log("sent msg", msgRecord, sendMessagePool);
|
||||
for (const [uuid, cb] of sentMsgTasks) {
|
||||
cb(msgRecord);
|
||||
sentMsgTasks.delete(uuid);
|
||||
}
|
||||
};
|
||||
|
||||
// msgListener.onMsgInfoListUpdate = (msgInfoList: RawMessage[]) => {
|
||||
// msgInfoList.forEach(msg => {
|
||||
|
||||
@ -109,14 +109,15 @@ export async function handleForwardNode(destPeer: Peer, messageNodes: OB11Messag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查srcPeer是否一致,不一致则需要克隆成自己的消息, 让所有srcPeer都变成自己的,使其保持一致才能够转发
|
||||
const nodeMsgArray: Array<RawMessage> = [];
|
||||
|
||||
let srcPeer: Peer | undefined = undefined;
|
||||
let needSendSelf = false;
|
||||
for (const msgId of nodeMsgIds) {
|
||||
const nodeMsgPeer = await MessageUnique.getPeerByMsgId(msgId);
|
||||
const nodeMsg = (await NTQQMsgApi.getMsgsByMsgId(nodeMsgPeer?.Peer!, [msgId])).msgList[0];
|
||||
console.log("4545",nodeMsgPeer);
|
||||
if (nodeMsg) {
|
||||
nodeMsgArray.push(nodeMsg);
|
||||
if (!srcPeer) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user