mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +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::{
|
use async_imap::{
|
||||||
error::Result as ImapResult,
|
error::Result as ImapResult,
|
||||||
|
extensions::idle::IdleResponse,
|
||||||
types::{Fetch, Flag, Mailbox, Name, NameAttribute},
|
types::{Fetch, Flag, Mailbox, Name, NameAttribute},
|
||||||
};
|
};
|
||||||
use async_std::prelude::*;
|
use async_std::prelude::*;
|
||||||
@@ -808,8 +809,20 @@ impl Imap {
|
|||||||
info!(context, "Idle wait was skipped");
|
info!(context, "Idle wait was skipped");
|
||||||
} else {
|
} else {
|
||||||
info!(context, "Idle entering wait-on-remote state");
|
info!(context, "Idle entering wait-on-remote state");
|
||||||
let res = idle_wait.await;
|
match idle_wait.await {
|
||||||
info!(context, "Idle finished wait-on-remote: {:?}", res);
|
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 {
|
match handle.done().await {
|
||||||
Ok(session) => {
|
Ok(session) => {
|
||||||
|
|||||||
@@ -123,9 +123,14 @@ impl JobThread {
|
|||||||
let watch_folder_name = match context.sql.get_raw_config(context, self.folder_config_name) {
|
let watch_folder_name = match context.sql.get_raw_config(context, self.folder_config_name) {
|
||||||
Some(name) => name,
|
Some(name) => name,
|
||||||
None => {
|
None => {
|
||||||
return Err(Error::WatchFolderNotFound(
|
if self.folder_config_name == "configured_inbox_folder" {
|
||||||
self.folder_config_name.to_string(),
|
// 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