mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
* First try making get_recipients use MailHeader (nice and functional) * Get it to compile by using not-so-functional style * Add "empty-from" test, drop unnecessary check for error; continue using addrparse_header() instead of addrparse() * Try to use functional style, unfortunately, I can't get the compiler to accept it * Do it imperative-style: Do not overwrite To with Cc and vice versa * Use addrparse_header() once more * Still addrparse_header() * Clippy * Fix compile errors in tests * Fix typo * Fix tests again ;-) * Code style * Code style; try a HashMap<addr: String, display_name: String> as an address list but I am not convinced * Code style; Use Vec<SingleInfo> as address list * Clippy * Add tests * Add another test * Remove stale comments
This commit is contained in:
@@ -9,7 +9,8 @@ use crate::aheader::*;
|
||||
use crate::config::Config;
|
||||
use crate::context::Context;
|
||||
use crate::error::*;
|
||||
use crate::headerdef::{HeaderDef, HeaderDefMap};
|
||||
use crate::headerdef::HeaderDef;
|
||||
use crate::headerdef::HeaderDefMap;
|
||||
use crate::key::{DcKey, Key, SignedPublicKey, SignedSecretKey};
|
||||
use crate::keyring::*;
|
||||
use crate::peerstate::*;
|
||||
@@ -122,8 +123,8 @@ pub fn try_decrypt(
|
||||
) -> Result<(Option<Vec<u8>>, HashSet<String>)> {
|
||||
let from = mail
|
||||
.headers
|
||||
.get_header_value(HeaderDef::From_)
|
||||
.and_then(|from_addr| mailparse::addrparse(&from_addr).ok())
|
||||
.get_header(HeaderDef::From_)
|
||||
.and_then(|from_addr| mailparse::addrparse_header(&from_addr).ok())
|
||||
.and_then(|from| from.extract_single_info())
|
||||
.map(|from| from.addr)
|
||||
.unwrap_or_default();
|
||||
|
||||
Reference in New Issue
Block a user