IMAP SEARCH by sequence number fix

This commit is contained in:
mdecimus 2024-01-03 09:42:55 +01:00
parent dab9735f8c
commit 7152dcdb3a
3 changed files with 12 additions and 10 deletions

View file

@ -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/). 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 ## [0.5.1] - 2024-01-02
## Added ## Added

View file

@ -125,7 +125,7 @@ impl SessionData {
) -> Result<search::Response, StatusResponse> { ) -> Result<search::Response, StatusResponse> {
// Run query // Run query
let (result_set, include_highest_modseq) = self let (result_set, include_highest_modseq) = self
.query(arguments.filter, &mailbox, &prev_saved_search, is_uid) .query(arguments.filter, &mailbox, &prev_saved_search)
.await?; .await?;
// Obtain modseq // Obtain modseq
@ -250,7 +250,6 @@ impl SessionData {
imap_filter: Vec<Filter>, imap_filter: Vec<Filter>,
mailbox: &SelectedMailbox, mailbox: &SelectedMailbox,
prev_saved_search: &Option<Option<Arc<Vec<ImapId>>>>, prev_saved_search: &Option<Option<Arc<Vec<ImapId>>>>,
is_uid: bool,
) -> Result<(ResultSet, bool), StatusResponse> { ) -> Result<(ResultSet, bool), StatusResponse> {
// Obtain message ids // Obtain message ids
let mut filters = Vec::with_capacity(imap_filter.len() + 1); let mut filters = Vec::with_capacity(imap_filter.len() + 1);
@ -431,11 +430,7 @@ impl SessionData {
return Err(StatusResponse::no("No saved search found.")); return Err(StatusResponse::no("No saved search found."));
} }
} else { } else {
for id in mailbox for id in mailbox.sequence_to_ids(&sequence, uid_filter).await?.keys() {
.sequence_to_ids(&sequence, is_uid || uid_filter)
.await?
.keys()
{
set.insert(*id); set.insert(*id);
} }
} }

View file

@ -75,9 +75,7 @@ impl SessionData {
is_uid: bool, is_uid: bool,
) -> Result<Response, StatusResponse> { ) -> Result<Response, StatusResponse> {
// Run query // Run query
let (result_set, _) = self let (result_set, _) = self.query(arguments.filter, &mailbox, &None).await?;
.query(arguments.filter, &mailbox, &None, is_uid)
.await?;
// Synchronize mailbox // Synchronize mailbox
if !result_set.results.is_empty() { if !result_set.results.is_empty() {