Aerogramme refactoring #57
5 changed files with 16 additions and 9 deletions
|
@ -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));
|
||||
|
|
|
@ -149,7 +149,6 @@ impl Mailbox {
|
|||
|
||||
/// Move an email from an other Mailbox to this mailbox
|
||||
/// (use this when possible, as it allows for a certain number of storage optimizations)
|
||||
#[allow(dead_code)]
|
||||
pub async fn move_from(&self, from: &Mailbox, uuid: UniqueIdent) -> Result<()> {
|
||||
if self.id == from.id {
|
||||
bail!("Cannot copy move same mailbox");
|
||||
|
@ -403,8 +402,6 @@ impl MailboxInternal {
|
|||
Ok(new_id)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
// 2023-05-15 will probably be used later
|
||||
async fn move_from(&mut self, from: &mut MailboxInternal, id: UniqueIdent) -> Result<()> {
|
||||
self.copy_internal(from, id, id).await?;
|
||||
from.delete(id).await?;
|
||||
|
|
|
@ -3,6 +3,8 @@ use std::io::Write;
|
|||
|
||||
pub mod incoming;
|
||||
pub mod mailbox;
|
||||
pub mod snapshot;
|
||||
pub mod query;
|
||||
pub mod uidindex;
|
||||
pub mod unique_ident;
|
||||
pub mod user;
|
||||
|
|
0
src/mail/query.rs
Normal file
0
src/mail/query.rs
Normal file
11
src/mail/snapshot.rs
Normal file
11
src/mail/snapshot.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
use std::sync::Arc;
|
||||
use super::mailbox::Mailbox;
|
||||
use super::uidindex::UidIndex;
|
||||
|
||||
pub struct Snapshot {
|
||||
pub mailbox: Arc<Mailbox>,
|
||||
pub snapshot: UidIndex,
|
||||
}
|
||||
|
||||
impl Snapshot {
|
||||
}
|
Loading…
Reference in a new issue