Bump version for imap-proto fixes

- A `NIL` hierarchy delimiter in a `Name` is now properly parsed and exposed as `None`
 - `RFC822.TEXT` responses are now returned by `Fetch::text()`.
This commit is contained in:
Jon Gjengset 2018-12-07 16:34:55 -05:00
parent 21cb6f83fa
commit 67ee2f5175
No known key found for this signature in database
GPG key ID: D64AC9D67176DC71
4 changed files with 12 additions and 18 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "imap"
version = "0.9.5"
version = "0.10.0"
authors = ["Matt McCoy <mattnenterprise@yahoo.com>",
"Jon Gjengset <jon@thesquareplanet.com>"]
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"

View file

@ -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");
}

View file

@ -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()

View file

@ -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<NameAttribute<'static>>,
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
}