Skip to content

Conversation

@shivshil
Copy link

@shivshil shivshil commented Feb 6, 2026

Problem

isGroupHandle(identifier:guid:) in RPCPayloads.swift always returns false for group chats in RPC output (is_group field).

The function prefers identifier over guid:

let handle = identifier.isEmpty ? guid : identifier
return handle.contains(";+;") || handle.contains(";-;")

For group chats:

  • identifier = bare GUID (e.g., 70012e07fc544289a74e87ecaf2ebe93) — no prefix
  • guid = prefixed (e.g., any;+;70012e07fc544289a74e87ecaf2ebe93) — has ;+;

Since ChatInfo always populates identifier, it's never empty, so guid is never checked. The bare GUID doesn't contain ;+;, so the function returns false.

Additionally, the ;-; check is incorrect — that prefix indicates DMs (any;-;+14155551212), not groups.

Fix

func isGroupHandle(identifier: String, guid: String) -> Bool {
  return guid.contains(";+;") || identifier.contains(";+;")
}

Always check guid (which carries the prefix), also check identifier as a fallback, and only match the group prefix ;+;.

Verification

Tested with imsg rpc --json on macOS 15.x:

Before fix:

  • Group chat 26: "is_group": false
  • DM chat 3: "is_group": false

After fix:

  • Group chat 26: "is_group": true
  • DM chat 3: "is_group": false

This affects both chats.list and message notification payloads in the RPC server. The CLI watch and history commands (which use MessagePayload / OutputModels.swift) are unaffected since they don't emit is_group.

The previous implementation preferred `identifier` over `guid` when
checking for group chat prefixes. For group chats, `identifier` contains
the bare GUID (e.g. `70012e07fc54...`) which never has the `;+;` prefix,
while `guid` contains the prefixed form (e.g. `any;+;70012e07fc54...`).

Since `identifier` is never empty (ChatInfo always populates it), the
`guid` field was never checked, causing `is_group` to always return
`false` for group chats in RPC output.

Also removed the `;-;` check since that prefix indicates DMs, not groups.

Fix: always check both `guid` and `identifier` for the `;+;` group prefix.
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