imap: simplify select_folder() interface

Accept AsRef<str> instead of Option<impl AsRef<str>>.

There is no need to pass None to force expunge anymore.
This commit is contained in:
Alexander Krotov
2020-04-30 22:33:55 +03:00
committed by link2xt
parent c41a6b87b8
commit e8763e936d
4 changed files with 42 additions and 46 deletions

View File

@@ -173,14 +173,15 @@ impl JobThread {
if !self.imap.can_idle() {
true // we have to do fake_idle
} else {
let watch_folder = self.get_watch_folder(context);
info!(context, "{} started...", prefix);
let res = self.imap.idle(context, watch_folder);
info!(context, "{} ended...", prefix);
if let Err(err) = res {
warn!(context, "{} failed: {} -> reconnecting", prefix, err);
// something is borked, let's start afresh on the next occassion
self.imap.disconnect(context);
if let Some(watch_folder) = self.get_watch_folder(context) {
info!(context, "{} started...", prefix);
let res = self.imap.idle(context, watch_folder);
info!(context, "{} ended...", prefix);
if let Err(err) = res {
warn!(context, "{} failed: {} -> reconnecting", prefix, err);
// something is Label { Label }orked, let's start afresh on the next occassion
self.imap.disconnect(context);
}
}
false
}