aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command/anystate.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 08:17:03 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 08:17:03 +0100
commit1a43ce5ac7033c148f64a033f2b1d335e95e11d5 (patch)
tree60b234604170fe207248458a9c4cdd3f4b7c36f2 /src/imap/command/anystate.rs
parentbb9cb386b65834c44cae86bd100f800883022062 (diff)
downloadaerogramme-1a43ce5ac7033c148f64a033f2b1d335e95e11d5.tar.gz
aerogramme-1a43ce5ac7033c148f64a033f2b1d335e95e11d5.zip
WIP refactor
Diffstat (limited to 'src/imap/command/anystate.rs')
-rw-r--r--src/imap/command/anystate.rs54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/imap/command/anystate.rs b/src/imap/command/anystate.rs
deleted file mode 100644
index 718ba3f..0000000
--- a/src/imap/command/anystate.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use anyhow::Result;
-use imap_codec::imap_types::core::Tag;
-use imap_codec::imap_types::response::Data;
-
-use crate::imap::capability::ServerCapability;
-use crate::imap::flow;
-use crate::imap::response::Response;
-
-pub(crate) fn capability(
- tag: Tag<'static>,
- cap: &ServerCapability,
-) -> Result<(Response<'static>, flow::Transition)> {
- let res = Response::build()
- .tag(tag)
- .message("Server capabilities")
- .data(Data::Capability(cap.to_vec()))
- .ok()?;
-
- Ok((res, flow::Transition::None))
-}
-
-pub(crate) fn noop_nothing(tag: Tag<'static>) -> Result<(Response<'static>, flow::Transition)> {
- Ok((
- Response::build().tag(tag).message("Noop completed.").ok()?,
- flow::Transition::None,
- ))
-}
-
-pub(crate) fn logout() -> Result<(Response<'static>, flow::Transition)> {
- Ok((Response::bye()?, flow::Transition::Logout))
-}
-
-pub(crate) fn not_implemented<'a>(
- tag: Tag<'a>,
- what: &str,
-) -> Result<(Response<'a>, flow::Transition)> {
- Ok((
- Response::build()
- .tag(tag)
- .message(format!("Command not implemented {}", what))
- .bad()?,
- flow::Transition::None,
- ))
-}
-
-pub(crate) fn wrong_state(tag: Tag<'static>) -> Result<(Response<'static>, flow::Transition)> {
- Ok((
- Response::build()
- .tag(tag)
- .message("Command not authorized in this state")
- .bad()?,
- flow::Transition::None,
- ))
-}