aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command/anonymous.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-03 12:29:19 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-03 12:29:19 +0100
commit6d37924399dd5d04f5be2506e3e044dd165f6399 (patch)
tree9d6030ed892dbf2518bf5fea5bd323ce9cfed6e8 /src/imap/command/anonymous.rs
parenta059585cb423d527763ef0131773d6620ebcafd5 (diff)
downloadaerogramme-6d37924399dd5d04f5be2506e3e044dd165f6399.tar.gz
aerogramme-6d37924399dd5d04f5be2506e3e044dd165f6399.zip
rework capability
Diffstat (limited to 'src/imap/command/anonymous.rs')
-rw-r--r--src/imap/command/anonymous.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/imap/command/anonymous.rs b/src/imap/command/anonymous.rs
index fbd10e9..fda78c2 100644
--- a/src/imap/command/anonymous.rs
+++ b/src/imap/command/anonymous.rs
@@ -1,10 +1,12 @@
use anyhow::Result;
use imap_codec::imap_types::command::{Command, CommandBody};
use imap_codec::imap_types::core::AString;
+use imap_codec::imap_types::response::Code;
use imap_codec::imap_types::secret::Secret;
use crate::imap::command::anystate;
use crate::imap::flow;
+use crate::imap::capability::ServerCapability;
use crate::imap::response::Response;
use crate::login::ArcLoginProvider;
use crate::mail::user::User;
@@ -13,6 +15,7 @@ use crate::mail::user::User;
pub struct AnonymousContext<'a> {
pub req: &'a Command<'static>,
+ pub server_capabilities: &'a ServerCapability,
pub login_provider: &'a ArcLoginProvider,
}
@@ -20,7 +23,9 @@ pub async fn dispatch(ctx: AnonymousContext<'_>) -> Result<(Response<'static>, f
match &ctx.req.body {
// Any State
CommandBody::Noop => anystate::noop_nothing(ctx.req.tag.clone()),
- CommandBody::Capability => anystate::capability(ctx.req.tag.clone()),
+ CommandBody::Capability => anystate::capability(
+ ctx.req.tag.clone(),
+ ctx.server_capabilities),
CommandBody::Logout => anystate::logout(),
// Specific to anonymous context (3 commands)
@@ -69,6 +74,7 @@ impl<'a> AnonymousContext<'a> {
Ok((
Response::build()
.to_req(self.req)
+ .code(Code::Capability(self.server_capabilities.to_vec()))
.message("Completed")
.ok()?,
flow::Transition::Authenticate(user),