Commit Graph
83 Commits
Author SHA1 Message Date
Cory Benfield 0198813b9c Add support for Gmail extensions (#312)
Motivation:

Gmail has a couple of common extensions to the IMAP specification for
Gmail specific features. It'd be good to support them. This patch adds
support for the most important three: Gmail message ID, Gmail thread ID,
and the Gmail label functionality.

Modifications:

- Added new Fetch and Message attributes for the three Gmail extensions.
- Added parsing and serialization support.

Result:

Users can interact with Gmail-specific features.
2020-09-16 17:30:12 +01:00
David Evans c484ab26ce Remove ParameterValue.number (#313) 2020-09-16 15:49:25 +01:00
David Evans ffdda2a02b Implement RFC 7162 CONDSTORE (#308)
* Add closed

* Entry types

* Support vanished

* Add attribute flag support

* Add sequence match data support

* Add select parameter

* Add SearchSortModifierSequence

* Add SelectParameter.condstore

* Add SortData

* Fix sanity

* Implement SearchSort

* Implement EntryFlagName

* Implement FetchModifierResponse

* Implement ResponseTextCode

* Implement ChangedSince and FetchModifier

* Implement SearchModifierSequence

* Implement SearchKey

* Implement StoreModifier

* Fix sanity

* Fix select spacing

* Fix sanity
2020-09-15 17:29:52 +01:00
Peter Adams f1939cc2cc RFC 5182 (Reference Last Search Result) (#311)
Motivation:

User requested IMAP extension

Modifications:

Add seq-last-command("$") to sequence-set
Add "NOTSAVED" to resp-text-code

Result:

RFC 5182 is supported
2020-09-15 15:31:21 +01:00
Cory Benfield f3d154b06c Implement RFC 4469 CATENATE (#310)
Motivation:

CATENATE functionality is convenient for low-power client usage, as it
allows clients to stitch together new messages out of the parts of older
ones without needing to reupload (or indeed redownload) that content.

Modifications:

- Extend CommandStream to support CATENATE.
- Extend serializer and parser to work with new definitions.

Result:

CATENATE is parseable.
2020-09-15 11:08:14 +01:00
Peter Adams a8b3ffda51 Implement RFC 2087 (Quota) (#306)
* Implement RFC 2087 (Quota)

Motivation:

This is a user requested extension.

Modifications:

Add parsers and writers for the 3 commands GETQUOTA, SETQUOTA and GETQUOTAROOT.
Add parsers and writers for their responses.

Result:

RFC 2087 is supported

* Code review feedback

* Recommended formatting changes.

* Update to match move of writeString etc.

* More formatting updates.
2020-09-14 10:30:29 +01:00
David Evans 5f0aa8ed8b Clean up implementation (#304) 2020-09-08 11:40:15 +01:00
David Evans fd3e16ad49 Implement RFC 6154 SPECIAL-USE (#303)
* Implement

* Tests for new types

* Tests

* Fix

* Fix tests

* Fix sanity

* Fix warnings

* Silence warnings
2020-09-08 11:25:48 +01:00
David Evans 2fef4ba772 Implement RFC 4315 UIDPLUS (#302)
* Implement

* Test

* Fix tests
2020-09-03 10:51:04 +01:00
David Evans 30df30a562 Actually encode/decode base64 (#284)
* Actuslly encode/decode base64 data

* Update auth

* Rename function

* Authenticate uses base64

* Fix sanity
2020-08-20 12:44:43 +01:00
David Evans 794f81bb66 Remove initial response (#283) 2020-08-18 11:45:23 +01:00
David Evans 495d5f8c4b Refactor tests part 2 (#279)
* Update testParse2Digit

* Update testParseToken

* Update testParseUnsubscribe

* Update testParseUID

* Update testParseUIDSet

* Update testParseUserId

* Update testUIDRange

* Update testParseUid

* Update testParseText

* Fix sanity

* Remove un-needed function

* Update parseTaggedResponse

* Update parseTag

* Update parseSequenceSet

* Update parseRename

* Update parseSubscribe

* Update parseStoreAttribueFlags

* Update parseStore

* Update parseStatus

* Update testParseSequenceSet

* Update parse NZNumber

* Update parseNumber

* Update parseNString

* Test utilities for void returning parsers

* Update testParseNil

* Update testParseNewline

* Update testParseNamespace

* Update testParseAddress

* Better error messages

* Update testParseSequenceRange

* Fix testParseStatus

* Update testParseSequenceNumber

* Update testParseSelect

* Update testParseSectionSpecifierKind

* Update testParseSectionSpecifier

* Update testParseSectionPart

* Update testParseSectionBinary

* Update testParseSection

* Update testParseSearchReturnOptionExtension

* Batch replace function calls

* Use new method almost everywhere

* Remove extra spacing

* Fix sanity

* Remove redundant function

* Remove redundant code

* Refactor parsing search keys
2020-07-31 01:54:17 -07:00
David Evans f465495467 Setup new parser testing function for convenience (Part 1) (#278)
* Setup new testing method

* Fix sanity
2020-07-17 12:16:25 +01:00
David Evans 005ee648ff Flatten parameter types (#277)
* Begin refactor

* Remove redundant function calls

* Remove CreateParameter

* Remove SelectParameter

* Remove RenameParameter

* Remove StoreModifier

* Remove FetchModifier

* Cleanup

* Flatten simple

* Fix sanity

* Switch to guard
2020-07-15 17:19:17 +01:00
David Evans b0aa428e15 Convert Mailbox attribute array into a struct (#273)
* Refactor into struct

* Fix sanity

* Add documentation

* Documentation

* More docs

* Don't use writeable key paths

* Fix sanity
2020-07-13 18:14:31 +01:00
David Evans ba7544ecf9 Replace ByteBuffer with string where possible (#269)
* Replace ByteBuffer with string where possible

* Fix sanity

* Use flat map
2020-07-10 13:28:11 +01:00
David Evans 9cb7a1df06 Replace a lot of Type with Kind (#267) 2020-07-10 11:13:45 +01:00
David Evans 93a801b650 Cleanup parse nstring (#266)
* Cleanup

* Fix sanity
2020-07-09 14:00:05 +01:00
David Evans 1082a1aa7c Fix parsing BODYSTRUCTURE (#265)
* Fix parsing and add test cases

* Fix sanity
2020-07-09 13:37:21 +01:00
David Evans e5f5c52e32 Fix MessageAttribute documentation (#261)
* Fix documentation

* Rename structure to hasExtensionData

* Fix sanity
2020-07-09 10:36:53 +01:00
David Evans 05bf679fd0 Remove String typealias (#259)
* Convert NString into a struct

* Fix sanity

* Just use ByteBuffer?
2020-07-09 09:36:33 +01:00
Daniel Eggert c401b8e251 Cleanup various names related to BodyStructure (#257)
* BodyStructure: Naming cleanup

* octetCount

* lineCount

* Disposition.kind
2020-07-09 08:50:30 +01:00
David Evans 2599f0d94d Re-add BodyStructureTests (#250)
* Re-add tests

* Uncomment tests

* Fix sanity

* Refactor Body Field Language

* Add humungous example

* Fix sanity

* Remove unused extension (PR review nit)
2020-07-06 22:44:28 +01:00
David Evans fd9905098c Refactor Search and UID Search (#242)
* Refactor Search and UID Search

* Uncomment tests

* Fix sanity
2020-07-06 18:57:38 +01:00
David Evans 6716144eb4 Be more lenient when parsing spaces (#238)
* Update space parser

* Remove typo

* Extra tests

* Fix parsing spaces

* Re-add missing tests

* Fix sanity
2020-07-06 18:55:55 +01:00
Daniel Eggert 3c20af6f53 Use encoding options specific to the transport direction. (#240)
* Use encoding options specific to the transport direction.

* Add description to precondition failure.

* Make properties on EncodingOptions public.

* Rename files.

* Change APPEND to use CommandEncodingOptions.
2020-07-06 18:37:16 +01:00
David Evans 9757506063 Make synchronising use configurable (#226)
* Make synchronising use configurable

* Fix sanity

* Rename

* Rename

* Fix text encoding

* Switch to an option set

* Embed options in struct

* Fix UInt8 test

* Fix UTF-7 encoding and tests

* Fix sanity

* Refactor

* Fix sanity
2020-07-01 16:45:13 +01:00
David Evans 4d8f545414 Always use parseNewline (#234) 2020-06-30 12:56:46 +01:00
Daniel Eggert 7bb7916a1a Allow space before newline (for CAPABILITY). (#233)
See also: #232
2020-06-30 11:23:11 +01:00
Johannes WeissandDavid Evans 525d58d1fa non-happy path tests: over/underflows (#220)
* Support encoding append commands

* Yay it works

* Cleanup 1

* Cleanup 2

* Fix sanity

* Fix command decoder test

* Fix parsing partial commands sync literals

* Fix parser stress tests

* Fix tests

* Remove unused code

* Code refactor and cleanup

* Fix sanity

Co-authored-by: David Evans <d.evans@apple.com>
2020-06-26 14:47:40 +01:00
Daniel Eggert 4e19396c19 Range for FETCH need to be encoded as <offset.count> (#214)
* Range for FETCH need to be encoded as <offset.count>

From RFC 3501:
> This is done by appending an open angle bracket ("<"), the octet position of the first desired octet, a period, the maximum number of octets desired, and a close angle bracket (">") to the part specifier.

* Check for overflow.

* Add more test cases. Limit to UInt32.max
2020-06-26 10:47:30 +01:00
Daniel Eggert 1fe1cd4c10 Allow continuation request without space or text. (#222) 2020-06-25 17:34:40 +01:00
David Evans c34e3889cb Refactor search key (#223)
* More search key tests

* Remove sent search type

* Rename smaller and larger

* Rename search key sequence set case

* Documentation

* Add documentation

* And

* Fix tests

* Documentation
2020-06-22 13:48:02 +01:00
David Evans 49b44c521f Only send return when supported and options exist (#208)
* Only send return when supported and options exist

* Fix sanity

* Throw an error when encoding

* Fix tests

* Fix sanity

* Fire error through pipeline

* Update ByteBuffer+WriteLiteral.swift
2020-06-22 12:17:11 +01:00
David Evans e44a55ca8d Flatten RFC822 into FetchAttribute (#219)
* Flatten RFC822

* Fix sanity

* Fix tests
2020-06-18 13:38:53 +01:00
Daniel Eggert 03c8a323dc Replace Date.Month with Int (#203)
* Change Date.Month -> Int

* Change property order to year, month, day.

* Fix style.

* Fix lowercase / uppercase month name.

* Use preconditionFailure()
2020-06-17 12:48:44 +01:00
Daniel EggertandDavid Evans 418f718635 SectionSpecifier convenience. (#197)
Co-authored-by: David Evans <d.evans@apple.com>
2020-06-17 11:46:24 +01:00
Daniel Eggert 774135b482 Simplify Date.DateTime -> use InternalDate (#191)
* Simplify Date.DateTime -> use InternalDate

Fixes #74

* Changes according to feedback from @Davidde94

* Fix code style.

* More cleanup.
2020-06-15 18:27:34 +01:00
David Evans 645e9742a1 Refactor section specifier (#190)
* Rename

* Create new section part type

* Refactor into a struct

* Fix sanity
2020-06-02 18:41:30 +01:00
David Evans 1705b21ccd Move greeting under untagged response (#183) 2020-05-28 14:06:12 +01:00
David Evans a06b3898aa Hide incomplete message errors (#135)
* Hide incomplete message errors

* Fix sanity

* Throw error

* Fix rebase

* Refactor

* Log not throw

* Improve roundtrip handler

* Fix sanity

* Update comments

* Remove error case

* Logging

* PR review

* Simplify loop

* Use NIOSinglestep...

* Fix sanity

* Even more efficiency

* Fix sanity
2020-05-28 13:49:11 +01:00
David Evans 45f6ad2649 Convert partial to be a range (#182)
* Convert partial to be a range

* Sanity
2020-05-27 18:09:24 +01:00
David Evans e98dfa1182 Refactor mailbox flags (#181)
* Refactor mailbox flags

* Fix sanity
2020-05-27 18:09:16 +01:00
David Evans 7da7dc5b54 Remove FetchType (#180)
* Fix tests

* Fix sanity
2020-05-27 13:35:00 +01:00
Daniel Eggert 30cdf896ff Create type for UID / UIDSet and use UIDs vs. Sequence Numbers (#166)
* Create type for UID / UIDSet and use UIDs vs. Sequence Numbers as appropriate.

* Remove commented out code.

* Linting.
2020-05-26 11:08:08 +01:00
Daniel Eggert 1ac7aa5677 Renaming: StoreAttributeFlagsType → StoreFlags 2020-05-22 16:53:35 +01:00
Daniel Eggert 09c7da7d3c Rename / restructure FetchAttribute cases. (#174) 2020-05-22 15:49:43 +01:00
Daniel Eggert 5ff061243a Add some parameter names and add default versions. (#155)
* Add some parameter names and add default versions for RFC 3501 versions of commands.

* Use default arguments.

* Add test cases for Commands with default argument values.

* Align with changes on master.
2020-05-22 15:29:52 +01:00
David Evans 7d3ad286eb Refactor and de-nest MailboxName.List into MailboxInfo (#165)
* Rename to MailboxInfo

* Denest

* Refactor into less files

* Cleanup

* Denest ListExtendedItem

* Finish up
2020-05-21 19:26:24 +01:00
David Evans 80240a7924 Remove body basic type (#158) 2020-05-21 13:28:38 +01:00