Commit Graph
10 Commits
Author SHA1 Message Date
David Evans 8ac6696b3c Implement encoding logging mode for redaction (#678)
Resolves #662

Command/Response Encoder can be configured using loggingMode. If turned on then user-sensitive strings won't be encoding, but any metadata will.

For example, 1 LOGIN username password becomes 1 LOGIN "" "", thereby hiding the user's information.
2022-01-26 15:50:12 -08:00
David Evans 59a57ee70b New client state machine (#610)
The client state machine has now been fully rewritten, and encapsulates the miniature state machines implemented in previous PRs.

I've extracted the state machine from IMAPClientHandler and moved it into ClientStateMachine, hence all the code deletion.

The state machine receives a command, response, or continuation request from the IMAPClientHandler and returns an array of Chunk/EventLoopPromise pairs that the client handler should then write to the network.

Also we didn't previously queue Append commands like we did for others, however it's now become apparent that all commands types should be queued, so we do that now.

A lot of tests have been added to make sure everything works.

Note that a lot of sendCommand tests have been deleted as we now precondition on user errors instead of throwing.
2021-09-10 13:45:11 +01:00
David Evans 904e615a8d Make CommandEncodeBuffer hashable (#611)
We need CommandEncodeBuffer to be Equatable, but might as well make it Hashable. This required adding a few Hashable conformances downstream, and changing promoting existing Equatable conformance to Hashable.
2021-08-17 11:28:01 +01:00
David Evans a66eeb228b Use SPI to remove underscored members (#567)
Resolves #556

We've talked quite a bit offline, and decided that for now @_spi is the way to go, as it avoids build system issues. The goal is to remove the number of underscored public types and fields.
2021-06-02 19:21:47 +01:00
David Evans ff1b31f5f3 Remove superfluous underscores. (#548)
Way too many things were underscored that really didn't need to be.
2021-04-13 10:48:34 +01:00
David Evans 81c8e9158d Underscore EncodeBuffer (#479)
* Underscore

* Underscore everything

* Add soundness self insert
2021-03-18 11:25:05 +00:00
David Evans 135f473bf6 Documentation PR part 5 (#383)
* Document UseAttribute

* Document URLRumpMechanism

* Document URLFetchData

* Document UAuthMechanism

* Document StoreModifier

* Document SortData

* Document SequenceMatchData

* Document QResyncParameter

* Document SelectParameter

* Document SectionSpecifier

* Document SectionSpecifier.Part

* Document SectionSpecifier.Kind

* Document ResponseEncodingOptions

* Document ResponseEncodeBuffer

* Document EncodeBuffer

* Document EncodeBuffer.Chunk

* Document EncodeBuffer more.

* Document CommandEncodeBuffer

* Document ParserError

* Document ResponseParser

* Document CommandParser

* Document SynchronisingLiteralParser

* Remove public where it isn't needed

* Document write CommandStream

* Document write TaggedCommand

* Remove public from write functions

* Document FetchAttribute

* Document top-level Capability

* Documents Capability subtypes

* Document FullDateTime

* Document FullDate

* Document FullTime

* Document ContinuationRequest

* Document ListSelectOptions

* Document ResponseOrContinuationRequest

* Document Response

* Document FetchResponse

* Document StreamingKind

* Document ResponseText

* Document ResponseTextCode

* Document TaggedResponse

* Document TaggedResponseState

* Remove docs

* PR review

* Fix sanity

* Document FullDate
2020-12-10 12:37:05 +00: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
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 1a66129e86 Begin to make encoding capability aware (#188)
* Primitive capability support

* Sample move capability requirement

* More examples

* Write binary literals

* Sanity

* Rename to encoding options

* Fix sanity

* Fix

* Add IMAP base options

* Rename

* Update Capability.swift

* Fix

* Use EncodeBuffer

* Fix writing greeting

* Fix sanity

* Fix assert

* Use EncodeBuffers everywhere

* Use EncodingCapabilities

* Remove base capabilities

* Create CommandEncodeBuffer

* Dedicated buffer types

* Fix sanity

* Clear test buffer

* PR review changes

* Remove has more chunks

* Remove dead code

* Fix sanity

* Fix
2020-06-04 14:56:18 +01:00