From 4a855720e4c2494bbf81cb3d430e62e8c41ed881 Mon Sep 17 00:00:00 2001 From: Shaun Savage Date: Thu, 28 Jun 2018 15:53:37 +0000 Subject: [PATCH 1/4] added passing back the email data --- src/parse.rs | 2 ++ src/types/fetch.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/src/parse.rs b/src/parse.rs index 43f36f7..cc5cbe5 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -84,6 +84,7 @@ pub fn parse_fetches(lines: Vec) -> ZeroCopyResult> { uid: None, rfc822_header: None, rfc822: None, + email: None, }; for attr in attrs { @@ -95,6 +96,7 @@ pub fn parse_fetches(lines: Vec) -> ZeroCopyResult> { AttributeValue::Uid(uid) => fetch.uid = Some(uid), AttributeValue::Rfc822(rfc) => fetch.rfc822 = rfc, AttributeValue::Rfc822Header(rfc) => fetch.rfc822_header = rfc, + AttributeValue::BodySection {section, index, data} => fetch.email = data, _ => {} } } diff --git a/src/types/fetch.rs b/src/types/fetch.rs index e882555..b598969 100644 --- a/src/types/fetch.rs +++ b/src/types/fetch.rs @@ -7,6 +7,7 @@ pub struct Fetch { pub uid: Option, pub(crate) rfc822_header: Option<&'static [u8]>, pub(crate) rfc822: Option<&'static [u8]>, + pub email: Option<&'static [u8]>, } impl Fetch { From e81f26e39dc5c2d2b12b8b59d1b68202cd691878 Mon Sep 17 00:00:00 2001 From: Shaun Savage Date: Thu, 28 Jun 2018 16:06:13 +0000 Subject: [PATCH 2/4] added accessor --- src/types/fetch.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/types/fetch.rs b/src/types/fetch.rs index b598969..67e3726 100644 --- a/src/types/fetch.rs +++ b/src/types/fetch.rs @@ -7,7 +7,7 @@ pub struct Fetch { pub uid: Option, pub(crate) rfc822_header: Option<&'static [u8]>, pub(crate) rfc822: Option<&'static [u8]>, - pub email: Option<&'static [u8]>, + pub(crate) email: Option<&'static [u8]>, } impl Fetch { @@ -22,4 +22,8 @@ impl Fetch { pub fn rfc822<'a>(&'a self) -> Option<&'a [u8]> { self.rfc822 } + + pub fn email<'a>(&'a self) -> Option<&'a [u8]> { + self.email + } } From 7fcb920bd75a15ab10a0c7c3099e011380800a5d Mon Sep 17 00:00:00 2001 From: Shaun Savage Date: Thu, 28 Jun 2018 16:09:35 +0000 Subject: [PATCH 3/4] fixed unused var warning --- src/parse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse.rs b/src/parse.rs index cc5cbe5..4aeb554 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -96,7 +96,7 @@ pub fn parse_fetches(lines: Vec) -> ZeroCopyResult> { AttributeValue::Uid(uid) => fetch.uid = Some(uid), AttributeValue::Rfc822(rfc) => fetch.rfc822 = rfc, AttributeValue::Rfc822Header(rfc) => fetch.rfc822_header = rfc, - AttributeValue::BodySection {section, index, data} => fetch.email = data, + AttributeValue::BodySection {section: _, index: _, data} => fetch.email = data, _ => {} } } From 4bdfe9691591d7d45ce72119817823a6f533d59b Mon Sep 17 00:00:00 2001 From: Shaun Savage Date: Thu, 28 Jun 2018 16:36:07 +0000 Subject: [PATCH 4/4] changed email to body --- src/parse.rs | 2 ++ src/types/fetch.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/parse.rs b/src/parse.rs index 43f36f7..3480723 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -84,6 +84,7 @@ pub fn parse_fetches(lines: Vec) -> ZeroCopyResult> { uid: None, rfc822_header: None, rfc822: None, + body: None, }; for attr in attrs { @@ -95,6 +96,7 @@ pub fn parse_fetches(lines: Vec) -> ZeroCopyResult> { AttributeValue::Uid(uid) => fetch.uid = Some(uid), AttributeValue::Rfc822(rfc) => fetch.rfc822 = rfc, AttributeValue::Rfc822Header(rfc) => fetch.rfc822_header = rfc, + AttributeValue::BodySection {section: _, index: _, data} => fetch.body = data, _ => {} } } diff --git a/src/types/fetch.rs b/src/types/fetch.rs index e882555..e04514a 100644 --- a/src/types/fetch.rs +++ b/src/types/fetch.rs @@ -7,6 +7,7 @@ pub struct Fetch { pub uid: Option, pub(crate) rfc822_header: Option<&'static [u8]>, pub(crate) rfc822: Option<&'static [u8]>, + pub(crate) body: Option<&'static [u8]>, } impl Fetch { @@ -21,4 +22,8 @@ impl Fetch { pub fn rfc822<'a>(&'a self) -> Option<&'a [u8]> { self.rfc822 } + + pub fn body<'a>(&'a self) -> Option<&'a [u8]> { + self.body + } }