aboutsummaryrefslogtreecommitdiff
path: root/src/imap/imf_view.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-06 22:53:41 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-06 22:53:41 +0100
commit5622a71cd163e4b18a3eabe8a28a5aedb23ee25d (patch)
tree43f3b4c560da80890844353da62e6629acb761cc /src/imap/imf_view.rs
parent73fc5e77df9db756af64135aaa08bb0242b13371 (diff)
downloadaerogramme-5622a71cd163e4b18a3eabe8a28a5aedb23ee25d.tar.gz
aerogramme-5622a71cd163e4b18a3eabe8a28a5aedb23ee25d.zip
Search MIME headers
Diffstat (limited to 'src/imap/imf_view.rs')
-rw-r--r--src/imap/imf_view.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/imap/imf_view.rs b/src/imap/imf_view.rs
index 8b52b9e..b56e27d 100644
--- a/src/imap/imf_view.rs
+++ b/src/imap/imf_view.rs
@@ -1,3 +1,6 @@
+use anyhow::{anyhow, Result};
+use chrono::naive::NaiveDate;
+
use imap_codec::imap_types::core::{IString, NString};
use imap_codec::imap_types::envelope::{Address, Envelope};
@@ -6,6 +9,10 @@ use eml_codec::imf;
pub struct ImfView<'a>(pub &'a imf::Imf<'a>);
impl<'a> ImfView<'a> {
+ pub fn naive_date(&self) -> Result<NaiveDate> {
+ Ok(self.0.date.ok_or(anyhow!("date is not set"))?.date_naive())
+ }
+
/// Envelope rules are defined in RFC 3501, section 7.4.2
/// https://datatracker.ietf.org/doc/html/rfc3501#section-7.4.2
///