Skip to content

Add IMAP UIDPLUS support (RFC 4315)#115

Draft
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:codex/imap-uidplus
Draft

Add IMAP UIDPLUS support (RFC 4315)#115
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:codex/imap-uidplus

Conversation

@mpscholten

Copy link
Copy Markdown
Contributor

What

Adds support for the IMAP UIDPLUS extension (RFC 4315), so callers can recover the UIDs the server assigns during APPEND/COPY and can expunge messages targeted by UID.

New API (Network.HaskellNet.IMAP)

  • appendFullUID — like appendFull, but returns the APPENDUID response code (the UID assigned to the appended message)
  • copyUID / copyUIDs / copyUIDRUID COPY variants returning the COPYUID response code (single UID, UID list, UID range)
  • uidExpunge / uidExpungeRUID EXPUNGE, removing only the \Deleted messages within a given UID set/range

New types (Network.HaskellNet.IMAP.Types)

  • AppendUID, CopyUID, and the UIDSet alias
  • StatusCode constructors APPENDUID_sc, COPYUID_sc, UIDNOTSTICKY, with parsers in IMAP.Parsers

Plumbing

  • sendCommandWithResponse exposes the tagged ServerResponse so the new response codes can be read; sendCommand is now defined in terms of it.
  • The existing appendFull / copyFull keep their old signatures (they discard the UID result), so this is backwards compatible.

Tests

  • New parser cases in baseTest for the APPENDUID / COPYUID / UIDNOTSTICKY response codes.
  • A dedicated imapUIDPlusTest group exercising the new API against scripted server responses (verifying both the bytes sent and the parsed UID result).

All new tests pass locally (cabal test, GHC 9.8.4).

Note: the suite has one pre-existing failure on master unrelated to this PR — append preserves raw crlf message bytes expects an unquoted APPEND INBOX while the code quotes the mailbox name (APPEND "INBOX"). I left it untouched to keep this PR focused.

🤖 Generated with Claude Code

Adds UIDPLUS extension support so callers can recover the UIDs the
server assigns on APPEND/COPY and target expunges by UID:

  - appendFullUID: like appendFull, returns the APPENDUID response code
  - copyUID / copyUIDs / copyUIDR: UID COPY returning the COPYUID code
  - uidExpunge / uidExpungeR: UID EXPUNGE over a UID set or range

New types AppendUID and CopyUID, the UIDSet alias, and the
APPENDUID/COPYUID/UIDNOTSTICKY status codes with their parsers.
sendCommandWithResponse exposes the tagged ServerResponse so the
response codes can be read. The existing appendFull/copyFull keep their
old signatures by discarding the UID result.

Covered by new parser cases in baseTest and a dedicated imapUIDPlusTest
group exercising the API against scripted server responses.
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