aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-06-30 13:36:21 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-06-30 13:36:39 +0200
commit0f0a8d415e45df178778260d3be1b83ab2785675 (patch)
treed92d0dea55a7dafcbf85377163dfcbb889008a10 /src/imap/command
parent69428eaf257db396ae72007aa78d40406c29407c (diff)
downloadaerogramme-0f0a8d415e45df178778260d3be1b83ab2785675.tar.gz
aerogramme-0f0a8d415e45df178778260d3be1b83ab2785675.zip
Implement RFC822.TEXT
Diffstat (limited to 'src/imap/command')
-rw-r--r--src/imap/command/authenticated.rs17
-rw-r--r--src/imap/command/examined.rs4
-rw-r--r--src/imap/command/mod.rs2
-rw-r--r--src/imap/command/selected.rs22
4 files changed, 24 insertions, 21 deletions
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index 391b7ff..dfcb52e 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -19,7 +19,10 @@ pub async fn dispatch<'a>(ctx: AuthenticatedContext<'a>) -> Result<(Response, fl
match &ctx.req.command.body {
CommandBody::Create { mailbox } => ctx.create(mailbox).await,
CommandBody::Delete { mailbox } => ctx.delete(mailbox).await,
- CommandBody::Rename { mailbox, new_mailbox } => ctx.rename(mailbox, new_mailbox).await,
+ CommandBody::Rename {
+ mailbox,
+ new_mailbox,
+ } => ctx.rename(mailbox, new_mailbox).await,
CommandBody::Lsub {
reference,
mailbox_wildcard,
@@ -28,8 +31,10 @@ pub async fn dispatch<'a>(ctx: AuthenticatedContext<'a>) -> Result<(Response, fl
reference,
mailbox_wildcard,
} => ctx.list(reference, mailbox_wildcard).await,
- CommandBody::Status { mailbox, attributes } =>
- ctx.status(mailbox, attributes).await,
+ CommandBody::Status {
+ mailbox,
+ attributes,
+ } => ctx.status(mailbox, attributes).await,
CommandBody::Select { mailbox } => ctx.select(mailbox).await,
CommandBody::Examine { mailbox } => ctx.examine(mailbox).await,
_ => {
@@ -53,7 +58,11 @@ impl<'a> AuthenticatedContext<'a> {
Ok((Response::bad("Not implemented")?, flow::Transition::None))
}
- async fn rename(self, mailbox: &MailboxCodec, new_mailbox: &MailboxCodec) -> Result<(Response, flow::Transition)> {
+ async fn rename(
+ self,
+ mailbox: &MailboxCodec,
+ new_mailbox: &MailboxCodec,
+ ) -> Result<(Response, flow::Transition)> {
Ok((Response::bad("Not implemented")?, flow::Transition::None))
}
diff --git a/src/imap/command/examined.rs b/src/imap/command/examined.rs
index d459cf0..aad7874 100644
--- a/src/imap/command/examined.rs
+++ b/src/imap/command/examined.rs
@@ -48,9 +48,7 @@ pub async fn dispatch<'a>(ctx: ExaminedContext<'a>) -> Result<(Response, flow::T
// --- PRIVATE ---
impl<'a> ExaminedContext<'a> {
- async fn close(
- self,
- ) -> Result<(Response, flow::Transition)> {
+ async fn close(self) -> Result<(Response, flow::Transition)> {
Ok((Response::ok("CLOSE completed")?, flow::Transition::Unselect))
}
diff --git a/src/imap/command/mod.rs b/src/imap/command/mod.rs
index 559dddf..0b7e576 100644
--- a/src/imap/command/mod.rs
+++ b/src/imap/command/mod.rs
@@ -1,4 +1,4 @@
pub mod anonymous;
pub mod authenticated;
-pub mod selected;
pub mod examined;
+pub mod selected;
diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs
index b8598f5..a447a49 100644
--- a/src/imap/command/selected.rs
+++ b/src/imap/command/selected.rs
@@ -2,9 +2,9 @@ use anyhow::Result;
use boitalettres::proto::Request;
use boitalettres::proto::Response;
use imap_codec::types::command::CommandBody;
-use imap_codec::types::mailbox::{Mailbox as MailboxCodec};
-use imap_codec::types::flag::{Flag, StoreType, StoreResponse};
use imap_codec::types::fetch_attributes::MacroOrFetchAttributes;
+use imap_codec::types::flag::{Flag, StoreResponse, StoreType};
+use imap_codec::types::mailbox::Mailbox as MailboxCodec;
use imap_codec::types::sequence::SequenceSet;
@@ -27,11 +27,11 @@ pub async fn dispatch<'a>(ctx: SelectedContext<'a>) -> Result<(Response, flow::T
CommandBody::Close => ctx.close().await,
CommandBody::Expunge => ctx.expunge().await,
CommandBody::Store {
- sequence_set,
- kind,
- response,
- flags,
- uid
+ sequence_set,
+ kind,
+ response,
+ flags,
+ uid,
} => ctx.store(sequence_set, kind, response, flags, uid).await,
CommandBody::Copy {
sequence_set,
@@ -52,18 +52,14 @@ pub async fn dispatch<'a>(ctx: SelectedContext<'a>) -> Result<(Response, flow::T
// --- PRIVATE ---
impl<'a> SelectedContext<'a> {
- async fn close(
- self,
- ) -> Result<(Response, flow::Transition)> {
+ async fn close(self) -> Result<(Response, flow::Transition)> {
// We expunge messages,
// but we don't send the untagged EXPUNGE responses
self.expunge().await?;
Ok((Response::ok("CLOSE completed")?, flow::Transition::Unselect))
}
- async fn expunge(
- self,
- ) -> Result<(Response, flow::Transition)> {
+ async fn expunge(self) -> Result<(Response, flow::Transition)> {
Ok((Response::bad("Not implemented")?, flow::Transition::None))
}