Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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