From 508429ff5dbf6cffef76767b0ffdea3222171630 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Wed, 24 Feb 2021 04:01:18 -0600 Subject: [PATCH] Update deps --- Cargo.lock | 47 ++++++++++++++++++++---------------------- Cargo.toml | 6 +++--- imap/src/parser/mod.rs | 9 ++++++-- src/mail/mod.rs | 3 ++- src/main.rs | 5 +++++ src/ui/mod.rs | 6 ++++-- 6 files changed, 43 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f1b8cb9..46c0c4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -313,9 +313,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" +checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" dependencies = [ "futures-channel", "futures-core", @@ -328,9 +328,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" dependencies = [ "futures-core", "futures-sink", @@ -338,15 +338,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" +checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" [[package]] name = "futures-executor" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" +checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" dependencies = [ "futures-core", "futures-task", @@ -355,15 +355,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" +checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" [[package]] name = "futures-macro" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" +checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -373,24 +373,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" +checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" [[package]] name = "futures-task" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" -dependencies = [ - "once_cell", -] +checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" [[package]] name = "futures-util" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" dependencies = [ "futures-channel", "futures-core", @@ -523,9 +520,9 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "mio" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc250d6848c90d719ea2ce34546fb5df7af1d3fd189d10bf7bad80bfcebecd95" +checksum = "a5dede4e2065b3842b8b0af444119f3aa331cc7cc2dd20388bfb0f5d5a38823a" dependencies = [ "libc", "log", @@ -584,9 +581,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.5.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" +checksum = "4ad167a2f54e832b82dbe003a046280dceffe5227b5f79e08e363a29638cfddd" [[package]] name = "opaque-debug" diff --git a/Cargo.toml b/Cargo.toml index d2d8d55..9eb31d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,16 +19,16 @@ chrono = "0.4.19" crossterm = "0.19.0" fern = { version = "0.6.0", features = ["colored"] } format-bytes = "0.2.0" -futures = "0.3.12" +futures = "0.3.13" inotify = { version = "0.9.2", features = ["stream"] } log = "0.4.14" panorama-imap = { path = "imap", version = "0" } parking_lot = "0.11.1" -pin-project = "1.0.4" +pin-project = "1.0.5" rustls-connector = "0.13.1" serde = { version = "1.0.123", features = ["derive"] } structopt = "0.3.21" -tokio = { version = "1.1.1", features = ["full"] } +tokio = { version = "1.2.0", features = ["full"] } tokio-rustls = "0.22.0" tokio-stream = { version = "0.1.3", features = ["sync"] } tokio-util = { version = "0.6.3", features = ["full"] } diff --git a/imap/src/parser/mod.rs b/imap/src/parser/mod.rs index c7191ca..9ab8b71 100644 --- a/imap/src/parser/mod.rs +++ b/imap/src/parser/mod.rs @@ -289,9 +289,7 @@ fn build_mailbox_list(pair: Pair) -> (Vec, Option, String) let pairs_ = pair.into_inner(); let mut flags = Vec::new(); for pair in pairs_ { - debug!("pair: {:?}", pair); flags.extend(build_mbx_list_flags(pair)); - debug!("flags: {:?}", flags); } pair = pairs.next().unwrap(); flags @@ -314,11 +312,14 @@ fn build_mbx_list_flags(pair: Pair) -> Vec { pair.into_inner().map(|pair| pair.as_str().to_owned()).collect() } +/// Unwraps a singleton pair (a pair that only has one element in its `inner` list) fn unwrap1(pair: Pair) -> Pair { let mut pairs = pair.into_inner(); pairs.next().unwrap() } +/// Extracts a numerical type, generic over anything that could possibly be read as a number +// TODO: should probably restrict this to a few cases fn build_number(pair: Pair) -> T where T: FromStr, @@ -330,6 +331,9 @@ where pair.as_str().parse::().unwrap() } +/// Wrapper around [build_string][1], except return None for the `nil` case +/// +/// [1]: self::build_string fn build_nstring(pair: Pair) -> Option { if matches!(pair.as_rule(), Rule::nil) { return None; @@ -337,6 +341,7 @@ fn build_nstring(pair: Pair) -> Option { Some(build_string(pair)) } +/// Extracts a string-type, discarding the surrounding quotes and unescaping the escaped characters fn build_string(pair: Pair) -> String { // TODO: actually get rid of the quotes and escaped chars pair.as_str().to_owned() diff --git a/src/mail/mod.rs b/src/mail/mod.rs index aa1cc4e..7397b38 100644 --- a/src/mail/mod.rs +++ b/src/mail/mod.rs @@ -104,7 +104,8 @@ async fn imap_main(acct: MailAccountConfig) -> Result<()> { loop { debug!("listing all emails..."); - authed.list().await?; + let folder_tree = authed.list().await?; + tokio::time::sleep(std::time::Duration::from_secs(60)).await; debug!("heartbeat"); } diff --git a/src/main.rs b/src/main.rs index d419b6b..77b4a72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,11 @@ struct Opt { /// Run this application headlessly #[structopt(long = "headless")] headless: bool, + + /// Don't watch the config file for changes. (NYI) + // TODO: implement this or decide if it's useless + #[structopt(long = "no-watch-config")] + _no_watch_config: bool, } fn main() -> Result<()> { diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 58005c3..32d0918 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -12,7 +12,7 @@ use crossterm::{ cursor, event::{self, Event, KeyCode, KeyEvent}, style::{self, Color}, - terminal, + terminal::{self, ClearType}, }; use tokio::time; @@ -35,12 +35,14 @@ pub async fn run_ui(mut w: impl Write + Debug, exit: ExitSender) -> Result<()> { table.push_row(vec!["ur mom Lol!".to_owned()]); table.push_row(vec!["hek".to_owned()]); + let dirty = false; + loop { queue!( w, style::SetBackgroundColor(Color::Reset), style::SetForegroundColor(Color::Reset), - // terminal::Clear(ClearType::All), + terminal::Clear(ClearType::All), cursor::MoveTo(0, 0), )?;