fix(msg-push): drop blank "[空消息]" pushes in c2c/group history too (#102)
The #102 fix dropped content-less control pushes only in parseMsgPush (live). History fetches (fetchC2cMessageRange / fetchGroupMessageRange) decoded straight into the result, so the same phantom resurfaced as "[空消息]" on backfill. RE of wrapper.linux.node confirms QQ NT filters blanks on BOTH paths — live/roam C2C via c2c_roam_msg_mgr.cc::FilterBlankMsgAndRetryFetch and group roam via group_roam_msg_worker.cc::FilterBlankSeqsMsg. Extracts the blank test into blank-filter.ts (bodyHasDecodableContent + isBlankMessage) and applies it in all three message-producing paths. A message that decoded to 0 elements but whose body carried content is a missing decoder, not a blank — isBlankMessage returns false there so it's kept (live path still warns).
This commit is contained in:
6 files changed
+103
-22
No files matched your search
@@ -3,6 +3,7 @@ import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { SsoGetGroupMsg, SsoGetGroupMsgResponse } from '@snowluma/proto-defs/get-group-msg';
|
||||
import type { QQEventVariant } from '../events';
|
||||
import type { IdentityService } from '../identity-service';
|
||||
import { isBlankMessage } from './blank-filter';
|
||||
import { buildContextFromMessage } from './context';
|
||||
import { decodeGroupMessage } from './decoders/group-message';
|
||||
|
||||
@@ -48,7 +49,11 @@ export async function fetchGroupMessageRange(
|
||||
const ctx = buildContextFromMessage(msg, selfUin, identity);
|
||||
if (!ctx) continue;
|
||||
for (const ev of decodeGroupMessage(ctx)) {
|
||||
if (ev.kind === 'group_message' && ev.msgSeq > 0) out.push(ev);
|
||||
if (ev.kind !== 'group_message' || ev.msgSeq <= 0) continue;
|
||||
// Drop content-less control pushes (the "[空消息]" phantom, #102) just as
|
||||
// QQ NT does on its group roam/history fetch — keep history parity with live.
|
||||
if (isBlankMessage(ev.elements, ctx.body)) continue;
|
||||
out.push(ev);
|
||||
}
|
||||
}
|
||||
out.sort((a, b) => a.msgSeq - b.msgSeq);
|
||||
|
||||
Reference in new issue
Block a user