mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-22 02:50:19 +00:00
show email addr when name not available (#131)
This commit is contained in:
parent
754d311a05
commit
950e57acdb
2 changed files with 19 additions and 3 deletions
|
@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Output redirected to `stderr` [#130]
|
||||
- Refactor table system [#132]
|
||||
- Editon file format on Linux [#133]
|
||||
- Show email address when name not available [#131]
|
||||
|
||||
## [0.2.6] - 2021-04-17
|
||||
|
||||
|
@ -211,5 +212,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
[#125]: https://github.com/soywod/himalaya/issues/125
|
||||
[#126]: https://github.com/soywod/himalaya/issues/126
|
||||
[#130]: https://github.com/soywod/himalaya/issues/130
|
||||
[#131]: https://github.com/soywod/himalaya/issues/131
|
||||
[#132]: https://github.com/soywod/himalaya/issues/132
|
||||
[#133]: https://github.com/soywod/himalaya/issues/133
|
||||
|
|
|
@ -262,9 +262,23 @@ impl<'m> From<&'m imap::types::Fetch> for Msg<'m> {
|
|||
sender: envelope
|
||||
.from
|
||||
.as_ref()
|
||||
.and_then(|addrs| addrs.first()?.name)
|
||||
.and_then(|name| rfc2047_decoder::decode(name).ok())
|
||||
.unwrap_or_default(),
|
||||
.and_then(|addrs| addrs.first())
|
||||
.and_then(|addr| {
|
||||
addr.name
|
||||
.and_then(|name| rfc2047_decoder::decode(name).ok())
|
||||
.or_else(|| {
|
||||
let mbox = addr
|
||||
.mailbox
|
||||
.and_then(|mbox| String::from_utf8(mbox.to_vec()).ok())
|
||||
.unwrap_or(String::from("unknown"));
|
||||
let host = addr
|
||||
.host
|
||||
.and_then(|host| String::from_utf8(host.to_vec()).ok())
|
||||
.unwrap_or(String::from("unknown"));
|
||||
Some(format!("{}@{}", mbox, host))
|
||||
})
|
||||
})
|
||||
.unwrap_or(String::from("unknown")),
|
||||
date: fetch
|
||||
.internal_date()
|
||||
.map(|date| date.naive_local().to_string())
|
||||
|
|
Loading…
Reference in a new issue