bump imap-rust v3.0.0-alpha.3

This commit is contained in:
Clément DOUIN
2021-05-09 21:40:37 +02:00
parent d41df7d1a4
commit 36d3cd6347
6 changed files with 38 additions and 59 deletions
+4
View File
@@ -235,6 +235,7 @@ impl<'m> From<&'m imap::types::Fetch> for Msg<'m> {
flags: Flags::new(fetch.flags()),
subject: envelope
.subject
.as_ref()
.and_then(|subj| rfc2047_decoder::decode(subj).ok())
.unwrap_or_default(),
sender: envelope
@@ -243,14 +244,17 @@ impl<'m> From<&'m imap::types::Fetch> for Msg<'m> {
.and_then(|addrs| addrs.first())
.and_then(|addr| {
addr.name
.as_ref()
.and_then(|name| rfc2047_decoder::decode(name).ok())
.or_else(|| {
let mbox = addr
.mailbox
.as_ref()
.and_then(|mbox| String::from_utf8(mbox.to_vec()).ok())
.unwrap_or(String::from("unknown"));
let host = addr
.host
.as_ref()
.and_then(|host| String::from_utf8(host.to_vec()).ok())
.unwrap_or(String::from("unknown"));
Some(format!("{}@{}", mbox, host))