mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 09:26:30 +03:00
proper handling of IdleResponse codes
This commit is contained in:
17
src/imap.rs
17
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) => {
|
||||
|
||||
@@ -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(),
|
||||
));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user