aboutsummaryrefslogtreecommitdiff
path: root/src/imap/command
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-29 19:24:21 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-29 19:24:21 +0200
commit509e7e4bed3b011b5e0b276db3900edb9fee7255 (patch)
tree8bf760b1c367160ce4364f1485bc5598b78ec36b /src/imap/command
parenta8d0e4a994daca39f9619cddf2847c1a7820c040 (diff)
downloadaerogramme-509e7e4bed3b011b5e0b276db3900edb9fee7255.tar.gz
aerogramme-509e7e4bed3b011b5e0b276db3900edb9fee7255.zip
Implement beginning of a FETCH command
Diffstat (limited to 'src/imap/command')
-rw-r--r--src/imap/command/selected.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs
index 3a44a3f..e10eab6 100644
--- a/src/imap/command/selected.rs
+++ b/src/imap/command/selected.rs
@@ -42,17 +42,22 @@ pub async fn dispatch<'a>(ctx: SelectedContext<'a>) -> Result<(Response, flow::T
impl<'a> SelectedContext<'a> {
pub async fn fetch(
self,
- _sequence_set: &SequenceSet,
- _attributes: &MacroOrFetchAttributes,
- _uid: &bool,
+ sequence_set: &SequenceSet,
+ attributes: &MacroOrFetchAttributes,
+ uid: &bool,
) -> Result<(Response, flow::Transition)> {
- Ok((Response::bad("Not implemented")?, flow::Transition::None))
+ let resp = self.mailbox.fetch(sequence_set, attributes, uid).await?;
+
+ Ok((
+ Response::ok("FETCH completed")?.with_body(resp),
+ flow::Transition::None,
+ ))
}
pub async fn noop(self) -> Result<(Response, flow::Transition)> {
let updates = self.mailbox.update().await?;
Ok((
- Response::ok("Noop completed.")?.with_body(updates),
+ Response::ok("NOOP completed.")?.with_body(updates),
flow::Transition::None,
))
}