32 Commits
Author SHA1 Message Date
AnthonyandDaniel Eggert d456d32908 Accept the responses a server may send during IDLE (#855)
Co-authored-by: Daniel Eggert <deggert@apple.com>
2026-10-13 17:08:26 +02:00
K Gopal Krishnaandkaygdotorg 26a69caf84 Allow configuring IMAP client line buffer size (#849)
Co-authored-by: kaygdotorg <106914721+kaygdotorg@users.noreply.github.com>
2026-09-09 08:51:12 +02:00
Daniel Eggert 880366a417 Add macOS CI job (#836) 2026-07-07 11:37:57 +02:00
Daniel Eggert e672225d76 Rename → IMAPClientHandler.Message (#793) 2025-05-07 22:39:05 +02:00
Daniel Eggert b838dc2206 Pass response parser options into IMAPClientHandler.init (#789) 2025-05-06 15:30:31 +02:00
Daniel Eggert 1b27cae1b4 Fix client handler encoding options (#786) 2025-04-11 17:33:25 +02:00
Franz Busch 2cd1c5582a [CI] Adopt GitHub Actions (#775)
* [CI] Adopt GitHub Actions

# Motivation

We want to adopt GitHub actions in all of our Swift repositories to replace our current Jenkins CI.

# Modification

This PR adopts the reusable workflows from NIO and the swiftlang organization to ensure soundness and test coverage. Additionally, this PR enables a sematic label check and adds a `release.yml` to make releasing this package easy.

# Result

Modern CI and release flow.
2024-10-30 13:24:35 +00:00
David Evans 69f15a10ba Convert line length limit to 8192 (#666)
Resolves #663

Convert the default limits from 1000 to 8192 octets, as per RFC 7162.
2021-12-23 13:36:54 +00: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 e02089be0e Make case naming uniform between commands and responses (#589)
Noticed by Matt, we had, for example, Command.tagged, but Response.taggedResponse. In general I've removed the superfluous Response at the end of each case.
2021-07-12 15:45:21 +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 8565ac900e Rename Command types to better represent what they are (#557)
Resolves #522

Some command names were misleading, they should be better now. Also removed a redundant initialiser.

PartialCommandStream -> SynchronizedCommand

CommandStream -> CommandStreamPart
2021-05-21 16:39:22 +01:00
David Evans 2f538c6bd0 Enable command pipelining (#552)
Resolves #528

Previously the user wasn't able to write a command while another was waiting for continuations. This isn't very friendly, and isn't great In any real-world scenario. Now we queue commands, and as soon as all continuations for one command have been handled, we move on to the next.
2021-04-29 17:09:34 +01:00
David Evans 10bdc22671 Replace KeyValues with OrderedDictionary from swift-collections (#546)
* Add swift-collections

* Delete KeyValues

* Soundness

* Fix comment
2021-04-14 10:05:06 +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 51f3058447 Rename authentication method and InitialClientResponse (#545)
* Rename method to mechanism

* Rename InitialClientResponse to ClientResponse

* Rename AuthKind to AuthMechanism
2021-04-12 15:22:10 +01:00
David Evans 0654d550e5 Fix continuation request state tracking to disambiguate idle and authentication (#526)
* Fix state tracking

* Soundness

* Fix tests

* Fix auth encoding

* Make state private

* Add reentrancy test

* Add asserts

* Better error types

* Soundness

* Use "real" example base64

* Soundness

* PR review

* Soundness

* Fix rebase
2021-04-07 13:41:52 +01:00
David EvansandJohannes Weiss 428b7b3488 Enable modifying IMAPClientHandler capabilities (#490)
* Add capabilities setting

* Tests

* Update Sources/NIOIMAP/Coders/IMAPClientHandler.swift

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>

* Fix non-sync literal test

* Use assert methods

* Fix test

* Sanity

* Enable changing capabilities

* Refactor to inout

* Switch to using IDs

* Default closure

* Soundness

* Fix rebase

* Re-add test

* Cleanup

* Soundness

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
2021-04-06 15:04:14 +01:00
David Evans 89f9bbf419 Forward continuation requests as user events (#513)
* Forward user events

* Soundness

* Add test for idle

* IDLE test

* Convert to promises
2021-03-26 17:05:16 +00:00
David Evans a33ea576e3 New API for IDLE (#508)
* Rename to ServerResponse

* Docs

* Rename to IDLE started

* Fix compile

* Fix refactor

* Remove server response

* Soundness

* Remove underscore

* Remove associated data

* Soundness

* Write a continuation

* Soundness
2021-03-26 12:31:46 +00:00
8b9c01a6ba Servers now can send authentication challenges (#505)
* Servers now can send authentication challenges

* Soundness

* Fix tests

* Change to use Response

* Docs

* Soundness

* work around SR-14394

* Update Sources/NIOIMAPCore/Grammar/Response/Response.swift

Co-authored-by: Daniel Eggert <daniel.eggert@hoerbuch.dk>

* Fix compile on 5.2

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
Co-authored-by: Daniel Eggert <daniel.eggert@hoerbuch.dk>
2021-03-23 16:33:36 +00:00
David Evans 81c8e9158d Underscore EncodeBuffer (#479)
* Underscore

* Underscore everything

* Add soundness self insert
2021-03-18 11:25:05 +00:00
David EvansandDaniel Eggert 7d6997edcf Enable custom continuation handling (#372)
* Client handler outputs responseorcontinuations

* Finish implementation

* Remove BB array from authenticate

* Fix sanity

* Refactor

* Fix sanity

* Apply suggestions from code review

Co-authored-by: Daniel Eggert <daniel.eggert@hoerbuch.dk>

* Rename to continuation response

* Fix compile

* Fix tests

* Fix sanity

* PR comments

* Fix sanity

Co-authored-by: Daniel Eggert <daniel.eggert@hoerbuch.dk>
2021-01-05 17:21:38 +00:00
David Evans b1a1d7350c Documentation PR part 6 (#387)
* 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

* Document UntaggedStatus

* Document ScopeOption

* Document ReturnOption

* Document IServer

* Document InitialClientResponse

* Document AttributeFlag

* Document UIDValidity

* Document UIDSet

* Document UID

* Document EncodedAuthenticationType

* Document EncodedMailbox

* Document EncodedSearch

* Document EncodedSection

* Document EncodedURLAuth

* Document EncodedUser

* Document ResponseCodeAppend

* Document ResponsePayload

* Document SequenceNumber

* Document OptionValueComp

* Document QuotaLimit

* Document QuotaResource

* Document OptionVendorTag

* Document IPartial and remove IPartialOnly

* Document QuotaRoot

* Document ESearchResponse

* Document SearchCorrelator

* Document Address

* Document UIDRange

* Document IUID

* Document SearchModificationSequence

* Document SearchModificationSequenceExtension

* Document SearchReturnData

* Document SearchReturnDataExtension

* Document SearchReturnOption

* Document SearchReturnOptionExtension

* Document SequenceRange

* Document SequenceRangeSet

* Fix compile

* Document SequenceSet

* Document ParameterValue

* Define TaggedExtension

* Document AuthIMAPURL

* Document AuthIMAPURLFull

* Document AuthIMAPURLRump

* Document ChangedSinceModifier

* Document UnchangedSinceModifier

* Document CreateParameter

* Document EntryValue

* Document Expire

* Document FetchModifier

* Document FetchModificationResponse

* Document IAbsolutePath

* Document IAuth

* Document ICommand

* Document IMailboxReference

* Document MetadataValue

* Document IMAPURL

* Document MetadataOption

* Document MetadataResponse

* Document RelativeIMAPURL

* Document INetworkPath

* Document MechanismBase64

* Document IMessageList

* Document IMessageOrPartial

* Document IMessagePart

* Document IPathQuery

* Document ISection

* Document IRelativePath

* Document IUAVerifier

* Document IURLAuthRump

* Document IURLAuthRump

* Document IUserInfo

* Fix missing documentation

* Document CommandEncoder

* Fix sanity

* Update CommandDecoder.swift

* PR reviews
2020-12-11 17:14:37 +00:00
Daniel Eggert 00a552bf75 Rename → Continuation Request (#364) 2020-11-16 15:41:05 +00:00
Daniel Eggert 15f642777a Remove expectGreeting. Don’t handle Greeting requirement in parser. (#362)
* Remove “expectGreeting”.

* Simplify nested types.
2020-11-12 23:47:58 +00:00
David Evans b34be24dfb Remove try encoding (#272) 2020-07-13 10:15:30 +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
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
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 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
Johannes Weiss 626de3daf0 command encoder (#102) 2020-05-18 15:49:40 +01:00