Function from_field_to_contact_id

Source
pub async fn from_field_to_contact_id(
    context: &Context,
    from: &SingleInfo,
    fingerprint: Option<&Fingerprint>,
    prevent_rename: bool,
    find_key_contact_by_addr: bool,
) -> Result<Option<(ContactId, bool, Origin)>>
Expand description

Converts “From” field to contact id.

Also returns whether it is blocked or not and its origin.

  • prevent_rename: if true, the display_name of this contact will not be changed. Useful for mailing lists: In some mailing lists, many users write from the same address but with different display names. We don’t want the display name to change every time the user gets a new email from a mailing list.

  • find_key_contact_by_addr: if true, we only know the e-mail address of the contact, but not the fingerprint, yet want to assign the message to some key-contact. This can happen during prefetch or when the message is partially downloaded. If we get it wrong, the message will be placed into the correct chat after downloading.

Returns None if From field does not contain a valid contact address.