imap/untagged.rs: properly queue refresh events
RefreshEvents where added in self.uid_store.refresh_events queue though ImapConnection has a method add_refresh_event() that drains the queue if possiblememfd
parent
2a0ad92374
commit
64e5d4af4f
|
@ -42,7 +42,7 @@ impl ImapConnection {
|
||||||
Err(err.clone()),
|
Err(err.clone()),
|
||||||
);
|
);
|
||||||
debug!("failure: {}", err.to_string());
|
debug!("failure: {}", err.to_string());
|
||||||
self.uid_store.refresh_events.lock().unwrap().push(RefreshEvent {
|
self.add_refresh_event(RefreshEvent {
|
||||||
account_hash: self.uid_store.account_hash,
|
account_hash: self.uid_store.account_hash,
|
||||||
mailbox_hash: $mailbox_hash,
|
mailbox_hash: $mailbox_hash,
|
||||||
kind: RefreshEventKind::Failure(err.clone()),
|
kind: RefreshEventKind::Failure(err.clone()),
|
||||||
|
@ -167,13 +167,11 @@ impl ImapConnection {
|
||||||
if !env.is_seen() {
|
if !env.is_seen() {
|
||||||
*mailbox.unseen.lock().unwrap() += 1;
|
*mailbox.unseen.lock().unwrap() += 1;
|
||||||
}
|
}
|
||||||
self.uid_store.refresh_events.lock().unwrap().push(
|
self.add_refresh_event(RefreshEvent {
|
||||||
RefreshEvent {
|
account_hash: self.uid_store.account_hash,
|
||||||
account_hash: self.uid_store.account_hash,
|
mailbox_hash,
|
||||||
mailbox_hash,
|
kind: Create(Box::new(env)),
|
||||||
kind: Create(Box::new(env)),
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,13 +256,11 @@ impl ImapConnection {
|
||||||
*mailbox.unseen.lock().unwrap() += 1;
|
*mailbox.unseen.lock().unwrap() += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.uid_store.refresh_events.lock().unwrap().push(
|
self.add_refresh_event(RefreshEvent {
|
||||||
RefreshEvent {
|
account_hash: self.uid_store.account_hash,
|
||||||
account_hash: self.uid_store.account_hash,
|
mailbox_hash,
|
||||||
mailbox_hash,
|
kind: Create(Box::new(env)),
|
||||||
kind: Create(Box::new(env)),
|
});
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,23 +303,16 @@ impl ImapConnection {
|
||||||
{
|
{
|
||||||
Ok(mut v) => {
|
Ok(mut v) => {
|
||||||
if let Some(uid) = v.pop() {
|
if let Some(uid) = v.pop() {
|
||||||
if let Some(env_hash) = self
|
let lck = self.uid_store.uid_index.lock().unwrap();
|
||||||
.uid_store
|
let env_hash = lck.get(&(mailbox_hash, uid)).map(|&h| h);
|
||||||
.uid_index
|
drop(lck);
|
||||||
.lock()
|
if let Some(env_hash) = env_hash {
|
||||||
.unwrap()
|
self.add_refresh_event(RefreshEvent {
|
||||||
.get(&(mailbox_hash, uid))
|
account_hash: self.uid_store.account_hash,
|
||||||
{
|
mailbox_hash,
|
||||||
self.uid_store
|
kind: NewFlags(env_hash, flags),
|
||||||
.refresh_events
|
});
|
||||||
.lock()
|
};
|
||||||
.unwrap()
|
|
||||||
.push(RefreshEvent {
|
|
||||||
account_hash: self.uid_store.account_hash,
|
|
||||||
mailbox_hash,
|
|
||||||
kind: NewFlags(*env_hash, flags),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
Loading…
Reference in New Issue