feat: Start IMAP loop for sentbox only if it is configured (#5105)

This commit is contained in:
iequidoo
2024-03-08 02:14:27 -03:00
committed by holger krekel
parent ebdc52247c
commit 7d7289bd51
2 changed files with 10 additions and 4 deletions

View File

@@ -475,6 +475,15 @@ impl Context {
|| self.get_config_bool(Config::OnlyFetchMvbox).await?) || self.get_config_bool(Config::OnlyFetchMvbox).await?)
} }
/// Returns true if sentbox ("Sent" folder) should be watched.
pub(crate) async fn should_watch_sentbox(&self) -> Result<bool> {
Ok(self.get_config_bool(Config::SentboxWatch).await?
&& self
.get_config(Config::ConfiguredSentboxFolder)
.await?
.is_some())
}
/// Gets configured "delete_server_after" value. /// Gets configured "delete_server_after" value.
/// ///
/// `None` means never delete the message, `Some(0)` means delete /// `None` means never delete the message, `Some(0)` means delete

View File

@@ -830,10 +830,7 @@ impl Scheduler {
for (meaning, should_watch) in [ for (meaning, should_watch) in [
(FolderMeaning::Mvbox, ctx.should_watch_mvbox().await), (FolderMeaning::Mvbox, ctx.should_watch_mvbox().await),
( (FolderMeaning::Sent, ctx.should_watch_sentbox().await),
FolderMeaning::Sent,
ctx.get_config_bool(Config::SentboxWatch).await,
),
] { ] {
if should_watch? { if should_watch? {
let (conn_state, handlers) = ImapConnectionState::new(ctx).await?; let (conn_state, handlers) = ImapConnectionState::new(ctx).await?;