diff options
Diffstat (limited to 'src/imap/command/anonymous.rs')
-rw-r--r-- | src/imap/command/anonymous.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/imap/command/anonymous.rs b/src/imap/command/anonymous.rs index fbd10e9..0582b06 100644 --- a/src/imap/command/anonymous.rs +++ b/src/imap/command/anonymous.rs @@ -1,8 +1,10 @@ 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::capability::ServerCapability; use crate::imap::command::anystate; use crate::imap::flow; use crate::imap::response::Response; @@ -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), |