Commit Graph
32 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
Daniel Eggert c2628c0721 Fix ResponseTextCode.modified convenience init (#657)
Was generating an empty set instead of converting the UID set.
2021-12-14 11:39:16 +00:00
Daniel Eggert 11bff712e2 Make ResponseTextCode indirect (#655)
Without indirect codegen would create very inefficient code that could exhaust the stack.
2021-12-14 10:22:47 +00: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
David Evans 433f08bdc2 Rename modificationSequence to modification (#649)
Resolves #604

Rename modificationSequence to just modified as it might not contain SequenceNumbers. Also change the associated type from SequenceSet (aka MessageIdentifierSet<SequenceNumber>) to UnknownIdentifier, which can then be treated as either UIDs or SequenceNumbers depending on what the user is expecting.

(Note this is required as it is impossible to distinguish between SequenceNumbers and UIDs when parsing).
2021-12-10 15:02:57 +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 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
Daniel Eggert 329fd7d952 Make ResponseTextCode conform to CustomDebugStringConvertible (#628) 2021-10-13 12:25:53 +01:00
David Evans 708944174f Implement compress extension (RFC 4978) (#593)
Resolves #554

COMPRESS is quite a small extension. It adds a new capability and a command, so there's not much to see. Parsing and encoding is fully implemented and tested using the existing testing framework.
2021-07-30 17:32:43 +01:00
David Evans 9217dfa2c6 Implement RFC 5530 Response Codes (#592)
Resolves #559

Add the response codes from RFC 5530. These are very simple text-only codes, so adding them was really easy. Also added test cases to make sure we don't accidentally break them in the future by inadvertently introducing a typo for example.
2021-07-13 12:42:25 +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 6191061fb4 Create generic type to wrap a set or IMAP "last result" (#463)
* Define last command set type

* Replace SequenceSet

* Docs

* Soundness

* Update dates

* Rename last command set

* Cleanup

* Update docs
2021-03-04 14:45:12 +00:00
Matt Diephouse 2118f38e9b Use a SequenceNumber for ResponseTextCode.unseen (#404) 2021-01-14 15:23:23 +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
Matt Diephouse c28bc3756a Use UIDs for nextUIDs and UIDValiditys for uidValiditys (#346) 2020-11-05 19:39:51 +00:00
David EvansandGeorge Barnett 9642c5a063 Document the various core writing functions. (#333)
* Simplify array has minimum size

* Document the writing functions

* Fix sanity

* Many documentation comments

* Update Sources/NIOIMAPCore/ByteBuffer+WriteLiteral.swift

Co-authored-by: George Barnett <gbarnett@apple.com>

* Address PR comments

* PR comments

Co-authored-by: George Barnett <gbarnett@apple.com>
2020-10-13 11:39:45 +01:00
David EvansandGeorge Barnett 4c72d6c9bb Implement RFC 4467 URL Auth (#329)
* Define URL Auth types with tests

* Finish

* Fix sanity

* Add todo

* Fix sanity

* Move writing spaces out

* Fix sanity

* George PR comments

* Fix sanity

* Move prefix to start of array

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

Co-authored-by: George Barnett <gbarnett@apple.com>

Co-authored-by: George Barnett <gbarnett@apple.com>
2020-10-09 13:11:38 +01:00
David Evans b52faf09dd Implement RFC 2221 Login referrals (#327)
* Implement RFC 2221

* Fix sanity

* Fix compile

* Fix tests
2020-10-08 16:41:19 +01:00
David Evans 155c7113c7 Fix various uses of "mod" (#317)
* Fix some mods

* Finish fixing mod

* Forgot to commit this

* Fix sanity
2020-09-22 15:38:58 +01:00
David Evans 8c81869e72 Implement RFC 5464 Metadata (#315)
* Add capability

* Add metadata value

* Add entry

* Add scope option

* Add response text code

* Fix entry types

* Add metadata option

* Add get metadata

* Add Metadata response

* Finish up

* Fix sanity

* Change space parsing order
2020-09-21 10:06:15 +01:00
David Evans ffdda2a02b Implement RFC 7162 CONDSTORE (#308)
* Add closed

* Entry types

* Support vanished

* Add attribute flag support

* Add sequence match data support

* Add select parameter

* Add SearchSortModifierSequence

* Add SelectParameter.condstore

* Add SortData

* Fix sanity

* Implement SearchSort

* Implement EntryFlagName

* Implement FetchModifierResponse

* Implement ResponseTextCode

* Implement ChangedSince and FetchModifier

* Implement SearchModifierSequence

* Implement SearchKey

* Implement StoreModifier

* Fix sanity

* Fix select spacing

* Fix sanity
2020-09-15 17:29:52 +01:00
Peter Adams f1939cc2cc RFC 5182 (Reference Last Search Result) (#311)
Motivation:

User requested IMAP extension

Modifications:

Add seq-last-command("$") to sequence-set
Add "NOTSAVED" to resp-text-code

Result:

RFC 5182 is supported
2020-09-15 15:31:21 +01:00
David Evans fd3e16ad49 Implement RFC 6154 SPECIAL-USE (#303)
* Implement

* Tests for new types

* Tests

* Fix

* Fix tests

* Fix sanity

* Fix warnings

* Silence warnings
2020-09-08 11:25:48 +01:00
David Evans 2fef4ba772 Implement RFC 4315 UIDPLUS (#302)
* Implement

* Test

* Fix tests
2020-09-03 10:51:04 +01:00
Johannes Weiss 626de3daf0 command encoder (#102) 2020-05-18 15:49:40 +01:00
David Evans 28225ece7d Remove NIOIMAP namespace 2020-05-09 14:46:42 +01:00
tomer doron 53efab1d95 standardize format (#80)
motivation: use standard format across all of our projects

changes:
* add .swiftformat settings based on what we use in other projects
* validate format in the sanity script
* format
2020-04-24 12:05:17 +01:00
David Evans 19ecdb9576 Seperate module (#61) 2020-04-20 12:41:39 +01:00