add nio connection layer: tls bootstrap, response handler, command runner
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import NIOIMAPCore
|
||||
|
||||
struct IMAPCommandRunner {
|
||||
private let connection: IMAPConnection
|
||||
private var tagCounter: Int = 0
|
||||
|
||||
init(connection: IMAPConnection) {
|
||||
self.connection = connection
|
||||
}
|
||||
|
||||
mutating func nextTag() -> String {
|
||||
tagCounter += 1
|
||||
return "A\(tagCounter)"
|
||||
}
|
||||
|
||||
mutating func run(_ command: Command) async throws -> [Response] {
|
||||
let tag = nextTag()
|
||||
let tagged = TaggedCommand(tag: tag, command: command)
|
||||
return try await connection.sendCommand(tag, command: .tagged(tagged))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user