diff options
Diffstat (limited to 'src/imap/attributes.rs')
-rw-r--r-- | src/imap/attributes.rs | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/imap/attributes.rs b/src/imap/attributes.rs index 7a55632..8ab891e 100644 --- a/src/imap/attributes.rs +++ b/src/imap/attributes.rs @@ -1,4 +1,4 @@ -use imap_codec::imap_types::fetch::{MacroOrMessageDataItemNames, MessageDataItemName}; +use imap_codec::imap_types::fetch::{MacroOrMessageDataItemNames, MessageDataItemName, Section}; /// Internal decisions based on fetched attributes /// passed by the client @@ -36,14 +36,26 @@ impl AttributesProxy { pub fn need_body(&self) -> bool { self.attrs.iter().any(|x| { - matches!( - x, + println!("item is: {:?}", x); + match x { MessageDataItemName::Body - | MessageDataItemName::BodyExt { .. } - | MessageDataItemName::Rfc822 - | MessageDataItemName::Rfc822Text - | MessageDataItemName::BodyStructure - ) + | 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, + } }) } } |