feat(gateway): add Gmail detection, category discovery, and smart label deduplication #7

Merged
jalmari merged 2 commits from develop into main 2026-08-28 17:11:50 +03:00
Owner

This change adds Gmail and Google Workspace support to MailboxGateway and ClassificationEngine:

1. **Protocol Detection**: Detects Gmail servers with the IMAP `X-GM-EXT-1` capability. The gateway does not rely on email domain

names.
2. Category Mailbox Discovery: Finds and scans tabbed category mailboxes ([Gmail]/Categories/*, [Gmail]/Luokat/*, and 13
language variants). Excludes system mailboxes ([Gmail]/Trash, [Gmail]/Spam).
3. Smart Label Extraction and Deduplication: Reads X-GM-LABELS and X-GM-MSGID during header scans. Combines labels and
deduplicates identical messages across folder views.
4. Offline Test Support: Updates FakeImapTransport.for_gmail() to simulate X-GM-EXT-1, category folder trees, and Gmail
labels without network calls.

Missing 1 of the commits in this PR (merged previously already).

This change adds Gmail and Google Workspace support to `MailboxGateway` and `ClassificationEngine`: 1. **Protocol Detection**: Detects Gmail servers with the IMAP `X-GM-EXT-1` capability. The gateway does not rely on email domain names. 2. **Category Mailbox Discovery**: Finds and scans tabbed category mailboxes (`[Gmail]/Categories/*`, `[Gmail]/Luokat/*`, and 13 language variants). Excludes system mailboxes (`[Gmail]/Trash`, `[Gmail]/Spam`). 3. **Smart Label Extraction and Deduplication**: Reads `X-GM-LABELS` and `X-GM-MSGID` during header scans. Combines labels and deduplicates identical messages across folder views. 4. **Offline Test Support**: Updates `FakeImapTransport.for_gmail()` to simulate `X-GM-EXT-1`, category folder trees, and Gmail labels without network calls. Missing 1 of the commits in this PR (merged previously already).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Lavisys/mailsweep!7
No description provided.