fix: Don't try to do fetch_move_delete() if Trash is needed but not yet configured

This fixes things for Gmail f.e. Before, `Imap::fetch_move_delete()` was called before looking for
Trash and returned an error because of that failing the whole `fetch_idle()` which prevented
configuring Trash in turn.
This commit is contained in:
iequidoo
2024-04-04 04:36:01 -03:00
committed by iequidoo
parent d39cbcdc8d
commit e9cfcd9d1b
3 changed files with 59 additions and 22 deletions

View File

@@ -89,9 +89,16 @@ impl Imap {
Config::ConfiguredSentboxFolder,
Config::ConfiguredTrashFolder,
] {
context
.set_config_internal(conf, folder_configs.get(&conf).map(|s| s.as_str()))
.await?;
let val = folder_configs.get(&conf).map(|s| s.as_str());
let interrupt = conf == Config::ConfiguredTrashFolder
&& val.is_some()
&& context.get_config(conf).await?.is_none();
context.set_config_internal(conf, val).await?;
if interrupt {
// `Imap::fetch_move_delete()` is possible now for other folders (NB: we are in the
// Inbox loop).
context.scheduler.interrupt_oboxes().await;
}
}
last_scan.replace(tools::Time::now());