diff --git a/Cargo.lock b/Cargo.lock index 57703ae..66e6c76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1860,16 +1860,6 @@ dependencies = [ "webpki-roots", ] -[[package]] -name = "panorama-maildir" -version = "0.1.0" -dependencies = [ - "anyhow", - "futures 0.3.13", - "tempfile", - "tokio 1.3.0", -] - [[package]] name = "panorama-smtp" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index cd7cb8a..e8a55a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,6 @@ license = "GPL-3.0-or-later" members = [ "imap", "smtp", - "maildir", ] [dependencies] diff --git a/maildir/Cargo.toml b/maildir/Cargo.toml deleted file mode 100644 index 650af4c..0000000 --- a/maildir/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "panorama-maildir" -version = "0.1.0" -authors = ["Michael Zhang "] -edition = "2018" - -[dependencies] -anyhow = "1.0.39" -futures = "0.3.13" -tempfile = "3.2.0" -tokio = { version = "1.3.0", features = ["full"] } diff --git a/maildir/src/lib.rs b/maildir/src/lib.rs deleted file mode 100644 index 1b85bfd..0000000 --- a/maildir/src/lib.rs +++ /dev/null @@ -1,65 +0,0 @@ -use std::path::{Path, PathBuf}; - -use anyhow::Result; -use tempfile::NamedTempFile; -use tokio::fs::{self, File, OpenOptions}; - -/// A Maildir, as defined by [Daniel J. Bernstein][1]. -/// -/// [1]: https://cr.yp.to/proto/maildir.html -pub struct Maildir { - path: PathBuf, -} - -impl Maildir { - // TODO: should this double as create (aka create tmp cur new if they don't exist)? - pub async fn open(path: impl AsRef) -> Result { - Ok(Maildir { - path: path.as_ref().to_path_buf(), - }) - } - - /// Stores a new message into the `new` directory - // TODO: maybe have a streaming option? - pub async fn store(&self, opts: StoreOptions) -> Result { - let unique_name = opts.create_unique_name(); - let tmp_file = self.tmp_dir().join(&unique_name); - { - let mut file = OpenOptions::new() - .create_new(true) // fail if the file already exists, this means we aren't unique! - .open(&tmp_file) - .await?; - } - - let new_file = self.new_dir().join(&unique_name); - fs::rename(&tmp_file, &new_file).await?; - Ok(new_file) - } - - /// Returns the path to the `tmp` subdirectory - #[inline] - pub fn tmp_dir(&self) -> PathBuf { - self.path.join("tmp") - } - - /// Returns the path to the `new` subdirectory - #[inline] - pub fn new_dir(&self) -> PathBuf { - self.path.join("new") - } - - /// Returns the path to the `cur` subdirectory - #[inline] - pub fn cur_dir(&self) -> PathBuf { - self.path.join("cur") - } -} - -/// Options that will be used to determine the filename it's stored to -pub struct StoreOptions {} - -impl StoreOptions { - pub fn create_unique_name(&self) -> String { - format!("") - } -} diff --git a/src/mail/client.rs b/src/mail/client.rs index 564ebb2..e8b707e 100644 --- a/src/mail/client.rs +++ b/src/mail/client.rs @@ -84,7 +84,6 @@ pub async fn imap_main( let mut message_list = authed.uid_fetch(&message_uids).await.unwrap(); while let Some((uid, attrs)) = message_list.next().await { let evt = MailEvent::UpdateUid(acct_name.clone(), uid, attrs); - // debug!("sent {:?}", evt); mail2ui_tx.send(evt); }