Skip to content

Commit

Permalink
IMAP SEARCH by sequence number fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Jan 3, 2024
1 parent dab9735 commit 7152dcd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [0.5.2] - 2024-01-xx

## Added

### Changed

### Fixed
- IMAP command `SEARCH <seqnum>` is using UIDs rather than sequence numbers.

## [0.5.1] - 2024-01-02

## Added
Expand Down
9 changes: 2 additions & 7 deletions crates/imap/src/op/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl SessionData {
) -> Result<search::Response, StatusResponse> {
// Run query
let (result_set, include_highest_modseq) = self
.query(arguments.filter, &mailbox, &prev_saved_search, is_uid)
.query(arguments.filter, &mailbox, &prev_saved_search)
.await?;

// Obtain modseq
Expand Down Expand Up @@ -250,7 +250,6 @@ impl SessionData {
imap_filter: Vec<Filter>,
mailbox: &SelectedMailbox,
prev_saved_search: &Option<Option<Arc<Vec<ImapId>>>>,
is_uid: bool,
) -> Result<(ResultSet, bool), StatusResponse> {
// Obtain message ids
let mut filters = Vec::with_capacity(imap_filter.len() + 1);
Expand Down Expand Up @@ -431,11 +430,7 @@ impl SessionData {
return Err(StatusResponse::no("No saved search found."));
}
} else {
for id in mailbox
.sequence_to_ids(&sequence, is_uid || uid_filter)
.await?
.keys()
{
for id in mailbox.sequence_to_ids(&sequence, uid_filter).await?.keys() {
set.insert(*id);
}
}
Expand Down
4 changes: 1 addition & 3 deletions crates/imap/src/op/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ impl SessionData {
is_uid: bool,
) -> Result<Response, StatusResponse> {
// Run query
let (result_set, _) = self
.query(arguments.filter, &mailbox, &None, is_uid)
.await?;
let (result_set, _) = self.query(arguments.filter, &mailbox, &None).await?;

// Synchronize mailbox
if !result_set.results.is_empty() {
Expand Down

0 comments on commit 7152dcd

Please sign in to comment.