add IMAP write operations, special folder role detection
Extend IMAPClientProtocol with storeFlags, moveMessage, copyMessage, expunge, appendMessage, capabilities methods. Implement all six in IMAPClient actor using NIOIMAPCore typed commands. Add multi-part command support to IMAPConnection/IMAPCommandRunner for APPEND. MockIMAPClient tracks all write calls for testing. SyncCoordinator detects mailbox roles from LIST attributes with name-based fallback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,19 @@ actor IMAPConnection {
|
||||
}
|
||||
}
|
||||
|
||||
/// Send multiple command parts as a single multi-part command (e.g. APPEND).
|
||||
/// The tag must match the tag embedded in the first part.
|
||||
func sendMultiPartCommand(_ tag: String, parts: [CommandStreamPart]) async throws -> [Response] {
|
||||
guard let channel else { throw IMAPError.notConnected }
|
||||
let handler = responseHandler
|
||||
return try await withCheckedThrowingContinuation { continuation in
|
||||
handler.sendCommand(tag: tag, continuation: continuation)
|
||||
for part in parts {
|
||||
channel.writeAndFlush(IMAPClientHandler.Message.part(part), promise: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func disconnect() async throws {
|
||||
try await channel?.close()
|
||||
channel = nil
|
||||
|
||||
Reference in New Issue
Block a user