mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-19 22:51:13 +00:00
fix bad sender and date in reply and forward tpl (#321)
This commit is contained in:
parent
1b16804ed6
commit
e5164a2ce3
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Some emojis break the table layout [#300]
|
- Some emojis break the table layout [#300]
|
||||||
|
- Bad sender and date in reply and forward template [#321]
|
||||||
|
|
||||||
## [0.5.7] - 2022-03-01
|
## [0.5.7] - 2022-03-01
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ use anyhow::{anyhow, Context, Error, Result};
|
||||||
use chrono::{DateTime, FixedOffset};
|
use chrono::{DateTime, FixedOffset};
|
||||||
use html_escape;
|
use html_escape;
|
||||||
use lettre::message::{header::ContentType, Attachment, MultiPart, SinglePart};
|
use lettre::message::{header::ContentType, Attachment, MultiPart, SinglePart};
|
||||||
use log::{debug, info, trace};
|
use log::{debug, info, trace, warn};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::{collections::HashSet, convert::TryInto, env::temp_dir, fmt::Debug, fs, path::PathBuf};
|
use std::{collections::HashSet, convert::TryInto, env::temp_dir, fmt::Debug, fs, path::PathBuf};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
@ -170,9 +170,6 @@ impl Msg {
|
||||||
// In-Reply-To
|
// In-Reply-To
|
||||||
self.in_reply_to = self.message_id.to_owned();
|
self.in_reply_to = self.message_id.to_owned();
|
||||||
|
|
||||||
// From
|
|
||||||
self.from = Some(vec![account_addr.clone()].into());
|
|
||||||
|
|
||||||
// To
|
// To
|
||||||
let addrs = self
|
let addrs = self
|
||||||
.reply_to
|
.reply_to
|
||||||
|
@ -198,11 +195,6 @@ impl Msg {
|
||||||
self.bcc = None;
|
self.bcc = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subject
|
|
||||||
if !self.subject.starts_with("Re:") {
|
|
||||||
self.subject = format!("Re: {}", self.subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Body
|
// Body
|
||||||
let plain_content = {
|
let plain_content = {
|
||||||
let date = self
|
let date = self
|
||||||
|
@ -236,6 +228,14 @@ impl Msg {
|
||||||
|
|
||||||
self.parts = Parts(vec![Part::new_text_plain(plain_content)]);
|
self.parts = Parts(vec![Part::new_text_plain(plain_content)]);
|
||||||
|
|
||||||
|
// Subject
|
||||||
|
if !self.subject.starts_with("Re:") {
|
||||||
|
self.subject = format!("Re: {}", self.subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
// From
|
||||||
|
self.from = Some(vec![account_addr.clone()].into());
|
||||||
|
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,6 +648,16 @@ impl Msg {
|
||||||
"subject" => {
|
"subject" => {
|
||||||
msg.subject = val;
|
msg.subject = val;
|
||||||
}
|
}
|
||||||
|
"date" => {
|
||||||
|
msg.date = DateTime::parse_from_rfc2822(
|
||||||
|
val.split_at(val.find(" (").unwrap_or_else(|| val.len())).0,
|
||||||
|
)
|
||||||
|
.map_err(|err| {
|
||||||
|
warn!("cannot parse message date {:?}, skipping it", val);
|
||||||
|
err
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
|
}
|
||||||
"from" => {
|
"from" => {
|
||||||
msg.from = from_slice_to_addrs(val)
|
msg.from = from_slice_to_addrs(val)
|
||||||
.context(format!("cannot parse header {:?}", key))?
|
.context(format!("cannot parse header {:?}", key))?
|
||||||
|
|
Loading…
Reference in a new issue