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:
parent
21cb6f83fa
commit
67ee2f5175
4 changed files with 12 additions and 18 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "imap"
|
name = "imap"
|
||||||
version = "0.9.5"
|
version = "0.10.0"
|
||||||
authors = ["Matt McCoy <mattnenterprise@yahoo.com>",
|
authors = ["Matt McCoy <mattnenterprise@yahoo.com>",
|
||||||
"Jon Gjengset <jon@thesquareplanet.com>"]
|
"Jon Gjengset <jon@thesquareplanet.com>"]
|
||||||
documentation = "https://docs.rs/imap/"
|
documentation = "https://docs.rs/imap/"
|
||||||
|
|
@ -29,7 +29,7 @@ path = "src/lib.rs"
|
||||||
native-tls = "0.2.2"
|
native-tls = "0.2.2"
|
||||||
regex = "1.0"
|
regex = "1.0"
|
||||||
bufstream = "0.1"
|
bufstream = "0.1"
|
||||||
imap-proto = "0.6"
|
imap-proto = "0.7"
|
||||||
nom = "4.0"
|
nom = "4.0"
|
||||||
base64 = "0.10"
|
base64 = "0.10"
|
||||||
|
|
||||||
|
|
|
||||||
11
src/parse.rs
11
src/parse.rs
|
|
@ -96,11 +96,6 @@ pub fn parse_names(
|
||||||
flags,
|
flags,
|
||||||
delimiter,
|
delimiter,
|
||||||
name,
|
name,
|
||||||
})
|
|
||||||
| Response::MailboxData(MailboxDatum::SubList {
|
|
||||||
flags,
|
|
||||||
delimiter,
|
|
||||||
name,
|
|
||||||
}) => Ok(MapOrNot::Map(Name {
|
}) => Ok(MapOrNot::Map(Name {
|
||||||
attributes: flags.into_iter().map(NameAttribute::from).collect(),
|
attributes: flags.into_iter().map(NameAttribute::from).collect(),
|
||||||
delimiter,
|
delimiter,
|
||||||
|
|
@ -270,7 +265,7 @@ pub fn parse_mailbox(
|
||||||
.flags
|
.flags
|
||||||
.extend(flags.into_iter().map(String::from).map(Flag::from));
|
.extend(flags.into_iter().map(String::from).map(Flag::from));
|
||||||
}
|
}
|
||||||
MailboxDatum::SubList { .. } | MailboxDatum::List { .. } => {}
|
MailboxDatum::List { .. } => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok((rest, Response::Expunge(n))) => {
|
Ok((rest, Response::Expunge(n))) => {
|
||||||
|
|
@ -377,7 +372,7 @@ mod tests {
|
||||||
names[0].attributes(),
|
names[0].attributes(),
|
||||||
&[NameAttribute::from("\\HasNoChildren")]
|
&[NameAttribute::from("\\HasNoChildren")]
|
||||||
);
|
);
|
||||||
assert_eq!(names[0].delimiter(), ".");
|
assert_eq!(names[0].delimiter(), Some("."));
|
||||||
assert_eq!(names[0].name(), "INBOX");
|
assert_eq!(names[0].name(), "INBOX");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -440,7 +435,7 @@ mod tests {
|
||||||
names[0].attributes(),
|
names[0].attributes(),
|
||||||
&[NameAttribute::from("\\HasNoChildren")]
|
&[NameAttribute::from("\\HasNoChildren")]
|
||||||
);
|
);
|
||||||
assert_eq!(names[0].delimiter(), ".");
|
assert_eq!(names[0].delimiter(), Some("."));
|
||||||
assert_eq!(names[0].name(), "INBOX");
|
assert_eq!(names[0].name(), "INBOX");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,11 @@ impl Fetch {
|
||||||
.next()
|
.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The bytes that make up the text of this message, included if `BODY[TEXT]` or
|
/// The bytes that make up the text of this message, included if `BODY[TEXT]`, `RFC822.TEXT`,
|
||||||
/// `BODY.PEEK[TEXT]` was included in the `query` argument to `FETCH`. The bytes SHOULD be
|
/// 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
|
/// interpreted by the client according to the content transfer encoding, body type, and
|
||||||
/// subtype.
|
/// subtype.
|
||||||
pub fn text(&self) -> Option<&[u8]> {
|
pub fn text(&self) -> Option<&[u8]> {
|
||||||
// TODO: https://github.com/djc/tokio-imap/issues/32
|
|
||||||
self.fetch
|
self.fetch
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|av| match av {
|
.filter_map(|av| match av {
|
||||||
|
|
@ -79,7 +78,8 @@ impl Fetch {
|
||||||
section: Some(SectionPath::Full(MessageSection::Text)),
|
section: Some(SectionPath::Full(MessageSection::Text)),
|
||||||
data: Some(body),
|
data: Some(body),
|
||||||
..
|
..
|
||||||
} => Some(*body),
|
}
|
||||||
|
| AttributeValue::Rfc822Text(Some(body)) => Some(*body),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.next()
|
.next()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ pub struct Name {
|
||||||
// Note that none of these fields are *actually* 'static.
|
// Note that none of these fields are *actually* 'static.
|
||||||
// Rather, they are tied to the lifetime of the `ZeroCopy` that contains this `Name`.
|
// Rather, they are tied to the lifetime of the `ZeroCopy` that contains this `Name`.
|
||||||
pub(crate) attributes: Vec<NameAttribute<'static>>,
|
pub(crate) attributes: Vec<NameAttribute<'static>>,
|
||||||
pub(crate) delimiter: &'static str,
|
pub(crate) delimiter: Option<&'static str>,
|
||||||
pub(crate) name: &'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
|
/// 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
|
/// 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
|
/// 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
|
/// separator character. `None` means that no hierarchy exists; the name is a "flat" name.
|
||||||
/// a "flat" name.
|
pub fn delimiter(&self) -> Option<&str> {
|
||||||
pub fn delimiter(&self) -> &str {
|
|
||||||
self.delimiter
|
self.delimiter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue