X-GM-EXT-1 Gmail Label Extension for Proton Bridge#521
Open
bolausson wants to merge 3 commits intoProtonMail:masterfrom
Open
X-GM-EXT-1 Gmail Label Extension for Proton Bridge#521bolausson wants to merge 3 commits intoProtonMail:masterfrom
bolausson wants to merge 3 commits intoProtonMail:masterfrom
Conversation
Implement the Bridge side of the X-GM-EXT-1 IMAP extension. When an
IMAP client sends STORE +X-GM-LABELS ("LabelName"), the Bridge resolves
the label name to a Proton label ID and calls LabelMessages/UnlabelMessages
without modifying folder membership (messages stay in INBOX).
Changes:
- Add GetLabelByName lookup to shared labels interface
- Implement MarkMessagesWithGmailLabels on Bridge connector
- Auto-create Proton labels when applying non-existent label names
- Point go.mod to local gluon with X-GM-EXT-1 support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add GetGmailLabels to the Bridge connector, enabling IMAP clients to read which Proton labels (LabelTypeLabel) a message has via FETCH X-GM-LABELS. Retrieves label IDs from the Proton API and maps them to human-readable names through the shared labels cache. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Returns the IMAP mailbox ID for a Gmail label name by looking up the in-memory label cache. Used by Gluon's optimized SEARCH X-GM-LABELS to avoid per-message API calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Just to be clear - This was entirly coded with a LLM!
X-GM-EXT-1 Gmail Label Extension for Proton Bridge
Paperless-NGX uses Gmail's
X-GM-LABELSIMAP extension to apply and query labels on emails after processing. Proton Bridge didn't support this, so we implemented it across Gluon and Bridge.Proton Bridge
MarkMessagesWithGmailLabelsmaps label names to Proton label IDs (auto-creating if needed), then callsLabelMessages/UnlabelMessagesAPI. Messages stay in INBOX — labels are applied without moving.GetGmailLabelscallsGetMessageAPI to getLabelIDs, maps them back to names via the shared label cache, filtering forLabelTypeLabelonly. Used by both FETCH and SEARCH operations.Gluon (IMAP server library)
STORE +X-GM-LABELS ("Paperless")/-X-GM-LABELScommands, routes them through a newSetGmailLabelsconnector interface to the Bridge backend. AddedX-GM-EXT-1capability advertisement.FETCH (X-GM-LABELS)as a fetch attribute, callsGetGmailLabelson the connector, returns labels in Gmail format:X-GM-LABELS ("Paperless" "Notifications").X-GM-LABELSas a search key so clients can filter messages by label (e.g.NOT X-GM-LABELS "Paperless"). The search operation callsGetGmailLabelson the connector for each candidate message with case-insensitive matching.X-GM-EXT-1to the pre-auth capability list. Python'simaplibchecks capabilities beforeLOGINand never re-reads them, so clients like Paperless-NGX weren't detecting support.Tests
Paperless-ngx logs:
paperless.log
mail.log
celery.log