feat(appmsg): 支持合并聊天记录与文件消息解析#24
Open
hqhq1025 wants to merge 1 commit intojackwener:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #22。
背景
当前
wx history/wx search对 WeChatappmsg(base type = 49)的处理比较粗:type=19的合并聊天记录会退化成普通链接标题type=6的文件消息只显示标题,缺少文件大小 / 扩展名等信息--type link|file的 SQL 过滤直接比较local_type = 49,会漏掉大量 WeChat 4.x 的真实appmsg行,因为这类消息经常把 subtype 编进高 32 位,例如19<<32 | 49、57<<32 | 49实际本地数据里,这会直接影响历史查询、搜索结果,以及对刚发送消息的验证体验。例如最新发到文件传输助手的合并聊天记录,在旧逻辑里会显示成
[链接] ...。改动
src/daemon/query.rs中把appmsg解析改成 DOM-first:type=19:解析recorditem里的 CDATA / 内嵌 XML,输出合并聊天记录摘要type=6:解析appattach,补充文件大小 / 扩展名 / md5type=57:保留引用消息解析,并复用新的递归逻辑history/search的--type过滤改为按低 32 位 base type 比较,避免19<<32 | 49/57<<32 | 49这类消息被漏掉query_messages对高位 subtype 的过滤行为#[ignore]真实数据 probe,方便后续在开发机上继续回归验证appmsg解析坑和本地验证坑补充到CLAUDE.md兼容性
appmsg消息行为不变type字段仍保持现有语义,表示底层 base type;本 PR 主要改善content的可读性和--type的过滤正确性appmsg解析仍保留 legacy string fallback,避免坏 XML 直接把整条消息打空roxmltree验证
项目级验证:
cargo check cargo test appmsg_tests -- --nocapture本地真实数据验证(ignored tests,使用
~/.wx-cli/cache,不把真实消息内容写入仓库):结果:
27036条 base-49appmsg,解析成功26784条1370条type=6文件消息、558条type=19合并聊天记录、6517条type=57引用消息19<<32 | 49)已能正确解析成多条聊天摘要,不再显示成普通链接标题未跑完整 cross-target check:当前 macOS 本机缺 Linux / Windows 对应 C 交叉工具链,
zstd-sys/libsqlite3-sys会在工具链层面失败。本 PR 没有新增平台分支或 C 依赖。