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:
DrSmoothl committed 2026-06-16 01:24:31 +08:00
1 parent d5af6b10ef
commit 2ffb6192dd
6 files changed
+103 -22

No files matched your search

+1 -16
View File
@@ -4,6 +4,7 @@ import type { PacketInfo } from '@snowluma/common/protocol-types';
import type { Elem } from '@snowluma/proto-defs/element';
import type { QQEventVariant } from '../events';
import type { IdentityService } from '../identity-service';
import { bodyHasDecodableContent } from './blank-filter';
import { buildContext, type PushMsgBody } from './context';
import { decodeEvent0x210 } from './decoders/event-0x210';
import { decodeEvent0x2DC } from './decoders/event-0x2dc';
@@ -53,22 +54,6 @@ const MESSAGE_KINDS = new Set<QQEventVariant['kind']>([
'friend_message', 'group_message', 'temp_message',
]);
/**
* Whether a push body carries anything the rich-body decoder could turn into an
* element: source `richText.elems`, a voice (`ptt`), a c2c file
* (`notOnlineFile`), or serialised `msgContent` file metadata. Mirrors exactly
* what {@link decodeRichBody} reads. A body that has none of these is a
* genuinely content-less control push, not an element type we fail to decode.
*/
function bodyHasDecodableContent(body: PushMsgBody | undefined): boolean {
const rt = body?.richText;
if (rt) {
if (rt.elems && rt.elems.length > 0) return true;
if (rt.ptt || rt.notOnlineFile) return true;
}
return !!(body?.msgContent && body.msgContent.length > 0);
}
/**
* Summarise a body that decoded to zero elements despite carrying content —
* each element's field names, every `commonElem`'s serviceType/businessType +