diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-06-22 14:58:57 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-06-22 14:59:32 +0200 |
commit | 98f55be7304ef1078960408ff4435109601c0206 (patch) | |
tree | e06c089fb2da88d8901649c0a5379ff9a3f043ed /src/imap/command/authenticated.rs | |
parent | c04b16a601c180c768cee805363ae0c6985d767a (diff) | |
download | aerogramme-98f55be7304ef1078960408ff4435109601c0206.tar.gz aerogramme-98f55be7304ef1078960408ff4435109601c0206.zip |
It compiles again!
Diffstat (limited to 'src/imap/command/authenticated.rs')
-rw-r--r-- | src/imap/command/authenticated.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs index 49bfa9c..093521a 100644 --- a/src/imap/command/authenticated.rs +++ b/src/imap/command/authenticated.rs @@ -11,21 +11,22 @@ use crate::imap::session::InnerContext; use crate::imap::flow::User; use crate::mailbox::Mailbox; -pub async fn dispatch<'a>(inner: &'a InnerContext<'a>, user: &'a User) -> Result<Response> { +/*pub async fn dispatch<'a>(inner: &'a mut InnerContext<'a>, user: &'a User) -> Result<Response> { let ctx = StateContext { inner, user, tag: &inner.req.tag }; - match ctx.req.body.as_ref() { - 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, + 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, _ => anonymous::dispatch(ctx.inner).await, } -} +}*/ // --- PRIVATE --- +/* struct StateContext<'a> { - inner: InnerContext<'a>, + inner: &'a mut InnerContext<'a>, user: &'a User, tag: &'a Tag, } @@ -70,7 +71,7 @@ impl<'a> StateContext<'a> { async fn select(&self, mailbox: MailboxCodec) -> Result<Response> { let name = String::try_from(mailbox)?; - let mut mb = Mailbox::new(self.user.creds, name.clone())?; + let mut mb = Mailbox::new(&self.user.creds, name.clone())?; tracing::info!(username=%self.user.name, mailbox=%name, "mailbox.selected"); let sum = mb.summary().await?; @@ -80,7 +81,7 @@ impl<'a> StateContext<'a> { self.inner.state.select(mb)?; - let r_unseen = Status::ok(None, Some(Code::Unseen(0)), "").map_err(Error::msg)?; + let r_unseen = Status::ok(None, Some(Code::Unseen(std::num::NonZeroU32::new(1)?)), "").map_err(Error::msg)?; //let r_permanentflags = Status::ok(None, Some(Code:: Ok(vec![ @@ -99,3 +100,4 @@ impl<'a> StateContext<'a> { ]) } } +*/ |