aboutsummaryrefslogtreecommitdiff
path: root/src/imap/attributes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/imap/attributes.rs')
-rw-r--r--src/imap/attributes.rs50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/imap/attributes.rs b/src/imap/attributes.rs
index d094f1a..89446a8 100644
--- a/src/imap/attributes.rs
+++ b/src/imap/attributes.rs
@@ -1,5 +1,5 @@
-use imap_codec::imap_types::fetch::{MacroOrMessageDataItemNames, MessageDataItemName, Section};
use imap_codec::imap_types::command::FetchModifier;
+use imap_codec::imap_types::fetch::{MacroOrMessageDataItemNames, MessageDataItemName, Section};
/// Internal decisions based on fetched attributes
/// passed by the client
@@ -8,7 +8,11 @@ pub struct AttributesProxy {
pub attrs: Vec<MessageDataItemName<'static>>,
}
impl AttributesProxy {
- pub fn new(attrs: &MacroOrMessageDataItemNames<'static>, modifiers: &[FetchModifier], 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) => {
@@ -44,32 +48,30 @@ impl AttributesProxy {
}
pub fn is_enabling_condstore(&self) -> bool {
- self.attrs.iter().any(|x| {
- matches!(x, MessageDataItemName::ModSeq)
- })
+ self.attrs
+ .iter()
+ .any(|x| matches!(x, MessageDataItemName::ModSeq))
}
pub fn need_body(&self) -> bool {
- self.attrs.iter().any(|x| {
- match x {
- MessageDataItemName::Body
- | MessageDataItemName::Rfc822
- | MessageDataItemName::Rfc822Text
- | MessageDataItemName::BodyStructure => true,
+ self.attrs.iter().any(|x| match x {
+ MessageDataItemName::Body
+ | MessageDataItemName::Rfc822
+ | MessageDataItemName::Rfc822Text
+ | MessageDataItemName::BodyStructure => true,
- MessageDataItemName::BodyExt {
- section: Some(section),
- partial: _,
- peek: _,
- } => match section {
- Section::Header(None)
- | Section::HeaderFields(None, _)
- | Section::HeaderFieldsNot(None, _) => false,
- _ => true,
- },
- MessageDataItemName::BodyExt { .. } => true,
- _ => false,
- }
+ MessageDataItemName::BodyExt {
+ section: Some(section),
+ partial: _,
+ peek: _,
+ } => match section {
+ Section::Header(None)
+ | Section::HeaderFields(None, _)
+ | Section::HeaderFieldsNot(None, _) => false,
+ _ => true,
+ },
+ MessageDataItemName::BodyExt { .. } => true,
+ _ => false,
})
}
}