diff options
Diffstat (limited to 'src/imap/command/selected.rs')
-rw-r--r-- | src/imap/command/selected.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs index 93592c1..a068fab 100644 --- a/src/imap/command/selected.rs +++ b/src/imap/command/selected.rs @@ -9,26 +9,25 @@ use imap_codec::types::sequence::SequenceSet; use crate::imap::command::authenticated; use crate::imap::session::InnerContext; -use crate::imap::flow::User; +use crate::imap::flow; use crate::mailbox::Mailbox; -/* -pub async fn dispatch<'a>(inner: InnerContext<'a>, user: &'a User, mailbox: &'a Mailbox) -> Result<Response> { - let ctx = StateContext { inner, user, mailbox, tag: &inner.req.tag }; - match ctx.inner.req.body { +pub async fn dispatch<'a>(inner: InnerContext<'a>, user: &'a flow::User, mailbox: &'a Mailbox) -> Result<(Response, flow::Transition)> { + let ctx = StateContext { tag: &inner.req.tag, inner, user, mailbox }; + + match &ctx.inner.req.body { CommandBody::Fetch { sequence_set, attributes, uid, } => ctx.fetch(sequence_set, attributes, uid).await, - _ => authenticated::dispatch(inner, user).await, + _ => authenticated::dispatch(ctx.inner, user).await, } } -*/ + // --- PRIVATE --- -/* struct StateContext<'a> { inner: InnerContext<'a>, - user: &'a User, + user: &'a flow::User, mailbox: &'a Mailbox, tag: &'a Tag, } @@ -37,13 +36,12 @@ struct StateContext<'a> { impl<'a> StateContext<'a> { pub async fn fetch( &self, - sequence_set: SequenceSet, - attributes: MacroOrFetchAttributes, - uid: bool, - ) -> Result<Response> { - Ok(vec![ + sequence_set: &SequenceSet, + attributes: &MacroOrFetchAttributes, + uid: &bool, + ) -> Result<(Response, flow::Transition)> { + Ok((vec![ ImapRes::Status(Status::bad(Some(self.tag.clone()), None, "Not implemented").map_err(Error::msg)?), - ]) + ], flow::Transition::No)) } } -*/ |