aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command/authenticated.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-06-22 17:25:04 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-06-22 17:25:04 +0200
commitac974184def76fefba6c36c5c9e0ff0298f860ff (patch)
tree2df5bdce347e0fc410a48d0c6f1dbdd49e29608b /src/imap/command/authenticated.rs
parent50b19729878938b63ea33d4dbdcfd254b4462110 (diff)
downloadaerogramme-ac974184def76fefba6c36c5c9e0ff0298f860ff.tar.gz
aerogramme-ac974184def76fefba6c36c5c9e0ff0298f860ff.zip
Refactor selected
Diffstat (limited to 'src/imap/command/authenticated.rs')
-rw-r--r--src/imap/command/authenticated.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index 5ac3092..b4c4432 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -15,9 +15,9 @@ pub async fn dispatch<'a>(inner: InnerContext<'a>, user: &'a flow::User) -> Resu
let ctx = StateContext { user, tag: &inner.req.tag, inner };
match &ctx.inner.req.body {
- CommandBody::Lsub { reference, mailbox_wildcard, } => ctx.lsub(reference.clone(), mailbox_wildcard.clone()).await,
- CommandBody::List { reference, mailbox_wildcard, } => ctx.list(reference.clone(), mailbox_wildcard.clone()).await,
- CommandBody::Select { mailbox } => ctx.select(mailbox.clone()).await,
+ CommandBody::Lsub { reference, mailbox_wildcard, } => ctx.lsub(reference, mailbox_wildcard).await,
+ CommandBody::List { reference, mailbox_wildcard, } => ctx.list(reference, mailbox_wildcard).await,
+ CommandBody::Select { mailbox } => ctx.select(mailbox).await,
_ => anonymous::dispatch(ctx.inner).await,
}
}
@@ -34,8 +34,8 @@ struct StateContext<'a> {
impl<'a> StateContext<'a> {
async fn lsub(
&self,
- reference: MailboxCodec,
- mailbox_wildcard: ListMailbox,
+ reference: &MailboxCodec,
+ mailbox_wildcard: &ListMailbox,
) -> Result<(Response, flow::Transition)> {
Ok((vec![ImapRes::Status(
Status::bad(Some(self.tag.clone()), None, "Not implemented").map_err(Error::msg)?,
@@ -44,8 +44,8 @@ impl<'a> StateContext<'a> {
async fn list(
&self,
- reference: MailboxCodec,
- mailbox_wildcard: ListMailbox,
+ reference: &MailboxCodec,
+ mailbox_wildcard: &ListMailbox,
) -> Result<(Response, flow::Transition)> {
Ok((vec![
ImapRes::Status(Status::bad(Some(self.tag.clone()), None, "Not implemented").map_err(Error::msg)?),
@@ -68,8 +68,8 @@ impl<'a> StateContext<'a> {
* TRACE END ---
*/
- async fn select(&self, mailbox: MailboxCodec) -> Result<(Response, flow::Transition)> {
- let name = String::try_from(mailbox)?;
+ async fn select(&self, mailbox: &MailboxCodec) -> Result<(Response, flow::Transition)> {
+ let name = String::try_from(mailbox.clone())?;
let mut mb = Mailbox::new(&self.user.creds, name.clone())?;
tracing::info!(username=%self.user.name, mailbox=%name, "mailbox.selected");