mirror of
https://github.com/apple/swift-nio-imap
synced 2026-11-29 05:24:23 +00:00
Small fields (mailbox names, atoms, quoted strings, envelope fields, base64, URLs, the authentication challenge, catenateURL, ...) become [UInt8]. The four raw-payload cases stay ByteBuffer until "Make payload cases IMAPBuffer". The grammar's string productions return [UInt8]. The parser still runs on ParseBuffer, so its cursor methods copy out of the ByteBuffer for now. Review focus: the model files' encoders and ModifiedUTF7 on arrays. Updates IMAPTool and the IMAPCommands catenate-URL wrapper. Public API breaks: - ~38 public declarations ByteBuffer -> [UInt8]. - ModifiedUTF7.EncodingRoundtripError.buffer -> .bytes. - Response.authenticationChallenge and ContinuationRequest.data are [UInt8]; an empty challenge is []. Internal: writeBufferAsBase64 -> writeBytesAsBase64; the ByteBuffer writeIMAPString overload is gone.
82 lines
3.1 KiB
Swift
82 lines
3.1 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2026 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 Foundation
|
|
@testable import IMAPToolLib
|
|
import NIO
|
|
import NIOIMAP
|
|
import Testing
|
|
|
|
@Suite
|
|
private enum MessageInfoTests {
|
|
@Test
|
|
static func fromMessageAttributes() {
|
|
#expect(
|
|
MessageInfo(
|
|
uid: 8_089_525,
|
|
attributes: [
|
|
MessageAttribute.envelope(
|
|
Envelope(
|
|
date: "Sat, 19 Oct 2024 03:36:04 +0000",
|
|
subject: Array("Your Tripper Bus Ticket".utf8),
|
|
from: [
|
|
EmailAddressListElement.singleAddress(
|
|
EmailAddress(
|
|
personName: Array("TripperBus".utf8),
|
|
sourceRoot: nil,
|
|
mailbox: Array("noreply".utf8),
|
|
host: Array("tripperbus.com".utf8)
|
|
)
|
|
)
|
|
],
|
|
sender: [],
|
|
reply: [],
|
|
to: [
|
|
EmailAddressListElement.singleAddress(
|
|
EmailAddress(
|
|
personName: Array("Jacob Black".utf8),
|
|
sourceRoot: nil,
|
|
mailbox: Array("jacob.black.paid".utf8),
|
|
host: Array("icloud.com".utf8)
|
|
)
|
|
)
|
|
],
|
|
cc: [],
|
|
bcc: [],
|
|
inReplyTo: nil,
|
|
messageID: MessageID("<20250619033604.32962e456969f8f6@tripperbus.com>")
|
|
)
|
|
),
|
|
MessageAttribute.flags([.answered, .seen]),
|
|
]
|
|
)
|
|
== MessageInfo(
|
|
uid: 8_089_525,
|
|
date: "Sat, 19 Oct 2024 03:36:04 +0000",
|
|
dateSeconds: 1_729_308_964,
|
|
subject: "Your Tripper Bus Ticket",
|
|
from: #""TripperBus" <noreply@tripperbus.com>"#,
|
|
to: #""Jacob Black" <jacob.black.paid@icloud.com>"#,
|
|
cc: nil,
|
|
messageID: "<20250619033604.32962e456969f8f6@tripperbus.com>",
|
|
inReplyTo: nil,
|
|
flags: [
|
|
#"\Answered"#,
|
|
#"\Seen"#,
|
|
]
|
|
)
|
|
)
|
|
}
|
|
}
|