aboutsummaryrefslogtreecommitdiff
path: root/src/imap/mailbox_view.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-01-05 15:36:40 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-01-05 15:36:40 +0100
commit335750a29a83edba9bce2fb7e1452001e4962d1f (patch)
treebea1e1f767cbd662e7a7f9b674a7ebeae195cd0a /src/imap/mailbox_view.rs
parentd3c156a087f3c767fc0d2376abd7c1d304161d47 (diff)
downloadaerogramme-335750a29a83edba9bce2fb7e1452001e4962d1f.tar.gz
aerogramme-335750a29a83edba9bce2fb7e1452001e4962d1f.zip
MOVE command is optimized
Diffstat (limited to 'src/imap/mailbox_view.rs')
-rw-r--r--src/imap/mailbox_view.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/imap/mailbox_view.rs b/src/imap/mailbox_view.rs
index 4d0858f..6db1bd2 100644
--- a/src/imap/mailbox_view.rs
+++ b/src/imap/mailbox_view.rs
@@ -228,19 +228,16 @@ impl MailboxView {
) -> Result<(ImapUidvalidity, Vec<(ImapUid, ImapUid)>, Vec<Body<'static>>)> {
let mails = self.get_mail_ids(sequence_set, *is_uid_copy)?;
- let mut new_uuids = vec![];
for mi in mails.iter() {
- let copy_action = to.copy_from(&self.mailbox, mi.uuid).await?;
- new_uuids.push(copy_action);
- self.mailbox.delete(mi.uuid).await?
+ to.move_from(&self.mailbox, mi.uuid).await?;
}
let mut ret = vec![];
let to_state = to.current_uid_index().await;
- for (mi, new_uuid) in mails.iter().zip(new_uuids.iter()) {
+ for mi in mails.iter() {
let dest_uid = to_state
.table
- .get(new_uuid)
+ .get(&mi.uuid)
.ok_or(anyhow!("moved mail not in destination mailbox"))?
.0;
ret.push((mi.uid, dest_uid));