add fetchFullMessage, fetchSection to IMAPClient for MIME attachment retrieval
This commit is contained in:
@@ -22,6 +22,10 @@ final class MockIMAPClient: IMAPClientProtocol, @unchecked Sendable {
|
||||
var expungedMailboxes: [String] = []
|
||||
var appendedMessages: [(mailbox: String, message: Data, flags: [String])] = []
|
||||
var serverCapabilities: Set<String> = ["IMAP4rev1", "MOVE"]
|
||||
var fullMessages: [Int: String] = [:]
|
||||
var sections: [String: Data] = [:] // key: "uid-section"
|
||||
var fetchFullMessageCalls: [Int] = []
|
||||
var fetchSectionCalls: [(uid: Int, mailbox: String, section: String)] = []
|
||||
|
||||
func connect() async throws {
|
||||
connectCalled = true
|
||||
@@ -61,6 +65,18 @@ final class MockIMAPClient: IMAPClientProtocol, @unchecked Sendable {
|
||||
bodies[uid] ?? (nil, nil)
|
||||
}
|
||||
|
||||
// MARK: - v0.5 attachment/MIME operations
|
||||
|
||||
func fetchFullMessage(uid: Int) async throws -> String {
|
||||
fetchFullMessageCalls.append(uid)
|
||||
return fullMessages[uid] ?? ""
|
||||
}
|
||||
|
||||
func fetchSection(uid: Int, mailbox: String, section: String) async throws -> Data {
|
||||
fetchSectionCalls.append((uid: uid, mailbox: mailbox, section: section))
|
||||
return sections["\(uid)-\(section)"] ?? Data()
|
||||
}
|
||||
|
||||
// MARK: - v0.3 write operations
|
||||
|
||||
func storeFlags(uid: Int, mailbox: String, add: [String], remove: [String]) async throws {
|
||||
|
||||
Reference in New Issue
Block a user