commit
37ef477e4a
2 changed files with 19 additions and 2 deletions
11
src/parse.rs
11
src/parse.rs
|
|
@ -322,8 +322,15 @@ fn handle_unilateral<'a>(
|
||||||
Response::MailboxData(MailboxDatum::Recent(n)) => {
|
Response::MailboxData(MailboxDatum::Recent(n)) => {
|
||||||
unsolicited.send(UnsolicitedResponse::Recent(n)).unwrap();
|
unsolicited.send(UnsolicitedResponse::Recent(n)).unwrap();
|
||||||
}
|
}
|
||||||
Response::MailboxData(MailboxDatum::Flags(_)) => {
|
Response::MailboxData(MailboxDatum::Flags(flags)) => {
|
||||||
// TODO: next breaking change:
|
unsolicited
|
||||||
|
.send(UnsolicitedResponse::Flags(
|
||||||
|
flags
|
||||||
|
.into_iter()
|
||||||
|
.map(|s| Flag::from(s.to_string()))
|
||||||
|
.collect(),
|
||||||
|
))
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
Response::MailboxData(MailboxDatum::Exists(n)) => {
|
Response::MailboxData(MailboxDatum::Exists(n)) => {
|
||||||
unsolicited.send(UnsolicitedResponse::Exists(n)).unwrap();
|
unsolicited.send(UnsolicitedResponse::Exists(n)).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -226,6 +226,7 @@ pub use imap_proto::StatusAttribute;
|
||||||
/// Note that `Recent`, `Exists` and `Expunge` responses refer to the currently `SELECT`ed folder,
|
/// Note that `Recent`, `Exists` and `Expunge` responses refer to the currently `SELECT`ed folder,
|
||||||
/// so the user must take care when interpreting these.
|
/// so the user must take care when interpreting these.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum UnsolicitedResponse {
|
pub enum UnsolicitedResponse {
|
||||||
/// An unsolicited [`STATUS response`](https://tools.ietf.org/html/rfc3501#section-7.2.4).
|
/// An unsolicited [`STATUS response`](https://tools.ietf.org/html/rfc3501#section-7.2.4).
|
||||||
Status {
|
Status {
|
||||||
|
|
@ -277,6 +278,15 @@ pub enum UnsolicitedResponse {
|
||||||
/// sequence numbers 9, 8, 7, 6, and 5.
|
/// sequence numbers 9, 8, 7, 6, and 5.
|
||||||
// TODO: the spec doesn't seem to say anything about when these may be received as unsolicited?
|
// TODO: the spec doesn't seem to say anything about when these may be received as unsolicited?
|
||||||
Expunge(Seq),
|
Expunge(Seq),
|
||||||
|
|
||||||
|
/// An unsolicited [`FLAGS` response](https://tools.ietf.org/html/rfc3501#section-7.2.6) that
|
||||||
|
/// identifies the flags (at a minimum, the system-defined flags) that are applicable in the
|
||||||
|
/// mailbox. Flags other than the system flags can also exist, depending on server
|
||||||
|
/// implementation.
|
||||||
|
///
|
||||||
|
/// See [`Flag`] for details.
|
||||||
|
// TODO: the spec doesn't seem to say anything about when these may be received as unsolicited?
|
||||||
|
Flags(Vec<Flag<'static>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This type wraps an input stream and a type that was constructed by parsing that input stream,
|
/// This type wraps an input stream and a type that was constructed by parsing that input stream,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue