aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-02-20 13:24:42 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-02-20 13:24:42 +0100
commit64b474f682a3c519ca1bda279132273a53ca2115 (patch)
tree2a59f788090bdc007db4c3393335eb77fcea417e
parent28b1f4f14dffc5dcd5152ce931f6c50b17c134db (diff)
downloadaerogramme-64b474f682a3c519ca1bda279132273a53ca2115.tar.gz
aerogramme-64b474f682a3c519ca1bda279132273a53ca2115.zip
Unsollicited response on APPEND was wrong, upgrade imap-flow to fix LITERAL+
-rw-r--r--Cargo.lock6
-rw-r--r--src/imap/command/authenticated.rs11
-rw-r--r--src/imap/mod.rs12
3 files changed, 16 insertions, 13 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c37165a..50e7b02 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1869,7 +1869,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite 0.2.13",
- "socket2 0.5.5",
+ "socket2 0.4.10",
"tokio",
"tower-service",
"tracing",
@@ -1980,13 +1980,15 @@ dependencies = [
[[package]]
name = "imap-flow"
version = "0.1.0"
-source = "git+https://github.com/superboum/imap-flow.git?branch=custom/aerogramme#60ff9e082ccfcd10a042b616d8038a578fa0c8ff"
+source = "git+https://github.com/superboum/imap-flow.git?branch=custom/aerogramme#2bea066da1e09ad04bb5fb71b0dd8d6e5d9e3d19"
dependencies = [
"bounded-static",
"bytes",
"imap-codec",
+ "imap-types",
"thiserror",
"tokio",
+ "tracing",
]
[[package]]
diff --git a/src/imap/command/authenticated.rs b/src/imap/command/authenticated.rs
index baf3033..d2e7815 100644
--- a/src/imap/command/authenticated.rs
+++ b/src/imap/command/authenticated.rs
@@ -549,6 +549,8 @@ impl<'a> AuthenticatedContext<'a> {
))
}
+ //@FIXME we should write a specific version for the "selected" state
+ //that returns some unsollicited responses
async fn append(
self,
mailbox: &MailboxCodec<'a>,
@@ -560,10 +562,9 @@ impl<'a> AuthenticatedContext<'a> {
match self.append_internal(mailbox, flags, date, message).await {
- Ok((_mb_view, unsollicited, uidvalidity, uid, _modseq)) => Ok((
+ Ok((_mb_view, uidvalidity, uid, _modseq)) => Ok((
Response::build()
.tag(append_tag)
- .set_body(unsollicited)
.message("APPEND completed")
.code(Code::Other(CodeOther::unvalidated(
format!("APPENDUID {} {}", uidvalidity, uid).into_bytes(),
@@ -603,7 +604,7 @@ impl<'a> AuthenticatedContext<'a> {
flags: &[Flag<'a>],
date: &Option<DateTime>,
message: &Literal<'a>,
- ) -> Result<(MailboxView, Vec<Body<'static>>, ImapUidvalidity, ImapUid, ModSeq)> {
+ ) -> Result<(MailboxView, ImapUidvalidity, ImapUid, ModSeq)> {
let name: &str = MailboxName(mailbox).try_into()?;
let mb_opt = self.user.open_mailbox(&name).await?;
@@ -623,9 +624,9 @@ impl<'a> AuthenticatedContext<'a> {
// TODO: filter allowed flags? ping @Quentin
let (uidvalidity, uid, modseq) = view.internal.mailbox.append(msg, None, &flags[..]).await?;
- let unsollicited = view.update(UpdateParameters::default()).await?;
+ //let unsollicited = view.update(UpdateParameters::default()).await?;
- Ok((view, unsollicited, uidvalidity, uid, modseq))
+ Ok((view, uidvalidity, uid, modseq))
}
}
diff --git a/src/imap/mod.rs b/src/imap/mod.rs
index 58c4dc0..544086e 100644
--- a/src/imap/mod.rs
+++ b/src/imap/mod.rs
@@ -185,15 +185,15 @@ impl NetLoop {
}
async fn new(ctx: ClientContext, sock: AnyStream) -> Result<Self> {
+ let mut opts = ServerFlowOptions::default();
+ opts.crlf_relaxed = false;
+ opts.literal_accept_text = Text::unvalidated("OK");
+ opts.literal_reject_text = Text::unvalidated("Literal rejected");
+
// Send greeting
let (server, _) = ServerFlow::send_greeting(
sock,
- ServerFlowOptions {
- crlf_relaxed: false,
- literal_accept_text: Text::unvalidated("OK"),
- literal_reject_text: Text::unvalidated("Literal rejected"),
- ..ServerFlowOptions::default()
- },
+ opts,
Greeting::ok(
Some(Code::Capability(ctx.server_capabilities.to_vec())),
"Aerogramme",