fix raw MIME body display, re-parse stale cached bodies, fix minor review items

- detect and re-fetch bodies containing unparsed MIME content (boundary markers,
  Content-Transfer-Encoding headers) from pre-MIMEParser code path
- fix MIMEParser section numbering: pass cumulative sectionPrefix in nested multiparts
  instead of resetting to empty string
- generate snippet from parsed body text when envelope snippet is missing
- add pendingAction(id:) direct lookup to MailStore, avoid re-fetching all actions
- add updateSnippet method to MailStore
- fix IMAPIdleClient.selectInbox: use incrementing tag counter instead of hardcoded tag
- use static nonisolated(unsafe) ISO8601DateFormatter in ActionQueue (avoid repeated alloc)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 10:33:08 +01:00
parent 31ab18cb2a
commit 8c33d4d4a6
5 changed files with 55 additions and 12 deletions
@@ -13,6 +13,7 @@ public actor IMAPIdleClient {
private var group: EventLoopGroup?
private var isMonitoring = false
private var monitorTask: Task<Void, Never>?
private var tagCounter = 0
private let reIdleInterval: Duration = .seconds(29 * 60) // 29 minutes per RFC 2177
public init(host: String, port: Int, credentials: Credentials) {
@@ -120,7 +121,8 @@ public actor IMAPIdleClient {
guard let channel else { throw IMAPError.notConnected }
let responseHandler = try await getResponseHandler()
let tag = "IDLESEL1"
tagCounter += 1
let tag = "IDLESEL\(tagCounter)"
let selectCommand = TaggedCommand(
tag: tag,
command: .select(MailboxName(ByteBuffer(string: "INBOX")))