aboutsummaryrefslogtreecommitdiff
path: root/src/process_mail.rs
blob: 5a22ce1cd4e5a679b7d7ff61973bb54ecc71d1be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use anyhow::Result;
use tokio::sync::mpsc::{Receiver, Sender};

use crate::model::Mail;

struct MailProcessor {
    rx: Receiver<Mail>,
    tx: Sender<Mail>,
}

// TODO: Store first then forward. On complete forward remove from db, otherwise save db with the
// emails to send to.
impl MailProcessor {
    async fn run(&mut self) -> Result<()> {
        // TODO: Check againts self.rx.is_closed() instead to stop the program before consuming all
        // of the queue. Store the emails not yet processed and restore the queue upon startup.
        while let Some(mail) = self.rx.recv().await {
            todo!()
        }

        Ok(())
    }
}
XMR address: 854DmXNrxULU3ZFJVs4Wc8PFhbq29RhqHhY8W6cdWrtFN3qmooKyyeYPcDzZTNRxphhJ5UzASQfAdEMwSteVqymk28aLhqj