diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-07-25 17:53:04 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-07-25 17:53:04 +0300 |
commit | 3f8aa560f041c36e1799476f4ff67141db1a0f2b (patch) | |
tree | 45ecd3c3cbc5a95d9f9c91472697ca7d210360db /src/components/mail/status.rs | |
parent | 4aaa784d8f9e96adb91c82c74ba35a95accf3436 (diff) |
melib/MailBackend: add MailBackendCapabilities struct
Diffstat (limited to 'src/components/mail/status.rs')
-rw-r--r-- | src/components/mail/status.rs | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/components/mail/status.rs b/src/components/mail/status.rs index 0b314da5..962e84b2 100644 --- a/src/components/mail/status.rs +++ b/src/components/mail/status.rs @@ -436,7 +436,7 @@ impl Component for AccountStatus { None, ); write_string_to_grid( - if backend_lck.tags().is_some() { + if a.backend_capabilities.supports_tags { "yes" } else { "no" @@ -459,31 +459,20 @@ impl Component for AccountStatus { None, ); write_string_to_grid( - &if a.settings.account().format() == "imap" - && *a.settings.conf.search_backend() == SearchBackend::None - { - "server-side search".to_string() - } else if a.settings.account().format() == "notmuch" - && *a.settings.conf.search_backend() == SearchBackend::None - { - "notmuch database".to_string() - } else { + &match ( + a.settings.conf.search_backend(), + a.backend_capabilities.supports_search, + ) { + (SearchBackend::None, true) => "backend-side search".to_string(), + (SearchBackend::None, false) => "none (search will be slow)".to_string(), #[cfg(feature = "sqlite3")] - { - if *a.settings.conf.search_backend() == SearchBackend::Sqlite3 { - if let Ok(path) = crate::sqlite3::db_path() { - format!("sqlite3 database {}", path.display()) - } else { - "sqlite3 database".to_string() - } + (SearchBackend::Sqlite3, _) => { + if let Ok(path) = crate::sqlite3::db_path() { + format!("sqlite3 database {}", path.display()) } else { - "none (search will be slow)".to_string() + "sqlite3 database".to_string() } } - #[cfg(not(feature = "sqlite3"))] - { - "none (search will be slow)".to_string() - } }, &mut self.content, self.theme_default.fg, |