Commit Graph
113 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 d54da15714 Cleanup command encoding (#305)
* Simplify

* Fix sanity

* Remove duplicate logic

* Fix typo

* Write out

* Command encoder tests

* Fix sanity
2020-09-10 11:14:34 +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 b5b9d3c910 Support UTF7-IMAP (#282)
* Add encoding with tests

* Fix encoding

* Test decodes

* Finish decoding

* Comments

* Fix sanity

* Cory PR comments

* Optimise adding padding

* Optimise writing string

* Docs

* Fix sanity

* Rename UTF7 and reserve string capacity

* Vendor Base64

* Fix sanity

* More tests and fix a few things

* Decoding error checks

* Fix sanity

* Add a notice file

* Add validation function

* PR comments

* Add validation tests
2020-08-19 16:50:23 +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 f5dd896f7f Add support for LITERAL- (#276)
* Support LITERAL-

* Tests for LITERAL-

* Fix sanity
2020-07-15 12:35:12 +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 b34be24dfb Remove try encoding (#272) 2020-07-13 10:15:30 +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 EvansandCory Benfield 30fd9d7fa7 Add Body Disposition size and filename conveniences (#268)
* Add size and filename conveniences

* Fix sanity

* Update Sources/NIOIMAPCore/Grammar/Body/Field/Disposition.swift

Co-authored-by: Cory Benfield <lukasa@apple.com>

* Update Sources/NIOIMAPCore/Grammar/Body/Field/Disposition.swift

Co-authored-by: Cory Benfield <lukasa@apple.com>

Co-authored-by: Cory Benfield <lukasa@apple.com>
2020-07-10 11:20:03 +01:00
David Evans 9cb7a1df06 Replace a lot of Type with Kind (#267) 2020-07-10 11:13:45 +01:00
David Evans 0c304df4e2 Enable splitting a mailbox name (#252)
* Enable splitting a mailbox name

* Extra test cases

* Fix sanity

* Improve docs

* Update MailboxInfo.swift

* Update MailboxName.swift
2020-07-09 14:48:47 +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
Daniel Eggert a3e3867aa2 Make flags case-insensitive, but case-preserving. (#264) 2020-07-09 11:43:04 +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 e1d5de1c10 RawRepresentable (#262) 2020-07-09 09:20:09 +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 f58e239a59 Extra tests for non-standard capabilities (#251)
* Minor modifications

* Fix tests
2020-07-08 14:56:10 +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 a5c31cf51f Refactor capability literal+ API (#247)
* Refactor literal+

* Fix tests

* Add documentation

* Fix doc nit

* Fix sanity

* Fix tests
2020-07-06 19:11:11 +01:00
David Evans 46c52f84b2 Camel-case months when encoding (#248)
* Camel-case months

* Fix tests
2020-07-06 19:05:46 +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
David Evans 1add02eaa4 Don't uppercase keywords (#249) 2020-07-06 18:51:42 +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 ffed95aa72 Remove writeAString (#239) 2020-07-02 19:05:34 +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
Daniel Eggert 42ac3f717a Add parenthesis around search keys when ambiguous (#237)
Fixes #210
2020-07-01 09:14:00 +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
David Evans b307ac1404 Remove capability preconditions (#230)
* Remove preconditions

* Fix sanity
2020-06-25 17:58:02 +01:00
Daniel Eggert 1fe1cd4c10 Allow continuation request without space or text. (#222) 2020-06-25 17:34:40 +01:00
David Evans 2f185c1abd Make keywords case sensitive (#227)
* Make keywords case sensitive

* Fix sanity
2020-06-22 14:48:29 +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