From c1e7f7264a68533262bfe1d181061e577e508030 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Fri, 12 Jan 2024 13:01:22 +0100 Subject: fix a condstore bug --- src/imap/command/selected.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/imap/command') diff --git a/src/imap/command/selected.rs b/src/imap/command/selected.rs index d694fd1..c13b71a 100644 --- a/src/imap/command/selected.rs +++ b/src/imap/command/selected.rs @@ -222,17 +222,25 @@ impl<'a> SelectedContext<'a> { .mailbox .store(sequence_set, kind, response, flags, unchanged_since, uid) .await?; - let modified_str = format!("MODIFIED {}", modified.into_iter().map(|x| x.to_string()).collect::>().join(",")); - self.client_capabilities.store_modifiers_enable(modifiers); - - Ok(( - Response::build() + let mut ok_resp = Response::build() .to_req(self.req) .message("STORE completed") - .code(Code::Other(CodeOther::unvalidated(modified_str.into_bytes()))) - .set_body(data) - .ok()?, + .set_body(data); + + + match modified[..] { + [] => (), + [_head, ..] => { + let modified_str = format!("MODIFIED {}", modified.into_iter().map(|x| x.to_string()).collect::>().join(",")); + ok_resp = ok_resp.code(Code::Other(CodeOther::unvalidated(modified_str.into_bytes()))); + }, + }; + + + self.client_capabilities.store_modifiers_enable(modifiers); + + Ok((ok_resp.ok()?, flow::Transition::None, )) } -- cgit v1.2.3