|
|
@ -304,24 +304,17 @@ pub type ResultFuture<T> = Result<Pin<Box<dyn Future<Output = Result<T>> + Send
|
|
|
|
pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
|
|
|
pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
|
|
|
fn capabilities(&self) -> MailBackendCapabilities;
|
|
|
|
fn capabilities(&self) -> MailBackendCapabilities;
|
|
|
|
fn is_online(&self) -> ResultFuture<()> {
|
|
|
|
fn is_online(&self) -> ResultFuture<()> {
|
|
|
|
Err(MeliError::new("Unimplemented."))
|
|
|
|
Ok(Box::pin(async { Ok(()) }))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//fn fetch(&mut self, mailbox_hash: MailboxHash) -> Result<Async<Result<Vec<Envelope>>>>;
|
|
|
|
|
|
|
|
fn fetch(
|
|
|
|
fn fetch(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
|
_mailbox_hash: MailboxHash,
|
|
|
|
mailbox_hash: MailboxHash,
|
|
|
|
) -> Result<Pin<Box<dyn Stream<Item = Result<Vec<Envelope>>> + Send + 'static>>> {
|
|
|
|
) -> Result<Pin<Box<dyn Stream<Item = Result<Vec<Envelope>>> + Send + 'static>>>;
|
|
|
|
Err(MeliError::new("Unimplemented."))
|
|
|
|
|
|
|
|
}
|
|
|
|
fn refresh(&mut self, mailbox_hash: MailboxHash) -> ResultFuture<()>;
|
|
|
|
fn refresh(&mut self, _mailbox_hash: MailboxHash) -> ResultFuture<()> {
|
|
|
|
fn watch(&self) -> ResultFuture<()>;
|
|
|
|
Err(MeliError::new("Unimplemented."))
|
|
|
|
fn mailboxes(&self) -> ResultFuture<HashMap<MailboxHash, Mailbox>>;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn watch(&self) -> ResultFuture<()> {
|
|
|
|
|
|
|
|
Err(MeliError::new("Unimplemented."))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn mailboxes(&self) -> ResultFuture<HashMap<MailboxHash, Mailbox>> {
|
|
|
|
|
|
|
|
Err(MeliError::new("Unimplemented."))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn operation(&self, hash: EnvelopeHash) -> Result<Box<dyn BackendOp>>;
|
|
|
|
fn operation(&self, hash: EnvelopeHash) -> Result<Box<dyn BackendOp>>;
|
|
|
|
|
|
|
|
|
|
|
|
fn save(
|
|
|
|
fn save(
|
|
|
@ -362,10 +355,7 @@ pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
|
|
|
None
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fn as_any(&self) -> &dyn Any;
|
|
|
|
fn as_any(&self) -> &dyn Any;
|
|
|
|
|
|
|
|
fn as_any_mut(&mut self) -> &mut dyn Any;
|
|
|
|
fn as_any_mut(&mut self) -> &mut dyn Any {
|
|
|
|
|
|
|
|
unimplemented!()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn create_mailbox(
|
|
|
|
fn create_mailbox(
|
|
|
|
&mut self,
|
|
|
|
&mut self,
|
|
|
@ -553,65 +543,6 @@ pub trait BackendMailbox: Debug {
|
|
|
|
fn count(&self) -> Result<(usize, usize)>;
|
|
|
|
fn count(&self) -> Result<(usize, usize)>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
|
|
|
struct DummyMailbox {
|
|
|
|
|
|
|
|
v: Vec<MailboxHash>,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl BackendMailbox for DummyMailbox {
|
|
|
|
|
|
|
|
fn hash(&self) -> MailboxHash {
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn name(&self) -> &str {
|
|
|
|
|
|
|
|
""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn path(&self) -> &str {
|
|
|
|
|
|
|
|
""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn change_name(&mut self, _s: &str) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn clone(&self) -> Mailbox {
|
|
|
|
|
|
|
|
mailbox_default()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn special_usage(&self) -> SpecialUsageMailbox {
|
|
|
|
|
|
|
|
SpecialUsageMailbox::Normal
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn children(&self) -> &[MailboxHash] {
|
|
|
|
|
|
|
|
&self.v
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn parent(&self) -> Option<MailboxHash> {
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn permissions(&self) -> MailboxPermissions {
|
|
|
|
|
|
|
|
MailboxPermissions::default()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn is_subscribed(&self) -> bool {
|
|
|
|
|
|
|
|
true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_is_subscribed(&mut self, _new_val: bool) -> Result<()> {
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_special_usage(&mut self, _new_val: SpecialUsageMailbox) -> Result<()> {
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn count(&self) -> Result<(usize, usize)> {
|
|
|
|
|
|
|
|
Ok((0, 0))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn mailbox_default() -> Mailbox {
|
|
|
|
|
|
|
|
Box::new(DummyMailbox {
|
|
|
|
|
|
|
|
v: Vec::with_capacity(0),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub type AccountHash = u64;
|
|
|
|
pub type AccountHash = u64;
|
|
|
|
pub type MailboxHash = u64;
|
|
|
|
pub type MailboxHash = u64;
|
|
|
|
pub type Mailbox = Box<dyn BackendMailbox + Send + Sync>;
|
|
|
|
pub type Mailbox = Box<dyn BackendMailbox + Send + Sync>;
|
|
|
@ -622,12 +553,6 @@ impl Clone for Mailbox {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Default for Mailbox {
|
|
|
|
|
|
|
|
fn default() -> Self {
|
|
|
|
|
|
|
|
mailbox_default()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
|
|
|
|
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
|
|
|
|
pub struct MailboxPermissions {
|
|
|
|
pub struct MailboxPermissions {
|
|
|
|
pub create_messages: bool,
|
|
|
|
pub create_messages: bool,
|
|
|
|