summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/domain/libimagmail/src/mail.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/domain/libimagmail/src/mail.rs b/lib/domain/libimagmail/src/mail.rs
index 6e5f2876..db75b5d3 100644
--- a/lib/domain/libimagmail/src/mail.rs
+++ b/lib/domain/libimagmail/src/mail.rs
@@ -46,6 +46,12 @@ pub trait Mail : RefFassade {
fn get_in_reply_to(&self, refconfig: &RefConfig) -> Result<Option<MessageId>>;
fn flags(&self, refconfig: &RefConfig) -> Result<Vec<MailFlag>>;
+ fn is_passed(&self, refconfig: &RefConfig) -> Result<bool>;
+ fn is_replied(&self, refconfig: &RefConfig) -> Result<bool>;
+ fn is_seen(&self, refconfig: &RefConfig) -> Result<bool>;
+ fn is_trashed(&self, refconfig: &RefConfig) -> Result<bool>;
+ fn is_draft(&self, refconfig: &RefConfig) -> Result<bool>;
+ fn is_flagged(&self, refconfig: &RefConfig) -> Result<bool>;
}
impl Mail for Entry {
@@ -164,6 +170,37 @@ impl Mail for Entry {
}
}
+ /// Check whether the mail is passed
+ fn is_passed(&self, refconfig: &RefConfig) -> Result<bool> {
+ self.flags(refconfig).map(|fs| fs.into_iter().any(|f| MailFlag::Passed == f))
+ }
+
+ /// Check whether the mail is replied
+ fn is_replied(&self, refconfig: &RefConfig) -> Result<bool> {
+ self.flags(refconfig).map(|fs| fs.into_iter().any(|f| MailFlag::Replied == f))
+ }
+
+ /// Check whether the mail is seen
+ fn is_seen(&self, refconfig: &RefConfig) -> Result<bool> {
+ self.flags(refconfig).map(|fs| fs.into_iter().any(|f| MailFlag::Seen == f))
+ }
+
+ /// Check whether the mail is trashed
+ fn is_trashed(&self, refconfig: &RefConfig) -> Result<bool> {
+ self.flags(refconfig).map(|fs| fs.into_iter().any(|f| MailFlag::Trashed == f))
+ }
+
+ /// Check whether the mail is draft
+ fn is_draft(&self, refconfig: &RefConfig) -> Result<bool> {
+ self.flags(refconfig).map(|fs| fs.into_iter().any(|f| MailFlag::Draft == f))
+ }
+
+ /// Check whether the mail is flagged
+ fn is_flagged(&self, refconfig: &RefConfig) -> Result<bool> {
+ self.flags(refconfig).map(|fs| fs.into_iter().any(|f| MailFlag::Flagged == f))
+ }
+
+
}
#[derive(Debug)]