Skip to content

feat(appmsg): 支持引用消息原文解析#28

Open
hqhq1025 wants to merge 2 commits intojackwener:mainfrom
hqhq1025:codex/quote-refermsg
Open

feat(appmsg): 支持引用消息原文解析#28
hqhq1025 wants to merge 2 commits intojackwener:mainfrom
hqhq1025:codex/quote-refermsg

Conversation

@hqhq1025
Copy link
Copy Markdown

@hqhq1025 hqhq1025 commented May 4, 2026

背景

WeChat 4.x 的引用消息是 type=57 的 appmsg,真实 local_type 会编码成 57<<32 | 49。现有输出只能显示 [引用] <title>,没有解析 <refermsg> 里的原消息内容;同时 history/search --type link|filelocal_type = 49 精确匹配,会漏掉这些编码后的引用消息。

改动

  • type=57 引用消息优先解析 <refermsg><content>,并带上 <displayname>,输出为:
    • [引用] 当前消息
    • ↳ 发送者: 被引用内容
  • history / search 的消息类型过滤改为比较低 32 位:(local_type & 4294967295) = ?
  • search --type link|file 对 appmsg 行先解压并格式化,再按可见内容匹配,支持搜到压缩 BLOB 里引用原文的关键词
  • 增加 appmsg 回归测试覆盖引用内容、base-type 过滤、压缩 appmsg 搜索
  • README / SKILL 同步说明引用输出格式和 appmsg 类型过滤行为

真实数据验证

用本地真实聊天记录 赵一诺 验证:

{
  "quote_output_count": 133,
  "with_ref_line": 133,
  "sample": {
    "content": "[引用] 诶呀\n  ↳ 不再熬夜: 对这个是啥",
    "local_id": 14807,
    "time": "2026-05-04 15:06",
    "type": "链接/文件"
  }
}

history '赵一诺' --type linktotal=1178quote_count=738with_ref_line=738

search 'claude' --in '赵一诺' --type link 能搜到引用原文里的 claude

[引用] 我也没有用ai啊
  ↳ 不再熬夜: 昨天用 claude 爬小红书数据来着

验证

cargo test appmsg_tests -- --nocapture          # 4 passed
cargo test --bin wx -- --nocapture              # 45 passed
cargo check                                     # passed
cargo build                                     # passed
git diff --check                                # passed

跨平台 check 在当前 macOS 环境未跑到项目 Rust 代码:

cargo check --target x86_64-unknown-linux-gnu   # blocked: missing x86_64-linux-gnu-gcc
cargo check --target x86_64-pc-windows-msvc     # blocked: missing Windows/MSVC C headers/toolchain for libsqlite3-sys/zstd-sys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant