Adding expunge, check, and close commands

This commit is contained in:
Matt McCoy 2016-06-15 21:26:17 -04:00
parent 765a939873
commit 5b204cccb8

View file

@ -216,6 +216,23 @@ impl IMAPStream {
Err(Error::new(ErrorKind::Other, "Error parsing capabilities response")) Err(Error::new(ErrorKind::Other, "Error parsing capabilities response"))
} }
/// Expunge permanently removes all messages that have the \Deleted flag set from the currently
/// selected mailbox.
pub fn expunge(&mut self) -> Result<()> {
self.run_command_and_check_ok("CHECK")
}
/// Check requests a checkpoint of the currently selected mailbox.
pub fn check(&mut self) -> Result<()> {
self.run_command_and_check_ok("CHECK")
}
/// Close permanently removes all messages that have the \Deleted flag set from the currently
/// selected mailbox, and returns to the authenticated state from the selected state.
pub fn close(&mut self) -> Result<()> {
self.run_command_and_check_ok("CLOSE")
}
/// Copy copies the specified message to the end of the specified destination mailbox. /// Copy copies the specified message to the end of the specified destination mailbox.
pub fn copy(&mut self, sequence_set: &str, mailbox_name: &str) -> Result<()> { pub fn copy(&mut self, sequence_set: &str, mailbox_name: &str) -> Result<()> {
self.run_command_and_check_ok(&format!("COPY {} {}", sequence_set, mailbox_name).to_string()) self.run_command_and_check_ok(&format!("COPY {} {}", sequence_set, mailbox_name).to_string())