panorama/imap/src/proto/response.rs

49 lines
778 B
Rust
Raw Normal View History

2021-08-08 02:17:36 +00:00
use std::borrow::Cow;
2021-08-08 05:54:01 +00:00
#[derive(Clone, Debug)]
2021-08-08 02:17:36 +00:00
pub struct Tag(pub String);
2021-08-08 05:54:01 +00:00
#[derive(Debug)]
2021-08-08 19:31:18 +00:00
#[non_exhaustive]
2021-08-08 02:17:36 +00:00
pub enum Response<'a> {
Done(ResponseDone<'a>),
}
2021-08-08 05:54:01 +00:00
#[derive(Debug)]
2021-08-08 02:17:36 +00:00
pub struct ResponseDone<'a> {
pub tag: Tag,
pub status: Status,
pub code: Option<ResponseCode<'a>>,
pub info: Option<Cow<'a, str>>,
}
2021-08-08 19:31:18 +00:00
#[derive(Debug)]
pub struct Condition<'a> {
pub status: Status,
pub code: Option<ResponseCode<'a>>,
pub text: String,
}
2021-08-08 05:54:01 +00:00
#[derive(Debug)]
2021-08-08 02:17:36 +00:00
pub enum Status {
Ok,
No,
Bad,
PreAuth,
Bye,
}
2021-08-08 05:54:01 +00:00
#[derive(Debug)]
2021-08-08 19:31:18 +00:00
#[non_exhaustive]
2021-08-08 02:17:36 +00:00
pub enum ResponseCode<'a> {
2021-08-08 03:26:42 +00:00
Alert,
2021-08-08 02:17:36 +00:00
Capabilities(Vec<Capability<'a>>),
}
2021-08-08 05:54:01 +00:00
#[derive(Debug)]
2021-08-08 02:17:36 +00:00
pub enum Capability<'a> {
Imap4rev1,
2021-08-08 03:26:42 +00:00
Auth(Cow<'a, [u8]>),
Atom(Cow<'a, [u8]>),
2021-08-08 02:17:36 +00:00
}