Commit Graph
73 Commits
Author SHA1 Message Date
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
David Evans 06f29417ae Flatten SectionMessageText (#157)
* Flatten SectionText

* Tests

* Fix tests

* SectionText tests
2020-05-20 18:21:07 +01:00
David EvansandJohannes Weiss 042d11fe17 Add B2MD tests for most commands/responses (#125)
* Move tests to dedicated file

* Add NOOP tests

* Add capability tests

* Add logout tests

* Add starttls tests

* Add select tests

* Add examine tests

* Fix sanity

* Add create tests

* Add delete tests

* Fix sanity

* Add subscribe tests

* Add unsubscribe tests

* Add missing test file header

* Add check tests

* Fix sanity

* Rebase

* Add list tests

* Add LSUB tests

* Add status tests

* Add append tests

* Setup response tests

* Allow response parse mode override

* Temp remove append

* Conditional state tests

* Bye tests

* Capability tests

* Flags tests

* Exists tests

* Recent tests

* Expunge tests

* Tagged response tests

* List, LSUB, and status tests

* Comment everything

* Make tests use synchronizing literals

* Replace CRLF

* Test fetch responses

* Fix sanity

* Assert

* Refactor error catching

* Test that breaks synchronising literals

* fix some stuff

* Fix sanity

* Fix all the things

* Fix sanity

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
2020-05-20 17:40:56 +01:00
Daniel Eggert 17c740a21b Change TaggedCommand property name and property order. (#154) 2020-05-20 10:50:18 +01:00
David Evans 8353d64e2b Refactor BodyStructure.Multipart (#152)
* Define media subtype

* Tests

* Tests

* Restructure

* Sanity

* Rename types

* Remove ByteBuffer where appropriate
2020-05-19 13:23:54 +01:00
David Evans dde663aee4 Fix response streaming (#146)
* Fix response streaming

* Fix compile

* Test for streaming encoding fetch responses

* Fix sanity

* Fix tests

* Fix spacing

* Fix sanity

* Streaming attributes associated type

* Fix sanity
2020-05-18 18:45:11 +01:00
David Evans 59aa2ed8ad Refactor Singlepart to move fields up a level (#134)
* Move fields up

* Extract out body fields

* Fix tests

* Fix sanity

* Re-add BASIC tests

* Re-add tests

* Re-add tests

* Fix sanity

* Fix
2020-05-18 15:57:10 +01:00
Johannes Weiss 626de3daf0 command encoder (#102) 2020-05-18 15:49:40 +01:00
David Evans 5675a9e67f Fix recent (#148) 2020-05-16 18:35:58 +01:00
David Evans b41155753f Always ignore authenticate base64 data (#143)
* Always ignore authenticate base64 data

* Remove test base64

* Update IMAPParserTests.swift
2020-05-14 19:44:10 +01:00
David Evans f317ce5032 Call namespace parser in mailbox data parser (#144)
* Call namespace parser in mailbox data parser

* Sanity
2020-05-14 17:55:23 +01:00