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) => {
|
||||
|
||||
Reference in New Issue
Block a user