aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/imap/command')
-rw-r--r--src/imap/command/anonymous.rs19
-rw-r--r--src/imap/command/authenticated.rs12
-rw-r--r--src/imap/command/examined.rs16
-rw-r--r--src/imap/command/selected.rs10
4 files changed, 28 insertions, 29 deletions
diff --git a/src/imap/command/anonymous.rs b/src/imap/command/anonymous.rs
index 6ba19cf..9f4563f 100644
--- a/src/imap/command/anonymous.rs
+++ b/src/imap/command/anonymous.rs
@@ -1,8 +1,7 @@
use anyhow::{Error, Result};
-use boitalettres::proto::{res::body::Data as Body, Request, Response};
-use imap_codec::types::command::CommandBody;
-use imap_codec::types::core::AString;
-use imap_codec::types::response::{Capability, Data, Status};
+use imap_codec::imap_types::command::{Command, CommandBody};
+use imap_codec::imap_types::core::AString;
+use imap_codec::imap_types::response::{Capability, Data, Status, CommandContinuationRequest};
use crate::imap::flow;
use crate::login::ArcLoginProvider;
@@ -11,12 +10,12 @@ use crate::mail::user::User;
//--- dispatching
pub struct AnonymousContext<'a> {
- pub req: &'a Request,
+ pub req: &'a Command<'static>,
pub login_provider: Option<&'a ArcLoginProvider>,
}
-pub async fn dispatch(ctx: AnonymousContext<'_>) -> Result<(Response, flow::Transition)> {
- match &ctx.req.command.body {
+pub async fn dispatch(ctx: AnonymousContext<'_>) -> Result<(Status, flow::Transition)> {
+ match &ctx.req.body {
CommandBody::Noop => Ok((Response::ok("Noop completed.")?, flow::Transition::None)),
CommandBody::Capability => ctx.capability().await,
CommandBody::Logout => ctx.logout().await,
@@ -31,7 +30,7 @@ pub async fn dispatch(ctx: AnonymousContext<'_>) -> Result<(Response, flow::Tran
//--- Command controllers, private
impl<'a> AnonymousContext<'a> {
- async fn capability(self) -> Result<(Response, flow::Transition)> {
+ async fn capability(self) -> Result<(Status, flow::Transition)> {
let capabilities = vec![Capability::Imap4Rev1, Capability::Idle];
let res = Response::ok("Server capabilities")?.with_body(Data::Capability(capabilities));
Ok((res, flow::Transition::None))
@@ -41,7 +40,7 @@ impl<'a> AnonymousContext<'a> {
self,
username: &AString,
password: &AString,
- ) -> Result<(Response, flow::Transition)> {
+ ) -> Result<(Status, flow::Transition)> {
let (u, p) = (
String::try_from(username.clone())?,
String::try_from(password.clone())?,
@@ -81,7 +80,7 @@ impl<'a> AnonymousContext<'a> {
// C: 10 logout
// S: * BYE Logging out
// S: 10 OK Logout completed.
- async fn logout(self) -> Result<(Response, flow::Transition)> {
+ async fn logout(self) -> Result<(Status, flow::Transition)> {
// @FIXME we should implement From<Vec<Status>> and From<Vec<ImapStatus>> in
// boitalettres/src/proto/res/body.rs
Ok((
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index 2deb723..fc58425 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -4,12 +4,12 @@ use std::sync::Arc;
use anyhow::{anyhow, bail, Result};
use boitalettres::proto::res::body::Data as Body;
use boitalettres::proto::{Request, Response};
-use imap_codec::types::command::{CommandBody, StatusAttribute};
-use imap_codec::types::core::NonZeroBytes;
-use imap_codec::types::datetime::MyDateTime;
-use imap_codec::types::flag::{Flag, FlagNameAttribute};
-use imap_codec::types::mailbox::{ListMailbox, Mailbox as MailboxCodec};
-use imap_codec::types::response::{Code, Data, StatusAttributeValue};
+use imap_codec::imap_types::command::{CommandBody, StatusAttribute};
+use imap_codec::imap_types::core::NonZeroBytes;
+use imap_codec::imap_types::datetime::MyDateTime;
+use imap_codec::imap_types::flag::{Flag, FlagNameAttribute};
+use imap_codec::imap_types::mailbox::{ListMailbox, Mailbox as MailboxCodec};
+use imap_codec::imap_types::response::{Code, Data, StatusAttributeValue};
use crate::imap::command::anonymous;
use crate::imap::flow;
diff --git a/src/imap/command/examined.rs b/src/imap/command/examined.rs
index 1740b39..8037d1d 100644
--- a/src/imap/command/examined.rs
+++ b/src/imap/command/examined.rs
@@ -3,14 +3,14 @@ use std::sync::Arc;
use anyhow::Result;
use boitalettres::proto::Request;
use boitalettres::proto::Response;
-use imap_codec::types::command::{CommandBody, SearchKey};
-use imap_codec::types::core::{Charset, NonZeroBytes};
-use imap_codec::types::datetime::MyDateTime;
-use imap_codec::types::fetch_attributes::MacroOrFetchAttributes;
-use imap_codec::types::flag::Flag;
-use imap_codec::types::mailbox::Mailbox as MailboxCodec;
-use imap_codec::types::response::Code;
-use imap_codec::types::sequence::SequenceSet;
+use imap_codec::imap_types::command::{CommandBody, SearchKey};
+use imap_codec::imap_types::core::{Charset, NonZeroBytes};
+use imap_codec::imap_types::datetime::MyDateTime;
+use imap_codec::imap_types::fetch_attributes::MacroOrFetchAttributes;
+use imap_codec::imap_types::flag::Flag;
+use imap_codec::imap_types::mailbox::Mailbox as MailboxCodec;
+use imap_codec::imap_types::response::Code;
+use imap_codec::imap_types::sequence::SequenceSet;
use crate::imap::command::authenticated;
use crate::imap::flow;
diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs
index 90a00ee..6bf068c 100644
--- a/src/imap/command/selected.rs
+++ b/src/imap/command/selected.rs
@@ -3,11 +3,11 @@ use std::sync::Arc;
use anyhow::Result;
use boitalettres::proto::Request;
use boitalettres::proto::Response;
-use imap_codec::types::command::CommandBody;
-use imap_codec::types::flag::{Flag, StoreResponse, StoreType};
-use imap_codec::types::mailbox::Mailbox as MailboxCodec;
-use imap_codec::types::response::Code;
-use imap_codec::types::sequence::SequenceSet;
+use imap_codec::imap_types::command::CommandBody;
+use imap_codec::imap_types::flag::{Flag, StoreResponse, StoreType};
+use imap_codec::imap_types::mailbox::Mailbox as MailboxCodec;
+use imap_codec::imap_types::response::Code;
+use imap_codec::imap_types::sequence::SequenceSet;
use crate::imap::command::examined;
use crate::imap::flow;