aboutsummaryrefslogtreecommitdiff
path: root/src/imap/session.rs
diff options
context:
space:
mode:
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,
};