aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-02-22 17:30:40 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-02-22 17:30:40 +0100
commit2adf73dd8e6e76997d4fb67f9f7b3fe065530722 (patch)
treeeb8e82dda00db9a99c4f509d572f4dbd2ae1d541 /src/imap/command
parent3f204b102abb408a9f0b2adc45065585ddc16a88 (diff)
downloadaerogramme-2adf73dd8e6e76997d4fb67f9f7b3fe065530722.tar.gz
aerogramme-2adf73dd8e6e76997d4fb67f9f7b3fe065530722.zip
Update imap-flow, clean IDLE
Diffstat (limited to 'src/imap/command')
-rw-r--r--src/imap/command/authenticated.rs4
-rw-r--r--src/imap/command/selected.rs14
2 files changed, 5 insertions, 13 deletions
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index d2e7815..129c2fd 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -6,7 +6,7 @@ use anyhow::{anyhow, bail, Result};
use imap_codec::imap_types::command::{
Command, CommandBody, ListReturnItem, SelectExamineModifier,
};
-use imap_codec::imap_types::core::{Atom, Literal, NonEmptyVec, QuotedChar};
+use imap_codec::imap_types::core::{Atom, Literal, Vec1, QuotedChar};
use imap_codec::imap_types::datetime::DateTime;
use imap_codec::imap_types::extensions::enable::CapabilityEnable;
use imap_codec::imap_types::flag::{Flag, FlagNameAttribute};
@@ -584,7 +584,7 @@ impl<'a> AuthenticatedContext<'a> {
fn enable(
self,
- cap_enable: &NonEmptyVec<CapabilityEnable<'static>>,
+ cap_enable: &Vec1<CapabilityEnable<'static>>,
) -> Result<(Response<'static>, flow::Transition)> {
let mut response_builder = Response::build().to_req(self.req);
let capabilities = self.client_capabilities.try_enable(cap_enable.as_ref());
diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs
index 73f8aec..e871509 100644
--- a/src/imap/command/selected.rs
+++ b/src/imap/command/selected.rs
@@ -3,7 +3,7 @@ use std::sync::Arc;
use anyhow::Result;
use imap_codec::imap_types::command::{Command, CommandBody, FetchModifier, StoreModifier};
-use imap_codec::imap_types::core::Charset;
+use imap_codec::imap_types::core::{Vec1, Charset};
use imap_codec::imap_types::fetch::MacroOrMessageDataItemNames;
use imap_codec::imap_types::flag::{Flag, StoreResponse, StoreType};
use imap_codec::imap_types::mailbox::Mailbox as MailboxCodec;
@@ -54,11 +54,12 @@ pub async fn dispatch<'a>(
ctx.fetch(sequence_set, macro_or_item_names, modifiers, uid)
.await
}
+ //@FIXME SearchKey::And is a legacy hack, should be refactored
CommandBody::Search {
charset,
criteria,
uid,
- } => ctx.search(charset, criteria, uid).await,
+ } => ctx.search(charset, &SearchKey::And(criteria.clone()), uid).await,
CommandBody::Expunge {
// UIDPLUS (rfc4315)
uid_sequence_set,
@@ -88,15 +89,6 @@ pub async fn dispatch<'a>(
// UNSELECT extension (rfc3691)
CommandBody::Unselect => ctx.unselect().await,
- // IDLE extension (rfc2177)
- CommandBody::Idle => Ok((
- Response::build()
- .to_req(ctx.req)
- .message("DUMMY command due to anti-pattern in the code")
- .ok()?,
- flow::Transition::Idle(ctx.req.tag.clone(), tokio::sync::Notify::new()),
- )),
-
// In selected mode, we fallback to authenticated when needed
_ => {
authenticated::dispatch(authenticated::AuthenticatedContext {