Skip to content

feat: support optional arguments for APPEND command #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading