Small changes to .update()

This commit is contained in:
Alex 2022-07-13 11:39:13 +02:00
parent 70e0da9005
commit 33fa51021c
Signed by: lx
GPG Key ID: 0E496D15096376BE
2 changed files with 34 additions and 34 deletions

View File

@ -172,10 +172,7 @@ impl<'a> AuthenticatedContext<'a> {
} else {
"LIST completed"
};
Ok((
Response::ok(msg)?.with_body(ret),
flow::Transition::None,
))
Ok((Response::ok(msg)?.with_body(ret), flow::Transition::None))
}
async fn status(

View File

@ -86,12 +86,6 @@ impl MailboxView {
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
// See example in IMAP RFC in section on NOOP command:
// we want to produce something like this:
@ -104,6 +98,8 @@ impl MailboxView {
// - notify client of expunged mails
// - if new mails arrived, notify client of number of existing mails
// - 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
let mut n_expunge = 0;
@ -117,10 +113,17 @@ impl MailboxView {
}
// - 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()?);
}
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
for (i, (_uid, uuid)) in new_view.known_state.idx_by_uid.iter().enumerate() {
let old_mail = self.known_state.table.get(uuid);