Skip to content
Closed
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
23 changes: 8 additions & 15 deletions src/imap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,12 +848,14 @@ impl Imap {
context: &Context,
session: &mut Session,
) -> Result<()> {
add_all_recipients_as_contacts(context, session, Config::ConfiguredMvboxFolder)
.await
.context("failed to get recipients from the movebox")?;
add_all_recipients_as_contacts(context, session, Config::ConfiguredInboxFolder)
if let Some(mvbox) = context.get_config(Config::ConfiguredMvboxFolder).await? {
add_all_recipients_as_contacts(context, session, mvbox)
.await
.context("Failed to get recipients from the movebox")?;
}
add_all_recipients_as_contacts(context, session, "INBOX")
.await
.context("failed to get recipients from the inbox")?;
.context("Failed to get recipients from the inbox")?;

info!(context, "Done fetching existing messages.");
Ok(())
Expand Down Expand Up @@ -2554,17 +2556,8 @@ impl std::fmt::Display for UidRange {
async fn add_all_recipients_as_contacts(
context: &Context,
session: &mut Session,
folder: Config,
mailbox: &str,
) -> Result<()> {
let mailbox = if let Some(m) = context.get_config(folder).await? {
m
} else {
info!(
context,
"Folder {} is not configured, skipping fetching contacts from it.", folder
);
return Ok(());
};
let create = false;
let folder_exists = session
.select_with_uidvalidity(context, &mailbox, create)
Expand Down
Loading