~matthiasbeyer/maildir

83ccf89f16e32da6bde42dcb316bf0037907bfab — Kartikaya Gupta 1 year, 5 months ago 9101789
Bump mailparse to 0.12
3 files changed, 7 insertions(+), 13 deletions(-)

M Cargo.toml
M src/lib.rs
M tests/smoke.rs
M Cargo.toml => Cargo.toml +1 -1
@@ 17,7 17,7 @@ travis-ci = { repository = "staktrace/maildir" }
maintenance = { status = "passively-maintained" }

[dependencies]
mailparse = "0.11"
mailparse = "0.12"
gethostname = "0.2.1"

[dev-dependencies]

M src/lib.rs => src/lib.rs +4 -5
@@ 104,14 104,13 @@ impl MailEntry {
    pub fn received(&mut self) -> Result<i64, MailEntryError> {
        self.read_data()?;
        let headers = self.headers()?;
        let received = headers.get_first_value("Received")?;
        let received = headers.get_first_value("Received");
        match received {
            Some(v) => v
                .rsplit(';')
                .nth(0)
                .ok_or_else(|| "Unable to split Received header")
                .and_then(|ts| dateparse(ts))
                .map_err(MailEntryError::from),
                .ok_or_else(|| MailEntryError::DateError("Unable to split Received header"))
                .and_then(|ts| dateparse(ts).map_err(MailEntryError::from)),
            None => Err("No Received header found")?,
        }
    }


@@ 119,7 118,7 @@ impl MailEntry {
    pub fn date(&mut self) -> Result<i64, MailEntryError> {
        self.read_data()?;
        let headers = self.headers()?;
        let date = headers.get_first_value("Date")?;
        let date = headers.get_first_value("Date");
        match date {
            Some(ts) => dateparse(&ts).map_err(MailEntryError::from),
            None => Err("No Date header found")?,

M tests/smoke.rs => tests/smoke.rs +2 -7
@@ 62,7 62,7 @@ fn maildir_list() {
        let mut first = iter.next().unwrap().unwrap();
        assert_eq!(first.id(), "1463941010.5f7fa6dd4922c183dc457d033deee9d7");
        assert_eq!(
            first.headers().unwrap().get_first_value("Subject").unwrap(),
            first.headers().unwrap().get_first_value("Subject"),
            Some(String::from("test"))
        );
        assert_eq!(first.is_seen(), false);


@@ 73,12 73,7 @@ fn maildir_list() {
        let mut first = iter.next().unwrap().unwrap();
        assert_eq!(first.id(), "1463868505.38518452d49213cb409aa1db32f53184");
        assert_eq!(
            first
                .parsed()
                .unwrap()
                .headers
                .get_first_value("Subject")
                .unwrap(),
            first.parsed().unwrap().headers.get_first_value("Subject"),
            Some(String::from("test"))
        );
        assert_eq!(first.is_seen(), true);