aboutsummaryrefslogtreecommitdiff
path: root/src/imap/attributes.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-11 23:02:03 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-11 23:02:03 +0100
commit3c7186ab5ac5a66f782a038d937b6679780df458 (patch)
treeee83fb3040ef077d36d807b0134c3141a0ea1d01 /src/imap/attributes.rs
parentd24eb9918e3ab0c69af05c8cb92424ecaba903f3 (diff)
downloadaerogramme-3c7186ab5ac5a66f782a038d937b6679780df458.tar.gz
aerogramme-3c7186ab5ac5a66f782a038d937b6679780df458.zip
Finalize implementation of CONDSTORE
Diffstat (limited to 'src/imap/attributes.rs')
-rw-r--r--src/imap/attributes.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/imap/attributes.rs b/src/imap/attributes.rs
index 6cf52b5..d094f1a 100644
--- a/src/imap/attributes.rs
+++ b/src/imap/attributes.rs
@@ -1,4 +1,5 @@
use imap_codec::imap_types::fetch::{MacroOrMessageDataItemNames, MessageDataItemName, Section};
+use imap_codec::imap_types::command::FetchModifier;
/// Internal decisions based on fetched attributes
/// passed by the client
@@ -7,7 +8,7 @@ pub struct AttributesProxy {
pub attrs: Vec<MessageDataItemName<'static>>,
}
impl AttributesProxy {
- pub fn new(attrs: &MacroOrMessageDataItemNames<'static>, is_uid_fetch: bool) -> Self {
+ pub fn new(attrs: &MacroOrMessageDataItemNames<'static>, modifiers: &[FetchModifier], is_uid_fetch: bool) -> Self {
// Expand macros
let mut fetch_attrs = match attrs {
MacroOrMessageDataItemNames::Macro(m) => {
@@ -31,6 +32,14 @@ impl AttributesProxy {
fetch_attrs.push(MessageDataItemName::Uid);
}
+ // Handle inferred MODSEQ tag
+ let is_changed_since = modifiers
+ .iter()
+ .any(|m| matches!(m, FetchModifier::ChangedSince(..)));
+ if is_changed_since && !fetch_attrs.contains(&MessageDataItemName::ModSeq) {
+ fetch_attrs.push(MessageDataItemName::ModSeq);
+ }
+
Self { attrs: fetch_attrs }
}