melib: add supports_search() method to MailBackend
parent
5ef62a39b8
commit
32f196143e
|
@ -287,6 +287,7 @@ pub type ResultFuture<T> = Result<Pin<Box<dyn Future<Output = Result<T>> + Send
|
|||
pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
||||
fn is_async(&self) -> bool;
|
||||
fn is_remote(&self) -> bool;
|
||||
fn supports_search(&self) -> bool;
|
||||
fn is_online(&self) -> Result<()> {
|
||||
Err(MeliError::new("Unimplemented."))
|
||||
}
|
||||
|
|
|
@ -183,6 +183,11 @@ impl MailBackend for ImapType {
|
|||
fn is_remote(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn supports_search(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn get_async(
|
||||
&mut self,
|
||||
mailbox: &Mailbox,
|
||||
|
|
|
@ -198,6 +198,10 @@ impl MailBackend for JmapType {
|
|||
true
|
||||
}
|
||||
|
||||
fn supports_search(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn is_online(&self) -> Result<()> {
|
||||
if self.online.lock().unwrap().1.is_err()
|
||||
&& Instant::now().duration_since(self.online.lock().unwrap().0)
|
||||
|
|
|
@ -183,6 +183,10 @@ impl MailBackend for MaildirType {
|
|||
false
|
||||
}
|
||||
|
||||
fn supports_search(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_online(&self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -710,6 +710,10 @@ impl MailBackend for MboxType {
|
|||
false
|
||||
}
|
||||
|
||||
fn supports_search(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn is_online(&self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -326,6 +326,10 @@ impl MailBackend for NotmuchDb {
|
|||
false
|
||||
}
|
||||
|
||||
fn supports_search(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn is_online(&self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -75,6 +75,11 @@ impl MailBackend for PluginBackend {
|
|||
false
|
||||
}
|
||||
|
||||
fn supports_search(&self) -> bool {
|
||||
// TODO
|
||||
false
|
||||
}
|
||||
|
||||
fn is_online(&self) -> Result<()> {
|
||||
if let Ok(mut is_online) = self.is_online.try_lock() {
|
||||
let now = std::time::Instant::now();
|
||||
|
|
Loading…
Reference in New Issue