aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-30 14:02:57 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-30 14:03:12 +0200
commitb15026ec9ca2045f7ddb21a759cb075bb1dbd014 (patch)
tree3caab71bf46f299df407b447be46398967a3c68d /src/imap/command
parent89b588338700d13e34b50836cb790c0e0d588a28 (diff)
downloadaerogramme-b15026ec9ca2045f7ddb21a759cb075bb1dbd014.tar.gz
aerogramme-b15026ec9ca2045f7ddb21a759cb075bb1dbd014.zip
Refactor user to be shared using Arc
Diffstat (limited to 'src/imap/command')
-rw-r--r--src/imap/command/anonymous.rs2
-rw-r--r--src/imap/command/authenticated.rs4
-rw-r--r--src/imap/command/examined.rs4
-rw-r--r--src/imap/command/selected.rs4
4 files changed, 10 insertions, 4 deletions
diff --git a/src/imap/command/anonymous.rs b/src/imap/command/anonymous.rs
index b84b0da..3ac1f20 100644
--- a/src/imap/command/anonymous.rs
+++ b/src/imap/command/anonymous.rs
@@ -66,7 +66,7 @@ impl<'a> AnonymousContext<'a> {
Ok(c) => c,
};
- let user = User::new(u.clone(), creds)?;
+ let user = User::new(u.clone(), creds).await?;
tracing::info!(username=%u, "connected");
Ok((
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index dfcb52e..0b34223 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -1,3 +1,5 @@
+use std::sync::Arc;
+
use anyhow::Result;
use boitalettres::proto::{Request, Response};
use imap_codec::types::command::{CommandBody, StatusAttribute};
@@ -12,7 +14,7 @@ use crate::mail::user::User;
pub struct AuthenticatedContext<'a> {
pub req: &'a Request,
- pub user: &'a User,
+ pub user: &'a Arc<User>,
}
pub async fn dispatch<'a>(ctx: AuthenticatedContext<'a>) -> Result<(Response, flow::Transition)> {
diff --git a/src/imap/command/examined.rs b/src/imap/command/examined.rs
index aad7874..91ad950 100644
--- a/src/imap/command/examined.rs
+++ b/src/imap/command/examined.rs
@@ -1,3 +1,5 @@
+use std::sync::Arc;
+
use anyhow::Result;
use boitalettres::proto::Request;
use boitalettres::proto::Response;
@@ -15,7 +17,7 @@ use crate::mail::user::User;
pub struct ExaminedContext<'a> {
pub req: &'a Request,
- pub user: &'a User,
+ pub user: &'a Arc<User>,
pub mailbox: &'a mut MailboxView,
}
diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs
index a447a49..bb78cbd 100644
--- a/src/imap/command/selected.rs
+++ b/src/imap/command/selected.rs
@@ -1,3 +1,5 @@
+use std::sync::Arc;
+
use anyhow::Result;
use boitalettres::proto::Request;
use boitalettres::proto::Response;
@@ -16,7 +18,7 @@ use crate::mail::user::User;
pub struct SelectedContext<'a> {
pub req: &'a Request,
- pub user: &'a User,
+ pub user: &'a Arc<User>,
pub mailbox: &'a mut MailboxView,
}