Small changes to .update()
This commit is contained in:
parent
70e0da9005
commit
33fa51021c
2 changed files with 34 additions and 34 deletions
|
@ -172,10 +172,7 @@ impl<'a> AuthenticatedContext<'a> {
|
||||||
} else {
|
} else {
|
||||||
"LIST completed"
|
"LIST completed"
|
||||||
};
|
};
|
||||||
Ok((
|
Ok((Response::ok(msg)?.with_body(ret), flow::Transition::None))
|
||||||
Response::ok(msg)?.with_body(ret),
|
|
||||||
flow::Transition::None,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn status(
|
async fn status(
|
||||||
|
|
|
@ -86,12 +86,6 @@ impl MailboxView {
|
||||||
|
|
||||||
let mut data = Vec::<Body>::new();
|
let mut data = Vec::<Body>::new();
|
||||||
|
|
||||||
if new_view.known_state.uidvalidity != self.known_state.uidvalidity {
|
|
||||||
// TODO: do we want to push less/more info than this?
|
|
||||||
data.push(new_view.uidvalidity_status()?);
|
|
||||||
data.push(new_view.exists_status()?);
|
|
||||||
data.push(new_view.uidnext_status()?);
|
|
||||||
} else {
|
|
||||||
// Calculate diff between two mailbox states
|
// Calculate diff between two mailbox states
|
||||||
// See example in IMAP RFC in section on NOOP command:
|
// See example in IMAP RFC in section on NOOP command:
|
||||||
// we want to produce something like this:
|
// we want to produce something like this:
|
||||||
|
@ -104,6 +98,8 @@ impl MailboxView {
|
||||||
// - notify client of expunged mails
|
// - notify client of expunged mails
|
||||||
// - if new mails arrived, notify client of number of existing mails
|
// - if new mails arrived, notify client of number of existing mails
|
||||||
// - if flags changed for existing mails, tell client
|
// - if flags changed for existing mails, tell client
|
||||||
|
// (for this last step: if uidvalidity changed, do nothing,
|
||||||
|
// just notify of new uidvalidity and they will resync)
|
||||||
|
|
||||||
// - notify client of expunged mails
|
// - notify client of expunged mails
|
||||||
let mut n_expunge = 0;
|
let mut n_expunge = 0;
|
||||||
|
@ -117,10 +113,17 @@ impl MailboxView {
|
||||||
}
|
}
|
||||||
|
|
||||||
// - if new mails arrived, notify client of number of existing mails
|
// - if new mails arrived, notify client of number of existing mails
|
||||||
if new_view.known_state.table.len() != self.known_state.table.len() - n_expunge {
|
if new_view.known_state.table.len() != self.known_state.table.len() - n_expunge
|
||||||
|
|| new_view.known_state.uidvalidity != self.known_state.uidvalidity
|
||||||
|
{
|
||||||
data.push(new_view.exists_status()?);
|
data.push(new_view.exists_status()?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if new_view.known_state.uidvalidity != self.known_state.uidvalidity {
|
||||||
|
// TODO: do we want to push less/more info than this?
|
||||||
|
data.push(new_view.uidvalidity_status()?);
|
||||||
|
data.push(new_view.uidnext_status()?);
|
||||||
|
} else {
|
||||||
// - if flags changed for existing mails, tell client
|
// - if flags changed for existing mails, tell client
|
||||||
for (i, (_uid, uuid)) in new_view.known_state.idx_by_uid.iter().enumerate() {
|
for (i, (_uid, uuid)) in new_view.known_state.idx_by_uid.iter().enumerate() {
|
||||||
let old_mail = self.known_state.table.get(uuid);
|
let old_mail = self.known_state.table.get(uuid);
|
||||||
|
|
Loading…
Reference in a new issue