diff --git a/Cargo.toml b/Cargo.toml index dbb0c98..7998d82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "imap" -version = "0.9.5" +version = "0.10.0" authors = ["Matt McCoy ", "Jon Gjengset "] documentation = "https://docs.rs/imap/" @@ -29,7 +29,7 @@ path = "src/lib.rs" native-tls = "0.2.2" regex = "1.0" bufstream = "0.1" -imap-proto = "0.6" +imap-proto = "0.7" nom = "4.0" base64 = "0.10" diff --git a/src/parse.rs b/src/parse.rs index 3266d75..9161898 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -96,11 +96,6 @@ pub fn parse_names( flags, delimiter, name, - }) - | Response::MailboxData(MailboxDatum::SubList { - flags, - delimiter, - name, }) => Ok(MapOrNot::Map(Name { attributes: flags.into_iter().map(NameAttribute::from).collect(), delimiter, @@ -270,7 +265,7 @@ pub fn parse_mailbox( .flags .extend(flags.into_iter().map(String::from).map(Flag::from)); } - MailboxDatum::SubList { .. } | MailboxDatum::List { .. } => {} + MailboxDatum::List { .. } => {} } } Ok((rest, Response::Expunge(n))) => { @@ -377,7 +372,7 @@ mod tests { names[0].attributes(), &[NameAttribute::from("\\HasNoChildren")] ); - assert_eq!(names[0].delimiter(), "."); + assert_eq!(names[0].delimiter(), Some(".")); assert_eq!(names[0].name(), "INBOX"); } @@ -440,7 +435,7 @@ mod tests { names[0].attributes(), &[NameAttribute::from("\\HasNoChildren")] ); - assert_eq!(names[0].delimiter(), "."); + assert_eq!(names[0].delimiter(), Some(".")); assert_eq!(names[0].name(), "INBOX"); } diff --git a/src/types/fetch.rs b/src/types/fetch.rs index 6140c62..ac07e7b 100644 --- a/src/types/fetch.rs +++ b/src/types/fetch.rs @@ -66,12 +66,11 @@ impl Fetch { .next() } - /// The bytes that make up the text of this message, included if `BODY[TEXT]` or - /// `BODY.PEEK[TEXT]` was included in the `query` argument to `FETCH`. The bytes SHOULD be + /// The bytes that make up the text of this message, included if `BODY[TEXT]`, `RFC822.TEXT`, + /// or `BODY.PEEK[TEXT]` was included in the `query` argument to `FETCH`. The bytes SHOULD be /// interpreted by the client according to the content transfer encoding, body type, and /// subtype. pub fn text(&self) -> Option<&[u8]> { - // TODO: https://github.com/djc/tokio-imap/issues/32 self.fetch .iter() .filter_map(|av| match av { @@ -79,7 +78,8 @@ impl Fetch { section: Some(SectionPath::Full(MessageSection::Text)), data: Some(body), .. - } => Some(*body), + } + | AttributeValue::Rfc822Text(Some(body)) => Some(*body), _ => None, }) .next() diff --git a/src/types/name.rs b/src/types/name.rs index 51d2101..b80d3ef 100644 --- a/src/types/name.rs +++ b/src/types/name.rs @@ -6,7 +6,7 @@ pub struct Name { // Note that none of these fields are *actually* 'static. // Rather, they are tied to the lifetime of the `ZeroCopy` that contains this `Name`. pub(crate) attributes: Vec>, - pub(crate) delimiter: &'static str, + pub(crate) delimiter: Option<&'static str>, pub(crate) name: &'static str, } @@ -75,9 +75,8 @@ impl Name { /// The hierarchy delimiter is a character used to delimit levels of hierarchy in a mailbox /// name. A client can use it to create child mailboxes, and to search higher or lower levels /// of naming hierarchy. All children of a top-level hierarchy node use the same - /// separator character. A NIL hierarchy delimiter means that no hierarchy exists; the name is - /// a "flat" name. - pub fn delimiter(&self) -> &str { + /// separator character. `None` means that no hierarchy exists; the name is a "flat" name. + pub fn delimiter(&self) -> Option<&str> { self.delimiter }