Skip to content

bug: ext_buffer field 4 (inviter_username) misinterpreted as group_nickname #80

@Rayinf

Description

@Rayinf

Description

wx members and wx history/wx search output in group chat context sometimes display an incorrect group_nickname — specifically, the inviter's username instead of the actual group nickname.

Root Cause

When parsing chat_room.ext_buffer (protobuf), the code treats field 4 of each member record as group_nickname. Based on cross-referencing with contact table data, the actual semantics are:

Field Meaning
field 1 wxid
field 2 group nickname (actual)
field 3 flag/role
field 4 inviter username

Reproduction

Contact table (anonymized):

User A: username=wxid_xxx, nick_name=A, alias=A_custom_id
User B: username=custom_id_b, nick_name=B, alias=B_alias

User A was invited by User B into a group chat.

wx members output for User A:

{
  "contact_display": "A",
  "display": "custom_id_b",
  "group_nickname": "custom_id_b",
  "username": "wxid_xxx"
}

display and group_nickname incorrectly show User B's username (the inviter) instead of User A's actual group nickname.

Expected Behavior

{
  "contact_display": "A",
  "display": "A",
  "group_nickname": "",
  "username": "wxid_xxx"
}

Suggested Fix

In the ext_buffer protobuf parser:

  • group_nickname should read from field 2, not field 4
  • Field 4 can be exposed as a new inviter_username field, or ignored
  • The display name resolution should use: field 2 (group_nickname)contact.remarkcontact.nick_nameusername

Impact

Any group member whose inviter has a non-empty username will display the inviter's username as their group_nickname and display name. This affects:

  • wx members output
  • wx history / wx search sender field in group context
  • Any downstream analysis relying on sender identity

Environment

  • wx-cli version: 0.2.0
  • Platform: macOS Apple Silicon
  • WeChat version: 4.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions