Commit Graph
62 Commits
Author SHA1 Message Date
Daniel Eggert 8b8d972682 Remove dead URL and date writers
`writeAuthIMAPURLRump`, `writeAuthIMAPURLFull`, `writeRelativeIMAPURL`,
`writeURLFetchType`, `writeInternetMessageDate` and
`writeListSelectBaseOptionQuoted` had no callers outside their own
encode tests, nor did the writers only they reached
(`writeAuthenticatedURL(NetworkMessagePath)`, `writeNetworkPath`,
`writeAbsoluteMessagePath`, `writeIUIDOnly`,
`writeURLMessageSectionOnly`, `writeMessagePathByteRangeOnly`). Delete
them and those tests; parse tests stay.
2026-11-03 14:59:38 +01:00
Daniel Eggert c4d4d23e29 Drop pre-Swift 6.2 (#845) 2026-08-29 09:23:34 +02:00
Daniel Eggert 34883bcba6 Update style in documentation (#822) 2026-04-28 18:06:43 +02:00
Daniel Eggert 871d0122c9 Better docc comments (#815) 2026-04-16 09:20:29 -07:00
Daniel Eggert 7125d3d7b1 UIDBATCHES Extension (#777) 2025-05-22 12:47:29 -04:00
Daniel Eggert 655492302a Add MessageIdentifierSet.suffix overload (#791) 2025-05-02 08:18:36 +00:00
Matt Diephouse 5b2a96a5ab Declare MessageIdentificationShiftWrapper to be Sendable (#778) 2025-01-06 16:23:51 -05: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
Matt Diephouse 7d0f2cf799 Mark final set of types as Sendable (#771) 2024-09-18 15:06:30 +02:00
Matt Diephouse bffac522bd Make types Sendable (#767) 2024-09-02 13:56:13 +02:00
Daniel Eggert 0040533b67 Add support for MESSAGELIMIT Extension (#760) 2024-06-20 09:04:10 -07:00
Daniel Eggert 3d871e0f6b Make generic functions that are public inlinable (#741) 2023-05-25 10:32:21 -04:00
Daniel Eggert 35e9edb1f7 Add MessageIdentifierRange convenience (#734) 2023-02-27 14:30:42 +00:00
Daniel Eggert 18dd5d5193 Call through to RangeSet for SetAlgebra where possible (#732) 2023-02-22 12:17:48 +01:00
Daniel Eggert ad85d4a0cc Cleanup CustomDebugStringConvertible conformance (#713)
With this PR the implementation of `CustomDebugStringConvertible` generally uses new `makeDescription` convenience methods on the three encode buffers, e.g.:
```swift
extension ResponseEncodeBuffer {
    static func makeDescription(_ closure: (inout ResponseEncodeBuffer) -> Void) -> String
}
```
such that conformance can be implemented as e.g.
```swift
extension Command: CustomDebugStringConvertible {
    public var debugDescription: String {
        CommandEncodeBuffer.makeDescription {
            $0.writeCommand(self)
        }
    }
}
```

This also adds `CustomDebugStringConvertible` to `MessageAttribute` and `StreamingKind`.
2022-09-10 12:35:32 +02:00
Daniel Eggert cc1a03dd73 Use SE0270_RangeSet instead of StandardLibraryPreview (#707) 2022-09-05 09:25:45 +01:00
Daniel Eggert 040df6a6c6 Make conversion between MessageIdentifierSet variants public (#697)
This also renames some files and move some code around — to make the UID / SequenceNumber / UnknownMessageIdentifier split clearer.
2022-04-19 18:10:09 +02:00
Daniel Eggert bb0e803d99 UID convenience (#682) 2022-02-04 15:21:13 +01:00
Daniel Eggert 4954dc6bef Make UnknownMessageIdentifier conversion public (#680)
Need to be able to access these.
2022-02-01 10:27:42 +00:00
Daniel Eggert 2caea0cf64 Make MessageIdentifierSet.RangeView conform to RandomAccessCollection (#673) 2022-01-18 16:52:28 +01:00
David Evans d487e39d8a Add conversions from UnknownMessageIdentifier wrappers to UID/SequenceNumber types (#653)
Resolves #652

MessageIdentifierSet<UnknownMessageIdentifier> <-> MessageIdentifierSet<UID>
MessageIdentifierSet<UnknownMessageIdentifier> <-> MessageIdentifierSet<SequenceNumber>
MessageIdentifierRange<UnknownMessageIdentifier> <-> MessageIdentifierRange<UID>
MessageIdentifierRange<UnknownMessageIdentifier> <-> MessageIdentifierRange<SequenceNumber>
2021-12-13 15:56:40 +00:00
Daniel Eggert 2b3149e4a7 Disallow directo conversion between SequenceNumber and UID (#651)
With this, you’d have to explicitly go through UnknownMessageIdentifier.
2021-12-13 10:33:48 +00:00
Daniel Eggert 17b0f8e467 Add isContiguous to MessageIdentifierSet (#650)
With the recent changes to message identifier set it’s no longer possible to access the range count, but we’d only ever need that to calculate isContiguous. Moving this into NIOIMAPCore seems like the better approach.
2021-12-13 10:33:35 +00:00
David Evans fe03b16eb1 Fix Hashable implementations across all types (#648)
Resolves #634

The majority of types that were Equatable are now Hashable.

Anywhere that we had a custom == and the type was also Hashable we also now have custom hash functions.
2021-12-10 13:58:41 +00:00
David Evans aa1ea1b7b3 Implement MessageIdentificationNumber for SearchReturnData (#635)
Resolves #605

SearchReturnData may contain either a UIDSet or SequenceNumber. The two have different meanings, however because they appear identical it is not possible to distinguish while parsing. To get around this we now have a MessageIdentificationNumber type from which either UIDs or SequenceNumbers can be extracted.
2021-12-06 17:47:34 +00:00
David Evans 1639174b33 Update all docs to correctly represent types (#641)
Due to all the changes to create generic types a lot of the types specified in various bits of documentation were actually wrong. They've been fixed.

Also delete a redundant duplicate function writeUID
2021-12-01 14:02:38 +00:00
David Evans d8a2deb0e3 Use typealiases (#642)
UIDRange == MessageIdentifierRange<UID>
UIDSet == MessageIdentifierSet<UID>
UIDSetNonEmpty == MessageIdentifierSetNonEmpty<UID>

SequenceRange == MessageIdentifierRange<SequenceNumber>
SequenceSet == MessageIdentifierSet<SequenceNumber>
2021-11-30 20:34:07 +00:00
David Evans 0490280833 Remove SequenceRange and SequenceRangeSet (#640)
Note - I'll update documentation in a follow-up PR

Remove SequenceRange and SequenceRangeSet and replace with new MessageIdentifier* types.

Motivation:

There was lots of very complicated duplicate code, and there was about to be more if we didn't make the new MessageIdentifier types.

Modifications:

Replace basically every occurrence of SequenceRange with MessageIdentifierRange<SequenceNumber> and SequenceRangeSet with MessageIdentifierSet<SequenceRangeNumber>.
Result:

Lots of lines deleted.
2021-11-30 10:52:46 +00:00
David Evans d936fce407 Replace UIDSet* with generic MessageIdentificationSet (#638)
In a previous PR we made UID conform to a new protocol MessageIdentifier. This PR continues the trend of removing concrete types and replacing them with generic types.

In this case we have UIDSet and UIDSetNonEmpty. These are identical to SequenceNumberSet and SequenceNumberSetNonEmpty. To allow us to remove the duplicate code a new generic type MessageIdentifierSet has been defined that takes a generic parameter T: MessageIdentifier. Both UID and SequenceNumber conform to MessageIdentifier.

In the next PR I will remove the code for SequenceNumberSet* and replace with MessageIdentifierSet. This PR only addresses the UIDSet* types.

Note: I will update all documentation in another (probably the last) PR.
2021-11-24 09:53:56 +00:00
David Evans 4036cd48cd Define generic message identification protocol (#637)
A "message identifier" can be a UID, a SequenceNumber, or an unknown instance of the two (because they look the same it's impossible to distinguish when parsing).

Originally we had the 3 types duplicated 3 times, however this PR brings us closer to have one implementation. While code duplication isn't usually "that bad", in this case it can be an issue as :

The code is complicated
There's a lot of it
This PR works to address a few things, using the UID type as a proof-of-concept:

Make UID conform to a protocol MessageIdentifier
Create a new MessageIdentifierRange type that will eventually replace the UIDRange and SequenceNumberRange types.
2021-11-23 11:44:05 +00:00
David Evans c750d94d6f Refactor shift wrapper to remove duplicate types (#636)
Remove UIDShiftWrapper and SequenceNumberWrapper as they did the same thing for UIDs and SequenceNumbers respectively.

Motivation:

The code was identical, just with different names.

Modifications:

Remove UIDShiftWrapper and SequenceNumberWrapper and replace with a new MessageIdentificationNumber type.

Result:

Less code, more code reuse, more happiness.
2021-11-16 13:39:25 +00:00
Daniel Eggert 9987d80be1 Add support for expressing Pipelining Behavior (#569)
Add support for expressing Pipelining Behavior

Motivation:

IMAP supports command pipelining. But there are restrictions as to what commands can be run at the same time.

This is described in RFC 3501 section 5.5. “Multiple Commands in Progress”.

With this change, it’s possible to know if a specific command can be run while a given set of commands is running.
2021-06-11 16:06:58 +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 53c2eefe72 Disable modification on protected fields after initialisation (#495)
* Use lets

* Fix warnings

* Warnings
2021-03-23 12:31:17 +00:00
David Evans 81c8e9158d Underscore EncodeBuffer (#479)
* Underscore

* Underscore everything

* Add soundness self insert
2021-03-18 11:25:05 +00:00
David Evans 1e0f89fd11 Non empty UID set (#448)
* Convert UIDSet to LastCommandSet

* Soundness

* Define UIDSetNonEmpty

* Use UIDSetNonEmpty

* Soundness

* Fix tests

* Soundness

* Convenience funcs

* Soundness

* Fix compile

* Use parseOneOf

* Soundness
2021-03-05 17:48:42 +00:00
Daniel Eggert 594e1caedc Add RangeView to UIDSet (#447)
* Add RangeView to UIDSet

* Fix for Swift 5.2
2021-02-16 16:17:34 +00:00
Daniel Eggert e704d7f4d9 Make UIDSet conform to RandomAccessCollection (#445) 2021-02-15 15:59:58 +00:00
Daniel Eggert d37f7d81c3 Add @discardableResult (#427) 2021-02-02 10:59:06 +00:00
Matt Diephouse fd1fa71ae4 Add UIDSet.init(_: Range<UID>) (#418) 2021-01-25 20:01:39 +00:00
Daniel Eggert 2f409effef Conform to CustomDebugStringConvertible (#408)
…instead of CustomStringConvertible
2021-01-21 13:34:19 +00:00
David Evans 23f0a211da Kill raw representable (#406)
* Fix up UID

* Fix up Encoding

* Fix up MediaSubtype

* Fix up Flag

* Fix up BasicKind

* Fix up GmailLabel

* Fix up SequenceNumber

* Fix up attritbute flag

* Cleanup UIDShiftWrapper

* Cleanup SequenceRange

* Cleanup UIDRange

* Cleanup UIDValidity

* Cleanup MetadataValue

* Cleanup SectionSpecPart

* Cleanup UAuthMechanism

* Cleanup UseAttribute

* Protect access

* Fix sanity
2021-01-18 14:12:56 +00:00
Daniel Eggert 44b7991dc4 Make UIDSet conform to Collection and SetAlgebra (#393) 2020-12-15 16:10:51 +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 69adba4a85 Add failable “exactly” initializers for UID, UIDValidity, and SequenceNumber (#371) 2020-11-30 17:38:13 +00:00
Matt Diephouse 99b41de069 Make UID, UIDRange, and UIDSet CustomStringConvertible (#360)
* Make UID CustomStringConvertible

* Make UIDRange CustomStringConvertible

* Make UIDSet CustomStringConvertible
2020-11-11 18:41:00 +00:00
Matt Diephouse a704b73e6e Fix parsing and encoding of UID.max (#359)
* Fix parsing and encoding of UID.max

* Adjust formatting
2020-11-11 16:49:35 +00:00
Matt Diephouse 3d53c8cd0f Make UIDSet Hashable (#353) 2020-11-09 21:27:25 +00:00
Matt Diephouse 39f5c96cec Fix UID's and SequenceNumber's advanced(by:) with negative numbers (#347)
* Fix `UID`'s and `SequenceNumber`'s `advanced(by:)` with negative numbers

* Fix formatting
2020-11-06 16:08:26 +00:00