feat(msg-push): filter C2C control pushes by c2c_cmd, matching QQ NT (#102)
Upgrades the blank-body heuristic to NT's exact discriminator. RE of
wrapper.linux.node (msg_header_codec_helper.cc::DecodeRoutingHead, sub_3B42650)
shows the official client classifies a C2C push by (svr_msg_type, c2c_cmd):
msgType ∈ {141,166,167} with c2c_cmd ∈ {1,73,75,129,131,133,135,192} is routed
through OnRecvSysMsg (long_cnn_msg_mgr.cc) as a system/control signal and never
shown as a chat bubble — the group-invite "[空消息]" phantom is one of these.
- proto-defs: ContentHead field 3 was mislabelled `divSeq`; it is `c2c_cmd`.
Renamed (only other use was forward.ts, which zeroes it on a fake send).
- MsgPushHead now carries c2cCmd; new isC2cControlPush() in blank-filter.ts.
- parseMsgPush + both history fetches drop control pushes by (msgType, c2cCmd)
regardless of body, so a control signal carrying stray content is caught too
(not just the empty case). isBlankMessage stays as the fallback for
content-less pushes we don't yet classify by cmd. Live path debug-logs a
control push that carried elements, in case the table ever eats real content.
NOTE: the c2c_cmd set is taken from NT; we have not captured #24's actual cmd
(our diagnostic never logged field 3), so the blank fallback remains load-bearing
until a live capture confirms which cmd the invite phantom uses.
This commit is contained in:
7 files changed
+79
-14
No files matched your search
@@ -4,7 +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 { bodyHasDecodableContent, isC2cControlPush } from './blank-filter';
|
||||
import { buildContext, type PushMsgBody } from './context';
|
||||
import { decodeEvent0x210 } from './decoders/event-0x210';
|
||||
import { decodeEvent0x2DC } from './decoders/event-0x2dc';
|
||||
@@ -86,13 +86,23 @@ export function parseMsgPush(pkt: PacketInfo, identity: IdentityService): QQEven
|
||||
const events = registry.decode(ctx);
|
||||
return events.filter((ev) => {
|
||||
if (!MESSAGE_KINDS.has(ev.kind)) return true;
|
||||
// C2C control/system signal (#102): QQ NT routes these via OnRecvSysMsg and
|
||||
// never shows them as a bubble. Drop by (msgType, c2cCmd) regardless of body
|
||||
// — the precise discriminator, the group-invite "[空消息]" phantom being one.
|
||||
if (isC2cControlPush(ctx.head)) {
|
||||
const elemCount = (ev as { elements?: unknown[] }).elements?.length ?? 0;
|
||||
if (elemCount > 0) {
|
||||
log.debug('dropped c2c control push that carried %d element(s) (kind=%s seq=%d from=%d msgType=%d cmd=%d)',
|
||||
elemCount, ev.kind, ctx.head.sequence, ctx.fromUin, ctx.head.msgType, ctx.head.c2cCmd);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if ((ev as { elements?: unknown[] }).elements?.length !== 0) return true;
|
||||
// Empty-element message (#102). Drop it when the body is genuinely empty —
|
||||
// QQ emits a content-less c2c push (msgType=166/0) alongside e.g. a group
|
||||
// invite card, which otherwise surfaces to clients as a confusing
|
||||
// "[空消息]". If instead the body *had* content we just couldn't decode,
|
||||
// keep the (still-empty) event but warn so the missing decoder gets noticed
|
||||
// rather than silently swallowed.
|
||||
// Empty-element message that's NOT a known control cmd. Drop it when the body
|
||||
// is genuinely empty (a content-less push we don't yet classify by c2cCmd).
|
||||
// If instead the body *had* content we just couldn't decode, keep the
|
||||
// (still-empty) event but warn so the missing decoder gets noticed rather
|
||||
// than silently swallowed.
|
||||
if (bodyHasDecodableContent(ctx.body)) {
|
||||
log.warn('message had content but decoded to 0 elements — missing decoder? (kind=%s seq=%d from=%d msgType=%d/%d): %s',
|
||||
ev.kind, ctx.head.sequence, ctx.fromUin, ctx.head.msgType, ctx.head.subType,
|
||||
|
||||
Reference in new issue
Block a user