From 54c467d3f77fae964400e9c1d78d32d9067c3b0f Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 21 Jul 2022 12:44:58 +0200 Subject: Implement COPY --- src/mail/mailbox.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/mail') diff --git a/src/mail/mailbox.rs b/src/mail/mailbox.rs index 44ffe20..df7ede9 100644 --- a/src/mail/mailbox.rs +++ b/src/mail/mailbox.rs @@ -138,7 +138,7 @@ impl Mailbox { /// Copy an email from an other Mailbox to this mailbox /// (use this when possible, as it allows for a certain number of storage optimizations) - pub async fn copy_from(&self, from: &Mailbox, uuid: UniqueIdent) -> Result<()> { + pub async fn copy_from(&self, from: &Mailbox, uuid: UniqueIdent) -> Result { if self.id == from.id { bail!("Cannot copy into same mailbox"); } @@ -412,9 +412,14 @@ impl MailboxInternal { Ok(()) } - async fn copy_from(&mut self, from: &MailboxInternal, source_id: UniqueIdent) -> Result<()> { + async fn copy_from( + &mut self, + from: &MailboxInternal, + source_id: UniqueIdent, + ) -> Result { let new_id = gen_ident(); - self.copy_internal(from, source_id, new_id).await + self.copy_internal(from, source_id, new_id).await?; + Ok(new_id) } async fn move_from(&mut self, from: &mut MailboxInternal, id: UniqueIdent) -> Result<()> { -- cgit v1.2.3