aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-09 19:16:55 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-09 19:16:55 +0100
commit184328ebcf100496d8b6df0cc570c773a2203a2e (patch)
tree11170ed6cfb1c91cd3a8fa5cb3815d4e4978880d /src/imap/command
parent6e798b90f590e21bb68535f0431fc547e5e2390c (diff)
downloadaerogramme-184328ebcf100496d8b6df0cc570c773a2203a2e.tar.gz
aerogramme-184328ebcf100496d8b6df0cc570c773a2203a2e.zip
Optional Parameters with the SELECT/EXAMINE Commands
See: https://datatracker.ietf.org/doc/html/rfc4466#section-2.4
Diffstat (limited to 'src/imap/command')
-rw-r--r--src/imap/command/authenticated.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index 954e758..5af8e98 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -58,8 +58,8 @@ pub async fn dispatch<'a>(
} => ctx.status(mailbox, item_names).await,
CommandBody::Subscribe { mailbox } => ctx.subscribe(mailbox).await,
CommandBody::Unsubscribe { mailbox } => ctx.unsubscribe(mailbox).await,
- CommandBody::Select { mailbox } => ctx.select(mailbox).await,
- CommandBody::Examine { mailbox } => ctx.examine(mailbox).await,
+ CommandBody::Select { mailbox, parameters } => ctx.select(mailbox, parameters).await,
+ CommandBody::Examine { mailbox, parameters } => ctx.examine(mailbox, parameters).await,
CommandBody::Append {
mailbox,
flags,
@@ -421,7 +421,12 @@ impl<'a> AuthenticatedContext<'a> {
async fn select(
self,
mailbox: &MailboxCodec<'a>,
+ parameters: &Option<NonEmptyVec<Atom<'a>>>,
) -> Result<(Response<'static>, flow::Transition)> {
+ parameters.as_ref().map(|plist|
+ self.client_capabilities.select_enable(plist.as_ref())
+ );
+
let name: &str = MailboxName(mailbox).try_into()?;
let mb_opt = self.user.open_mailbox(&name).await?;
@@ -456,7 +461,12 @@ impl<'a> AuthenticatedContext<'a> {
async fn examine(
self,
mailbox: &MailboxCodec<'a>,
+ parameters: &Option<NonEmptyVec<Atom<'a>>>,
) -> Result<(Response<'static>, flow::Transition)> {
+ parameters.as_ref().map(|plist|
+ self.client_capabilities.select_enable(plist.as_ref())
+ );
+
let name: &str = MailboxName(mailbox).try_into()?;
let mb_opt = self.user.open_mailbox(&name).await?;