d
This commit is contained in:
parent
b75df0b8d6
commit
206b9750e0
8 changed files with 28 additions and 12 deletions
|
@ -18,8 +18,10 @@ path = "bin/mzhang_test.rs"
|
||||||
required-features = ["stderrlog"]
|
required-features = ["stderrlog"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rfc2177-idle"]
|
default = ["rfc2177", "rfc6154"]
|
||||||
rfc2177-idle = []
|
rfc2087 = [] # quota
|
||||||
|
rfc2177 = [] # idle
|
||||||
|
rfc6154 = [] # list
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.42"
|
anyhow = "1.0.42"
|
||||||
|
|
|
@ -214,8 +214,8 @@ impl ClientAuthenticated {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the IDLE command
|
/// Runs the IDLE command
|
||||||
#[cfg(feature = "rfc2177-idle")]
|
#[cfg(feature = "rfc2177")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
|
||||||
pub async fn idle(&mut self) -> Result<IdleToken> {
|
pub async fn idle(&mut self) -> Result<IdleToken> {
|
||||||
let cmd = Command::Idle;
|
let cmd = Command::Idle;
|
||||||
let stream = self.execute(cmd).await?;
|
let stream = self.execute(cmd).await?;
|
||||||
|
@ -238,15 +238,15 @@ pub struct SelectResponse {
|
||||||
///
|
///
|
||||||
/// Dropping this token indicates that the idling should be completed, and the
|
/// Dropping this token indicates that the idling should be completed, and the
|
||||||
/// DONE command will be sent to the server as a result.
|
/// DONE command will be sent to the server as a result.
|
||||||
#[cfg(feature = "rfc2177-idle")]
|
#[cfg(feature = "rfc2177")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
|
||||||
pub struct IdleToken {
|
pub struct IdleToken {
|
||||||
pub stream: ResponseStream,
|
pub stream: ResponseStream,
|
||||||
sender: mpsc::UnboundedSender<String>,
|
sender: mpsc::UnboundedSender<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "rfc2177-idle")]
|
#[cfg(feature = "rfc2177")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
|
||||||
impl Drop for IdleToken {
|
impl Drop for IdleToken {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
// TODO: should ignore this?
|
// TODO: should ignore this?
|
||||||
|
@ -254,8 +254,8 @@ impl Drop for IdleToken {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "rfc2177-idle")]
|
#[cfg(feature = "rfc2177")]
|
||||||
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177-idle")))]
|
#[cfg_attr(docsrs, doc(cfg(feature = "rfc2177")))]
|
||||||
impl Stream for IdleToken {
|
impl Stream for IdleToken {
|
||||||
type Item = Response;
|
type Item = Response;
|
||||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
|
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
|
||||||
|
|
|
@ -39,7 +39,7 @@ pub enum Command {
|
||||||
UidSearch(CommandSearch),
|
UidSearch(CommandSearch),
|
||||||
|
|
||||||
// Extensions
|
// Extensions
|
||||||
#[cfg(feature = "rfc2177-idle")]
|
#[cfg(feature = "rfc2177")]
|
||||||
Idle,
|
Idle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ pub mod response;
|
||||||
// parsers
|
// parsers
|
||||||
pub mod rfc2234;
|
pub mod rfc2234;
|
||||||
pub mod rfc3501;
|
pub mod rfc3501;
|
||||||
|
pub mod rfc6154;
|
||||||
|
|
||||||
#[cfg(feature = "rfc2177-idle")]
|
#[cfg(feature = "rfc2177")]
|
||||||
pub mod rfc2177;
|
pub mod rfc2177;
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
|
//! IMAP `IDLE` Command
|
||||||
|
//! ---
|
||||||
|
//!
|
||||||
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc2177#section-4>
|
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc2177#section-4>
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
//! ABNF Core Rules
|
||||||
|
//! ---
|
||||||
|
//!
|
||||||
//! Grammar from <https://tools.ietf.org/html/rfc2234#section-6.1>
|
//! Grammar from <https://tools.ietf.org/html/rfc2234#section-6.1>
|
||||||
|
|
||||||
use nom::{branch::alt, multi::many0, sequence::pair};
|
use nom::{branch::alt, multi::many0, sequence::pair};
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
//! IMAP Specification
|
||||||
|
//! ---
|
||||||
|
//!
|
||||||
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc3501#section-9>
|
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc3501#section-9>
|
||||||
|
|
||||||
use nom::{
|
use nom::{
|
||||||
|
|
4
imap/src/proto/rfc6154.rs
Normal file
4
imap/src/proto/rfc6154.rs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
//! IMAP `LIST` Extension
|
||||||
|
//! ---
|
||||||
|
//!
|
||||||
|
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc6154#section-6>
|
Loading…
Reference in a new issue