`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.
* [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.
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`.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.