aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-03 20:53:25 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-03 20:53:25 +0100
commit8180baae0084faf76d49e6e03f8405487723c46f (patch)
treea48e372bacb5399b7a278474025daeb66efcb755
parenta6a0e1994db2b43f559e5c2e8ae5c58342e5136f (diff)
downloadaerogramme-8180baae0084faf76d49e6e03f8405487723c46f.tar.gz
aerogramme-8180baae0084faf76d49e6e03f8405487723c46f.zip
format code
-rw-r--r--src/imap/capability.rs9
-rw-r--r--src/imap/command/authenticated.rs17
2 files changed, 15 insertions, 11 deletions
diff --git a/src/imap/capability.rs b/src/imap/capability.rs
index 3929558..9a641a7 100644
--- a/src/imap/capability.rs
+++ b/src/imap/capability.rs
@@ -1,6 +1,6 @@
use imap_codec::imap_types::core::NonEmptyVec;
-use imap_codec::imap_types::response::Capability;
use imap_codec::imap_types::extensions::enable::{CapabilityEnable, Utf8Kind};
+use imap_codec::imap_types::response::Capability;
use std::collections::HashSet;
fn capability_unselect() -> Capability<'static> {
@@ -32,7 +32,12 @@ impl Default for ServerCapability {
impl ServerCapability {
pub fn to_vec(&self) -> NonEmptyVec<Capability<'static>> {
- self.0.iter().map(|v| v.clone()).collect::<Vec<_>>().try_into().unwrap()
+ self.0
+ .iter()
+ .map(|v| v.clone())
+ .collect::<Vec<_>>()
+ .try_into()
+ .unwrap()
}
#[allow(dead_code)]
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index ee7c8f3..1481a80 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -3,13 +3,13 @@ use std::sync::Arc;
use anyhow::{anyhow, bail, Result};
use imap_codec::imap_types::command::{Command, CommandBody};
-use imap_codec::imap_types::core::{Atom, Literal, QuotedChar, NonEmptyVec};
+use imap_codec::imap_types::core::{Atom, Literal, NonEmptyVec, QuotedChar};
use imap_codec::imap_types::datetime::DateTime;
+use imap_codec::imap_types::extensions::enable::CapabilityEnable;
use imap_codec::imap_types::flag::{Flag, FlagNameAttribute};
use imap_codec::imap_types::mailbox::{ListMailbox, Mailbox as MailboxCodec};
use imap_codec::imap_types::response::{Code, CodeOther, Data};
use imap_codec::imap_types::status::{StatusDataItem, StatusDataItemName};
-use imap_codec::imap_types::extensions::enable::CapabilityEnable;
use crate::imap::capability::{ClientCapability, ServerCapability};
use crate::imap::command::{anystate, MailboxName};
@@ -68,9 +68,7 @@ pub async fn dispatch<'a>(
} => ctx.append(mailbox, flags, date, message).await,
// rfc5161 ENABLE
- CommandBody::Enable { capabilities } => {
- ctx.enable(capabilities)
- },
+ CommandBody::Enable { capabilities } => ctx.enable(capabilities),
// Collect other commands
_ => anystate::wrong_state(ctx.req.tag.clone()),
@@ -518,16 +516,17 @@ impl<'a> AuthenticatedContext<'a> {
}
}
- fn enable(self, cap_enable: &NonEmptyVec<CapabilityEnable<'static>>) -> Result<(Response<'static>, flow::Transition)> {
+ fn enable(
+ self,
+ cap_enable: &NonEmptyVec<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());
if capabilities.len() > 0 {
response_builder = response_builder.data(Data::Enabled { capabilities });
}
Ok((
- response_builder
- .message("ENABLE completed")
- .ok()?,
+ response_builder.message("ENABLE completed").ok()?,
flow::Transition::None,
))
}