diff options
author | Quentin <quentin@dufour.io> | 2024-01-04 11:11:01 +0000 |
---|---|---|
committer | Quentin <quentin@dufour.io> | 2024-01-04 11:11:01 +0000 |
commit | bcf6de83419b405fea95b740869f98d43586ea7c (patch) | |
tree | 9f52832b90685913beda8f1bf19a22b2ec7bc6c6 /src/imap/session.rs | |
parent | b9a0c1e6eced036eb71e8221a4f236f72832fec2 (diff) | |
parent | 7ae9966675c85b34f1a99d81062b44b74385a15b (diff) | |
download | aerogramme-bcf6de83419b405fea95b740869f98d43586ea7c.tar.gz aerogramme-bcf6de83419b405fea95b740869f98d43586ea7c.zip |
Merge pull request 'Implement some IMAP extensions' (#50) from feat/more-ext into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/aerogramme/pulls/50
Diffstat (limited to 'src/imap/session.rs')
-rw-r--r-- | src/imap/session.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/imap/session.rs b/src/imap/session.rs index 5c67f8e..6b26478 100644 --- a/src/imap/session.rs +++ b/src/imap/session.rs @@ -1,3 +1,4 @@ +use crate::imap::capability::{ClientCapability, ServerCapability}; use crate::imap::command::{anonymous, authenticated, examined, selected}; use crate::imap::flow; use crate::imap::response::Response; @@ -7,13 +8,18 @@ use imap_codec::imap_types::command::Command; //----- pub struct Instance { pub login_provider: ArcLoginProvider, + pub server_capabilities: ServerCapability, + pub client_capabilities: ClientCapability, pub state: flow::State, } impl Instance { - pub fn new(login_provider: ArcLoginProvider) -> Self { + pub fn new(login_provider: ArcLoginProvider, cap: ServerCapability) -> Self { + let client_cap = ClientCapability::new(&cap); Self { login_provider, state: flow::State::NotAuthenticated, + server_capabilities: cap, + client_capabilities: client_cap, } } @@ -25,16 +31,24 @@ 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, + client_capabilities: &mut self.client_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, + client_capabilities: &mut self.client_capabilities, user, mailbox, }; @@ -43,6 +57,8 @@ impl Instance { flow::State::Examined(ref user, ref mut mailbox) => { let ctx = examined::ExaminedContext { req: &cmd, + server_capabilities: &self.server_capabilities, + client_capabilities: &mut self.client_capabilities, user, mailbox, }; |