aboutsummaryrefslogtreecommitdiff
path: root/src/imap/session.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/session.rs
parenta059585cb423d527763ef0131773d6620ebcafd5 (diff)
downloadaerogramme-6d37924399dd5d04f5be2506e3e044dd165f6399.tar.gz
aerogramme-6d37924399dd5d04f5be2506e3e044dd165f6399.zip
rework capability
Diffstat (limited to 'src/imap/session.rs')
-rw-r--r--src/imap/session.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/imap/session.rs b/src/imap/session.rs
index 5c67f8e..c4f062f 100644
--- a/src/imap/session.rs
+++ b/src/imap/session.rs
@@ -1,19 +1,22 @@
use crate::imap::command::{anonymous, authenticated, examined, selected};
use crate::imap::flow;
use crate::imap::response::Response;
+use crate::imap::capability::ServerCapability;
use crate::login::ArcLoginProvider;
use imap_codec::imap_types::command::Command;
//-----
pub struct Instance {
pub login_provider: ArcLoginProvider,
+ pub server_capabilities: ServerCapability,
pub state: flow::State,
}
impl Instance {
- pub fn new(login_provider: ArcLoginProvider) -> Self {
+ pub fn new(login_provider: ArcLoginProvider, cap: ServerCapability) -> Self {
Self {
login_provider,
state: flow::State::NotAuthenticated,
+ server_capabilities: cap,
}
}
@@ -25,16 +28,21 @@ impl Instance {
let ctx = anonymous::AnonymousContext {
req: &cmd,
login_provider: &self.login_provider,
+ server_capabilities: &self.server_capabilities,
};
anonymous::dispatch(ctx).await
}
flow::State::Authenticated(ref user) => {
- let ctx = authenticated::AuthenticatedContext { req: &cmd, user };
+ let ctx = authenticated::AuthenticatedContext {
+ req: &cmd,
+ server_capabilities: &self.server_capabilities,
+ user };
authenticated::dispatch(ctx).await
}
flow::State::Selected(ref user, ref mut mailbox) => {
let ctx = selected::SelectedContext {
req: &cmd,
+ server_capabilities: &self.server_capabilities,
user,
mailbox,
};
@@ -43,6 +51,7 @@ impl Instance {
flow::State::Examined(ref user, ref mut mailbox) => {
let ctx = examined::ExaminedContext {
req: &cmd,
+ server_capabilities: &self.server_capabilities,
user,
mailbox,
};