Skip to content

Commit

Permalink
feat: Start IMAP loop for sentbox only if it is configured (#5105)
Browse files Browse the repository at this point in the history
  • Loading branch information
iequidoo authored and hpk42 committed Mar 9, 2024
1 parent ebdc522 commit 7d7289b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,15 @@ impl Context {
|| 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.
///
/// `None` means never delete the message, `Some(0)` means delete
Expand Down
5 changes: 1 addition & 4 deletions src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,7 @@ impl Scheduler {

for (meaning, should_watch) in [
(FolderMeaning::Mvbox, ctx.should_watch_mvbox().await),
(
FolderMeaning::Sent,
ctx.get_config_bool(Config::SentboxWatch).await,
),
(FolderMeaning::Sent, ctx.should_watch_sentbox().await),
] {
if should_watch? {
let (conn_state, handlers) = ImapConnectionState::new(ctx).await?;
Expand Down

0 comments on commit 7d7289b

Please sign in to comment.