diff --git a/src/imap.rs b/src/imap.rs index bc78d24fd..c5a5db044 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -3,6 +3,7 @@ use std::time::{Duration, SystemTime}; use async_imap::{ error::Result as ImapResult, + extensions::idle::IdleResponse, types::{Fetch, Flag, Mailbox, Name, NameAttribute}, }; use async_std::prelude::*; @@ -808,8 +809,20 @@ impl Imap { info!(context, "Idle wait was skipped"); } else { info!(context, "Idle entering wait-on-remote state"); - let res = idle_wait.await; - info!(context, "Idle finished wait-on-remote: {:?}", res); + match idle_wait.await { + IdleResponse::NewData(_) => { + info!(context, "Idle finished with NewData"); + } + IdleResponse::Timeout => { + warn!(context, "Idle wait timed out"); + return Err(Error::ImapIdleProtocolFailed( + "timeout".to_string(), + )); + } + IdleResponse::ManualInterrupt => { + warn!(context, "Idle wait was interrupted"); + } + } } match handle.done().await { Ok(session) => { diff --git a/src/job_thread.rs b/src/job_thread.rs index 981aa3e8b..51d39b0b5 100644 --- a/src/job_thread.rs +++ b/src/job_thread.rs @@ -123,9 +123,14 @@ impl JobThread { let watch_folder_name = match context.sql.get_raw_config(context, self.folder_config_name) { Some(name) => name, None => { - return Err(Error::WatchFolderNotFound( - self.folder_config_name.to_string(), - )); + if self.folder_config_name == "configured_inbox_folder" { + // operating on an old database? + "INBOX".to_string() + } else { + return Err(Error::WatchFolderNotFound( + self.folder_config_name.to_string(), + )); + } } };