From 72991218d9371985a2d09a8d685d87edf807ee7d Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 26 Nov 2024 03:26:43 +0100 Subject: [PATCH] Little refactoring --- .../kotlin/net/codinux/invoicing/email/EmailsFetcher.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt index 85ee00d..3e52d5d 100644 --- a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt +++ b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt @@ -40,7 +40,7 @@ open class EmailsFetcher( open fun listenForNewEmails(account: EmailAccount, options: ListenForNewMailsOptions) = runBlocking { try { connect(account) { store -> - val folder = store.getFolder(options.emailFolderName) + val folder = store.getFolder(options.emailFolderName) as IMAPFolder folder.open(Folder.READ_ONLY) val status = FetchEmailsStatus(options) @@ -63,7 +63,7 @@ open class EmailsFetcher( } } - protected open suspend fun keepConnectionOpen(account: EmailAccount, folder: Folder, options: ListenForNewMailsOptions) { + protected open suspend fun keepConnectionOpen(account: EmailAccount, folder: IMAPFolder, options: ListenForNewMailsOptions) { log.info { "Listening to new emails of ${account.username}" } // Use IMAP IDLE to keep the connection alive @@ -73,7 +73,7 @@ open class EmailsFetcher( folder.open(Folder.READ_ONLY) } - (folder as IMAPFolder).idle() + folder.idle() delay(250) }