mirror of
https://github.com/apple/swift-nio-imap
synced 2026-11-27 05:04:23 +00:00
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.
42 lines
1.5 KiB
Swift
42 lines
1.5 KiB
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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import struct NIO.ByteBuffer
|
|
|
|
/// Similar to `AuthImapURL`, but with an additional field to help verify the URL authorization.
|
|
public struct FullAuthenticatedURL: Hashable {
|
|
/// An IMAP url pointing to a remote message.
|
|
public var networkMessagePath: NetworkMessagePath
|
|
|
|
/// URL authentication details.
|
|
public var authenticatedURL: AuthenticatedURL
|
|
|
|
/// Creates a new `FullAuthenticatedURL`.
|
|
/// - parameter networkMessagePath: An IMAP url pointing to a remote message.
|
|
/// - parameter authenticatedURL: URL authentication details.
|
|
public init(networkMessagePath: NetworkMessagePath, authenticatedURL: AuthenticatedURL) {
|
|
self.networkMessagePath = networkMessagePath
|
|
self.authenticatedURL = authenticatedURL
|
|
}
|
|
}
|
|
|
|
// MARK: - Encoding
|
|
|
|
extension EncodeBuffer {
|
|
@discardableResult mutating func writeAuthIMAPURLFull(_ data: FullAuthenticatedURL) -> Int {
|
|
self.writeAuthenticatedURL(data.networkMessagePath) +
|
|
self.writeIAuthenticatedURL(data.authenticatedURL)
|
|
}
|
|
}
|