aboutsummaryrefslogtreecommitdiff
path: root/src/mail/mailbox.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-21 12:44:58 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-21 12:44:58 +0200
commit54c467d3f77fae964400e9c1d78d32d9067c3b0f (patch)
tree4694e2b54d005c5c2283e6a51f530476f4ebac04 /src/mail/mailbox.rs
parentdb4ffd7135a3d780cf2f7929e9fb883e96157de4 (diff)
downloadaerogramme-54c467d3f77fae964400e9c1d78d32d9067c3b0f.tar.gz
aerogramme-54c467d3f77fae964400e9c1d78d32d9067c3b0f.zip
Implement COPY
Diffstat (limited to 'src/mail/mailbox.rs')
-rw-r--r--src/mail/mailbox.rs11
1 files changed, 8 insertions, 3 deletions
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<UniqueIdent> {
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<UniqueIdent> {
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<()> {