CONDSTORE #71
2 changed files with 16 additions and 6 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1807,7 +1807,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "imap-codec"
|
name = "imap-codec"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#990e709450ff4f8986b08d2b84e28f651b74f181"
|
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#088fa93bfb4040fc4364aa6e9487fff4375429c3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"abnf-core",
|
"abnf-core",
|
||||||
"base64 0.21.5",
|
"base64 0.21.5",
|
||||||
|
@ -1834,7 +1834,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "imap-types"
|
name = "imap-types"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#990e709450ff4f8986b08d2b84e28f651b74f181"
|
source = "git+https://github.com/superboum/imap-codec?branch=custom/aerogramme#088fa93bfb4040fc4364aa6e9487fff4375429c3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.21.5",
|
"base64 0.21.5",
|
||||||
"bounded-static",
|
"bounded-static",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use std::num::NonZeroU32;
|
use std::num::{NonZeroU32, NonZeroU64};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use imap_codec::imap_types::core::NonEmptyVec;
|
use imap_codec::imap_types::core::NonEmptyVec;
|
||||||
use imap_codec::imap_types::search::SearchKey;
|
use imap_codec::imap_types::search::{SearchKey, MetadataItemSearch};
|
||||||
use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet};
|
use imap_codec::imap_types::sequence::{SeqOrUid, Sequence, SequenceSet};
|
||||||
|
|
||||||
use crate::imap::index::MailIndex;
|
use crate::imap::index::MailIndex;
|
||||||
|
@ -176,6 +176,7 @@ impl<'a> Criteria<'a> {
|
||||||
// Sequence logic
|
// Sequence logic
|
||||||
maybe_seq if is_sk_seq(maybe_seq) => is_keep_seq(maybe_seq, midx).into(),
|
maybe_seq if is_sk_seq(maybe_seq) => is_keep_seq(maybe_seq, midx).into(),
|
||||||
maybe_flag if is_sk_flag(maybe_flag) => is_keep_flag(maybe_flag, midx).into(),
|
maybe_flag if is_sk_flag(maybe_flag) => is_keep_flag(maybe_flag, midx).into(),
|
||||||
|
ModSeq { metadata_item , modseq } => is_keep_modseq(metadata_item, modseq, midx).into(),
|
||||||
|
|
||||||
// All the stuff we can't evaluate yet
|
// All the stuff we can't evaluate yet
|
||||||
Bcc(_) | Cc(_) | From(_) | Header(..) | SentBefore(_) | SentOn(_) | SentSince(_)
|
Bcc(_) | Cc(_) | From(_) | Header(..) | SentBefore(_) | SentOn(_) | SentSince(_)
|
||||||
|
@ -210,9 +211,10 @@ impl<'a> Criteria<'a> {
|
||||||
Not(expr) => !Criteria(expr).is_keep_on_query(mail_view),
|
Not(expr) => !Criteria(expr).is_keep_on_query(mail_view),
|
||||||
All => true,
|
All => true,
|
||||||
|
|
||||||
// Reevaluating our previous logic...
|
//@FIXME Reevaluating our previous logic...
|
||||||
maybe_seq if is_sk_seq(maybe_seq) => is_keep_seq(maybe_seq, &mail_view.in_idx),
|
maybe_seq if is_sk_seq(maybe_seq) => is_keep_seq(maybe_seq, &mail_view.in_idx),
|
||||||
maybe_flag if is_sk_flag(maybe_flag) => is_keep_flag(maybe_flag, &mail_view.in_idx),
|
maybe_flag if is_sk_flag(maybe_flag) => is_keep_flag(maybe_flag, &mail_view.in_idx),
|
||||||
|
ModSeq { metadata_item , modseq } => is_keep_modseq(metadata_item, modseq, &mail_view.in_idx).into(),
|
||||||
|
|
||||||
// Filter on mail meta
|
// Filter on mail meta
|
||||||
Before(search_naive) => match mail_view.stored_naive_date() {
|
Before(search_naive) => match mail_view.stored_naive_date() {
|
||||||
|
@ -319,6 +321,7 @@ fn approx_sequence_set_size(seq_set: &SequenceSet) -> u64 {
|
||||||
|
|
||||||
// This is wrong as sequence UID can have holes,
|
// This is wrong as sequence UID can have holes,
|
||||||
// as we don't know the number of messages in the mailbox also
|
// as we don't know the number of messages in the mailbox also
|
||||||
|
// we gave to guess
|
||||||
fn approx_sequence_size(seq: &Sequence) -> u64 {
|
fn approx_sequence_size(seq: &Sequence) -> u64 {
|
||||||
match seq {
|
match seq {
|
||||||
Sequence::Single(_) => 1,
|
Sequence::Single(_) => 1,
|
||||||
|
@ -458,3 +461,10 @@ fn is_keep_seq(sk: &SearchKey, midx: &MailIndex) -> bool {
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_keep_modseq(filter: &Option<MetadataItemSearch>, modseq: &NonZeroU64, midx: &MailIndex) -> bool {
|
||||||
|
if filter.is_some() {
|
||||||
|
tracing::warn!(filter=?filter, "Ignoring search metadata filter as it's not supported yet");
|
||||||
|
}
|
||||||
|
modseq <= &midx.modseq
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue