Fecth MODSEQ now enables the CONDSTORE capability

This commit is contained in:
Quentin 2024-01-10 18:38:21 +01:00
parent f5b73182f2
commit f4cbf66549
Signed by: quentin
GPG key ID: E9602264D639FF68
4 changed files with 34 additions and 18 deletions

View file

@ -34,6 +34,12 @@ impl AttributesProxy {
Self { attrs: fetch_attrs }
}
pub fn is_enabling_condstore(&self) -> bool {
self.attrs.iter().any(|x| {
matches!(x, MessageDataItemName::ModSeq)
})
}
pub fn need_body(&self) -> bool {
self.attrs.iter().any(|x| {
match x {

View file

@ -91,14 +91,19 @@ impl<'a> ExaminedContext<'a> {
uid: &bool,
) -> Result<(Response<'static>, flow::Transition)> {
match self.mailbox.fetch(sequence_set, attributes, uid).await {
Ok(resp) => Ok((
Ok((resp, enable_condstore)) => {
if enable_condstore {
self.client_capabilities.enable_condstore();
}
Ok((
Response::build()
.to_req(self.req)
.message("FETCH completed")
.set_body(resp)
.ok()?,
flow::Transition::None,
)),
))
},
Err(e) => Ok((
Response::build()
.to_req(self.req)

View file

@ -117,14 +117,19 @@ impl<'a> SelectedContext<'a> {
uid: &bool,
) -> Result<(Response<'static>, flow::Transition)> {
match self.mailbox.fetch(sequence_set, attributes, uid).await {
Ok(resp) => Ok((
Ok((resp, enable_condstore)) => {
if enable_condstore {
self.client_capabilities.enable_condstore();
}
Ok((
Response::build()
.to_req(self.req)
.message("FETCH completed")
.set_body(resp)
.ok()?,
flow::Transition::None,
)),
))
},
Err(e) => Ok((
Response::build()
.to_req(self.req)

View file

@ -259,7 +259,7 @@ impl MailboxView {
sequence_set: &SequenceSet,
attributes: &'b MacroOrMessageDataItemNames<'static>,
is_uid_fetch: &bool,
) -> Result<Vec<Body<'static>>> {
) -> Result<(Vec<Body<'static>>, bool)> {
// [1/6] Pre-compute data
// a. what are the uuids of the emails we want?
// b. do we need to fetch the full body?
@ -316,7 +316,7 @@ impl MailboxView {
.collect::<Result<_, _>>()?;
// [6/6] Build the final result that will be sent to the client.
Ok(imap_ret)
Ok((imap_ret, ap.is_enabling_condstore()))
}
/// A naive search implementation...