diff options
Diffstat (limited to 'melib/src/backends/imap/mailbox.rs')
-rw-r--r-- | melib/src/backends/imap/mailbox.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/melib/src/backends/imap/mailbox.rs b/melib/src/backends/imap/mailbox.rs index 7461e814..baa918ca 100644 --- a/melib/src/backends/imap/mailbox.rs +++ b/melib/src/backends/imap/mailbox.rs @@ -43,12 +43,31 @@ pub struct ImapMailbox { pub permissions: Arc<Mutex<MailboxPermissions>>, pub exists: Arc<Mutex<LazyCountSet>>, pub unseen: Arc<Mutex<LazyCountSet>>, + pub warm: Arc<Mutex<bool>>, } impl ImapMailbox { pub fn imap_path(&self) -> &str { &self.imap_path } + + /// Establish that mailbox contents have been fetched at least once during this execution + #[inline(always)] + pub fn set_warm(&self, new_value: bool) { + *self.warm.lock().unwrap() = new_value; + } + + /// Mailbox contents have been fetched at least once during this execution + #[inline(always)] + pub fn is_warm(&self) -> bool { + *self.warm.lock().unwrap() + } + + /// Mailbox contents have not been fetched at all during this execution + #[inline(always)] + pub fn is_cold(&self) -> bool { + !self.is_warm() + } } impl BackendMailbox for ImapMailbox { |