melib: update notify to 4.0.15

master
Manos Pitsidianakis 2020-08-26 19:13:18 +03:00
parent e349882ea7
commit c6f11fb592
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
4 changed files with 24 additions and 24 deletions

View File

@ -26,7 +26,7 @@ memmap = { version = "0.5.2", optional = true }
nom = { version = "5.1.1" }
indexmap = { version = "^1.5", features = ["serde-1", ] }
notify = { version = "4.0.1", optional = true }
notify = { version = "4.0.15", optional = true }
xdg = "2.1.0"
native-tls = { version ="0.2.3", optional=true }
serde = { version = "1.0.71", features = ["rc", ] }

View File

@ -240,24 +240,9 @@ pub enum RefreshEventKind {
#[derive(Debug, Clone)]
pub struct RefreshEvent {
mailbox_hash: MailboxHash,
account_hash: AccountHash,
kind: RefreshEventKind,
}
impl RefreshEvent {
pub fn mailbox_hash(&self) -> MailboxHash {
self.mailbox_hash
}
pub fn account_hash(&self) -> AccountHash {
self.account_hash
}
pub fn kind(self) -> RefreshEventKind {
/* consumes self! */
self.kind
}
pub mailbox_hash: MailboxHash,
pub account_hash: AccountHash,
pub kind: RefreshEventKind,
}
#[derive(Clone)]

View File

@ -599,11 +599,20 @@ impl Account {
return None;
}
let kind = event.kind();
{
//let mailbox: &mut Mailbox = self.mailboxes[idx].as_mut().unwrap().as_mut().unwrap();
match kind {
match event.kind {
RefreshEventKind::Update(old_hash, envelope) => {
if !self.collection.contains_key(&old_hash) {
return self.reload(
RefreshEvent {
account_hash: event.account_hash,
mailbox_hash: event.mailbox_hash,
kind: RefreshEventKind::Create(envelope),
},
mailbox_hash,
);
}
#[cfg(feature = "sqlite3")]
{
match crate::sqlite3::remove(old_hash).map(|_| {
@ -646,6 +655,9 @@ impl Account {
return Some(EnvelopeUpdate(old_hash));
}
RefreshEventKind::NewFlags(env_hash, (flags, tags)) => {
if !self.collection.contains_key(&env_hash) {
return None;
}
self.collection
.envelopes
.write()
@ -833,6 +845,9 @@ impl Account {
));
}
RefreshEventKind::Remove(env_hash) => {
if !self.collection.contains_key(&env_hash) {
return None;
}
let thread_hash = {
let thread_hash = self.collection.get_env(env_hash).thread();
self.collection.get_threads(mailbox_hash).find_group(

View File

@ -386,8 +386,8 @@ impl State {
* and startup a thread to remind us to poll it every now and then till it's finished.
*/
pub fn refresh_event(&mut self, event: RefreshEvent) {
let account_hash = event.account_hash();
let mailbox_hash = event.mailbox_hash();
let account_hash = event.account_hash;
let mailbox_hash = event.mailbox_hash;
if self.context.accounts[&account_hash]
.mailbox_entries
.contains_key(&mailbox_hash)
@ -410,7 +410,7 @@ impl State {
self.rcv_event(notification);
}
} else {
if let melib::backends::RefreshEventKind::Failure(err) = event.kind() {
if let melib::backends::RefreshEventKind::Failure(err) = event.kind {
debug!(err);
}
}