Commit
Author: Manos Pitsidianakis [manos@pitsidianak.is]
Hash: e6877e89c2c8d0fb93637670478d5694e9b9b571
Timestamp: Sat, 03 Aug 2024 10:56:40 +0000 (5 months ago)

+4 -4 +/-1 browse
melib/jmap: refactor some parser imports
melib/jmap: refactor some parser imports

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
1diff --git a/melib/src/jmap/email.rs b/melib/src/jmap/email.rs
2index 8cc1514..43d3e79 100644
3--- a/melib/src/jmap/email.rs
4+++ b/melib/src/jmap/email.rs
5 @@ -270,10 +270,10 @@ impl std::fmt::Display for EmailAddress {
6
7 impl From<EmailObject> for crate::Envelope {
8 fn from(mut t: EmailObject) -> Self {
9- use crate::email::parser::address::rfc2822address_list;
10+ use crate::email::parser::{address::rfc2822address_list, dates::rfc5322_date};
11
12 let mut env = Self::new(t.id.into_hash());
13- if let Ok(d) = crate::email::parser::dates::rfc5322_date(env.date_as_str().as_bytes()) {
14+ if let Ok(d) = rfc5322_date(env.date_as_str().as_bytes()) {
15 env.set_datetime(d);
16 }
17 if let Some(sent_at) = t.sent_at.take() {
18 @@ -296,10 +296,10 @@ impl From<EmailObject> for crate::Envelope {
19 }
20 if let Some(v) = t.headers.get(HeaderName::DATE.as_str()) {
21 env.set_date(v.as_bytes());
22- if let Ok(d) = crate::email::parser::dates::rfc5322_date(v.as_bytes()) {
23+ if let Ok(d) = rfc5322_date(v.as_bytes()) {
24 env.set_datetime(d);
25 }
26- } else if let Ok(d) = crate::email::parser::dates::rfc5322_date(t.received_at.as_bytes()) {
27+ } else if let Ok(d) = rfc5322_date(t.received_at.as_bytes()) {
28 env.set_datetime(d);
29 }
30 env.set_has_attachments(t.has_attachment);