client: Add UID EXPUNGE support
This commit is contained in:
parent
1a62f1b24b
commit
c9b720155f
1 changed files with 21 additions and 0 deletions
|
|
@ -532,6 +532,12 @@ impl <T: Read + Write> Session<T> {
|
|||
self.run_command_and_check_ok("EXPUNGE")
|
||||
}
|
||||
|
||||
/// Permanently removes all messages that have both the \Deleted flag set and have a UID that is
|
||||
/// included in the specified message set.
|
||||
pub fn uid_expunge(&mut self, uid_set: &str) -> Result<()> {
|
||||
self.run_command_and_check_ok(&format!("UID EXPUNGE {}", uid_set))
|
||||
}
|
||||
|
||||
/// Check requests a checkpoint of the currently selected mailbox.
|
||||
pub fn check(&mut self) -> Result<()> {
|
||||
self.run_command_and_check_ok("CHECK")
|
||||
|
|
@ -960,6 +966,21 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uid_expunge() {
|
||||
let response = b"* 2 EXPUNGE\r\n\
|
||||
* 3 EXPUNGE\r\n\
|
||||
* 4 EXPUNGE\r\n\
|
||||
a1 OK UID EXPUNGE completed\r\n".to_vec();
|
||||
let mock_stream = MockStream::new(response);
|
||||
let mut session = mock_session!(mock_stream);
|
||||
session.uid_expunge("2:4").unwrap();
|
||||
assert!(
|
||||
session.stream.get_ref().written_buf == b"a1 UID EXPUNGE 2:4\r\n".to_vec(),
|
||||
"Invalid expunge command"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check() {
|
||||
let response = b"a1 OK CHECK completed\r\n".to_vec();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue