Check if contact is blocked or accepted before downloading it

This commit is contained in:
Alexander Krotov
2020-02-09 15:34:14 +03:00
parent bcdc323a97
commit 4f6745b742

View File

@@ -19,7 +19,9 @@ use mailparse::MailHeaderMap;
use crate::config::*;
use crate::constants::*;
use crate::context::Context;
use crate::dc_receive_imf::{dc_receive_imf, is_msgrmsg_rfc724_mid_in_list};
use crate::dc_receive_imf::{
dc_receive_imf, from_field_to_contact_id, is_msgrmsg_rfc724_mid_in_list,
};
use crate::events::Event;
use crate::headerdef::HeaderDef;
use crate::imap_client::*;
@@ -1333,10 +1335,12 @@ fn prefetch_should_download(
let is_autocrypt_setup_message =
prefetch_has_header(&headers, HeaderDef::AutocryptSetupMessage)?;
// TODO: currently we don't check contacts during prefetch
// We assume the best case: contact is accepted and not blocked.
let accepted_contact = true;
let blocked_contact = false;
let from_field = headers
.get_first_value(&HeaderDef::From_.get_headername())?
.unwrap_or_default();
let (_contact_id, blocked_contact, origin) = from_field_to_contact_id(context, &from_field)?;
let accepted_contact = origin.is_known();
let show = is_autocrypt_setup_message
|| match show_emails {