Skip to content

Commit

Permalink
feat: support optional arguments for APPEND command
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Aug 29, 2024
1 parent b47f207 commit 62fdb8f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,15 +1114,21 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Session<T> {
/// Specifically, the server will generally notify the client immediately via an untagged
/// `EXISTS` response. If the server does not do so, the client MAY issue a `NOOP` command (or
/// failing that, a `CHECK` command) after one or more `APPEND` commands.
pub async fn append<S: AsRef<str>, B: AsRef<[u8]>>(
pub async fn append(
&mut self,
mailbox: S,
content: B,
mailbox: impl AsRef<str>,
flags: Option<&str>,
internaldate: Option<&str>,
content: impl AsRef<[u8]>,
) -> Result<()> {
let content = content.as_ref();
self.run_command(&format!(
"APPEND \"{}\" {{{}}}",
"APPEND \"{}\"{}{}{}{} {{{}}}",
mailbox.as_ref(),
if flags.is_some() { " " } else { "" },
flags.unwrap_or(""),
if internaldate.is_some() { " " } else { "" },
internaldate.unwrap_or(""),
content.len()
))
.await?;
Expand Down

0 comments on commit 62fdb8f

Please sign in to comment.