Skip to content

Fix IMAP keyword flag handling#110

Open
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:upstream/imap-keyword-flags
Open

Fix IMAP keyword flag handling#110
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:upstream/imap-keyword-flags

Conversation

@mpscholten

Copy link
Copy Markdown
Contributor

Summary

Fix keyword flag handling according to RFC 3501 section 2.3.2:

  • show (Keyword "Custom") now renders Custom instead of \Custom
  • bare keyword flags still parse as keywords
  • unknown backslash-prefixed system flags are preserved distinctly instead of being collapsed into bare keywords

Fixes #1.
Fixes #2.

Checks

  • nix shell nixpkgs#cabal-install nixpkgs#ghc --command cabal test imap-parsers --test-show-details=direct
  • nix shell nixpkgs#cabal-install nixpkgs#ghc --command cabal build all
  • nix shell nixpkgs#cabal-install nixpkgs#ghc --command cabal check (existing CHANGELOG placement warning only)
  • git diff --check

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

Copy link
Copy Markdown

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: 991d63d444

ℹ️ 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".

Comment thread src/Network/HaskellNet/IMAP/Types.hs Outdated
showFlag Draft = "\\Draft"
showFlag Recent = "\\Recent"
showFlag (Keyword s) = "\\" ++ s
showFlag (Keyword s) = s

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the \ wildcard when showing flags*

When a server advertises PERMANENTFLAGS (\\*), this parser still represents the wildcard as Keyword "*" and uses that sentinel to set _isFlagWritable, but the new catch-all Show case now renders that same value as bare * instead of \\*. Bare * is not a valid keyword here (atomChar excludes *), so any caller that logs, compares round-trips, or serializes this exposed Flag value now gets an invalid IMAP flag string; special-case Keyword "*" before the bare-keyword case.

Useful? React with 👍 / 👎.

@mpscholten mpscholten force-pushed the upstream/imap-keyword-flags branch from 991d63d to 0bc2b70 Compare June 5, 2026 14:57
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.

Keyword Flag parsing is incorrect Show instance for Flags is incorrect

1 participant