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

@@ -59,7 +59,7 @@ impl Imap {
task::block_on(async move { self.config.read().await.can_idle })
}
pub fn idle(&self, context: &Context, watch_folder: Option<String>) -> Result<()> {
pub fn idle(&self, context: &Context, watch_folder: String) -> Result<()> {
task::block_on(async move {
if !self.can_idle() {
return Err(Error::IdleAbilityMissing);
@@ -67,7 +67,7 @@ impl Imap {
self.setup_handle_if_needed(context).await?;
self.select_folder(context, watch_folder.clone()).await?;
self.select_folder(context, watch_folder).await?;
let session = self.session.lock().await.take();
let timeout = Duration::from_secs(23 * 60);