Skip to content

feat: Add isGroup support to detect group chats#71

Open
PeterRosdahl wants to merge 2 commits intosteipete:mainfrom
PeterRosdahl:feature/is-group-support
Open

feat: Add isGroup support to detect group chats#71
PeterRosdahl wants to merge 2 commits intosteipete:mainfrom
PeterRosdahl:feature/is-group-support

Conversation

@PeterRosdahl
Copy link

Summary

Adds the ability to detect whether a message is from a group chat.

Changes

  • Add isGroup boolean to Message struct
  • Update SQL queries to JOIN against chat table and fetch chat.style
  • Map chat.style == 43isGroup = true
  • Add is_group field to JSON output

Testing

Tested with synthetic data by copying chat.db and modifying style to verify both cases:

  • style=45is_group: false
  • style=43is_group: true

Usage

imsg history --chat-id 3 --json | jq '.is_group'

Note: Apologies for PR #70 which was closed - I was a bit too quick on the keyboard and submitted before proper testing. This one has been verified.

- Add isGroup boolean to Message struct
- JOIN chat table in SQL queries to fetch chat.style
- Map chat.style == 43 to isGroup = true
- Add is_group field to JSON output
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51987ef150

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

: ""
var sql = """
SELECT m.ROWID, m.handle_id, h.id, IFNULL(m.text, '') AS text, m.date, m.is_from_me, m.service,
c.style AS chat_style,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard group flag query against missing chat.style

The new SQL now unconditionally reads c.style (here and again in messagesAfter), but this repository intentionally runs against schema variants where chat.style is absent (for example, Tests/IMsgCoreTests/MessageStoreTestHelpers.swift defines chat without a style column), so these queries will fail at runtime with no such column: c.style instead of returning messages. Since other optional fields are already feature-gated, this needs the same schema check/fallback (e.g., select a literal and default isGroup to false when the column is unavailable).

Useful? React with 👍 / 👎.

- Add schema check for chat.style column existence
- Default isGroup to false when style column unavailable
- Add regression test for missing style column

Addresses review feedback about test schema compatibility.
chrisae9 added a commit to chrisae9/imsg that referenced this pull request Mar 5, 2026
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