forked from meli/meli
1
Fork 0

Add connection method for select

As opposed to the old implementation of select_mailbox, this one does
not interact with the store, but returns any response directly.
imap-connection-changes
Andrei Zisu 2021-01-31 22:35:50 +01:00 committed by Manos Pitsidianakis
parent 7c20f7c82a
commit f74e3c1472
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 15 additions and 0 deletions

View File

@ -848,6 +848,21 @@ impl ImapConnection {
.any(|cap| cap.eq_ignore_ascii_case(&capability.as_bytes()))
}
pub async fn select(&mut self, imap_path: String) -> Result<SelectResponse> {
self.send_command(format!("SELECT \"{}\"", imap_path).as_bytes())
.await?;
let mut ret = Vec::new();
self.read_response(&mut ret, RequiredResponses::SELECT_REQUIRED)
.await?;
let select_response = protocol_parser::select_response(&ret).chain_err_summary(|| {
format!("Could not parse select response for mailbox {}", imap_path)
})?;
Ok(select_response)
}
pub async fn select_mailbox(
&mut self,
mailbox_hash: MailboxHash,