1 parent
beae94e932
commit
de4d70970c
51 files changed
+4034
-421
No files matched your search
@@ -218,6 +218,15 @@ pub trait ImapClient: Send + Sync {
|
||||
folder: &str,
|
||||
) -> Result<Vec<(u32, Vec<String>)>, ImapError>;
|
||||
|
||||
/// `UID SEARCH <criteria>` in `folder`. Callers must build `criteria`
|
||||
/// from validated, quoted parts (see `routes::filters`).
|
||||
async fn search_uids(
|
||||
&self,
|
||||
creds: &ImapCredentials,
|
||||
folder: &str,
|
||||
criteria: &str,
|
||||
) -> Result<Vec<u32>, ImapError>;
|
||||
|
||||
async fn folder_status_extended(
|
||||
&self,
|
||||
creds: &ImapCredentials,
|
||||
@@ -1156,6 +1165,31 @@ impl ImapClient for RealImapClient {
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
async fn search_uids(
|
||||
&self,
|
||||
creds: &ImapCredentials,
|
||||
folder: &str,
|
||||
criteria: &str,
|
||||
) -> Result<Vec<u32>, ImapError> {
|
||||
let mut session = self.pool.checkout(creds).await?;
|
||||
session.select(folder).await.map_err(|e| match &e {
|
||||
async_imap::error::Error::No(msg)
|
||||
if msg.to_lowercase().contains("not found")
|
||||
|| msg.to_lowercase().contains("doesn't exist")
|
||||
|| msg.to_lowercase().contains("does not exist")
|
||||
|| msg.to_lowercase().contains("no such") =>
|
||||
{
|
||||
ImapError::FolderNotFound(folder.to_string())
|
||||
}
|
||||
_ => map_imap_error(e),
|
||||
})?;
|
||||
let matches = session.uid_search(criteria).await.map_err(map_imap_error)?;
|
||||
session.recycle();
|
||||
let mut uids: Vec<u32> = matches.into_iter().collect();
|
||||
uids.sort_unstable();
|
||||
Ok(uids)
|
||||
}
|
||||
|
||||
async fn folder_status_extended(
|
||||
&self,
|
||||
creds: &ImapCredentials,
|
||||
|
||||
Reference in new issue
Block a user