Skip to content

Commit

Permalink
Ensure the sequence numbers are correct with UIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
MTRNord committed Jul 27, 2023
1 parent 8a8c674 commit 5639712
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions crates/erooster_imap/src/commands/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,24 @@ impl Fetch<'_> {
&& &(index as u32) >= start
&& &(index as u32) <= end_int)
{
mail.sequence_number = Some(index as u32 + 1);
if is_uid {
mail.sequence_number = Some(mail.uid());
} else {
mail.sequence_number = Some(index as u32 + 1);
}

return Some(mail);
}
}
RangeEnd::All => {
if (is_uid && &mail.uid() >= start)
|| (!is_uid && &(index as u32) >= start)
{
mail.sequence_number = Some(index as u32 + 1);
if is_uid {
mail.sequence_number = Some(mail.uid());
} else {
mail.sequence_number = Some(index as u32 + 1);
}
return Some(mail);
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/erooster_imap/src/commands/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ where
{
let count = storage.count_cur(&mailbox_path) + storage.count_new(&mailbox_path);
lines.feed(format!("* {count} EXISTS")).await?;
// FIXME: This is fundamentaly invalid and instead should refer to the timestamp a mailbox was created

Check warning on line 79 in crates/erooster_imap/src/commands/select.rs

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"fundamentaly" should be "fundamentally".
let current_time = SystemTime::now();
let unix_timestamp = current_time.duration_since(UNIX_EPOCH)?;
#[allow(clippy::cast_possible_truncation)]
Expand Down

0 comments on commit 5639712

Please sign in to comment.