mirror of
https://github.com/apple/swift-nio-imap
synced 2026-11-26 04:57:51 +00:00
* Define UIDValidity * IUID and PartialRange * PartialRange parsing * Implement IPartial types * Parse UChar * Support parsing various character types * Define EncodedSection * Define EncodedUser * Define ISection * Implement IMailboxReference * Define Expire * Define Access * Define IURLAuthRump * Define EncodedURLAuth * Define IAuth * Define IUserInfo * Define IMessageList * Define IMessagePart * Define IServer * Define UAuthMechanism * Define IUAVerifier * Define IUrlAuth * Define AuthImapUrl * Define Auth types and ICommand * Define IAbsolutePath * Define IPathQuery * Define ImapUrl * Define INetworkPath * Define Imessage or partial * Define IRelativePath * Define ImapUrlRel * Fix sanity * PR review comments * More PR review comments * PR comments * Final comments * Fix sanity * Throw is UID is 0 * Pr reviews * Fix sanity * Add month/day validation * Fix preconditions
34 lines
907 B
Swift
34 lines
907 B
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// RFC 5092 IMAP URL
|
|
public struct UIDValidity: Equatable {
|
|
public var uid: Int
|
|
|
|
public init(uid: Int) throws {
|
|
guard uid > 0 else {
|
|
throw InvalidUID()
|
|
}
|
|
self.uid = uid
|
|
}
|
|
}
|
|
|
|
// MARK: - Encoding
|
|
|
|
extension EncodeBuffer {
|
|
@discardableResult mutating func writeUIDValidaty(_ data: UIDValidity) -> Int {
|
|
self.writeString(";UIDVALIDITY=\(data.uid)")
|
|
}
|
|
}
|