forgot what tihs update was but im just testing the webhook

This commit is contained in:
Michael Zhang 2021-10-28 16:40:25 -05:00
parent c75113d97f
commit b4c03ad959
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
5 changed files with 15 additions and 21 deletions

View file

@ -1,5 +1,5 @@
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::Path;
use std::sync::mpsc as stdmpsc; use std::sync::mpsc as stdmpsc;
use std::time::Duration; use std::time::Duration;
@ -8,10 +8,7 @@ use futures::future::TryFutureExt;
use notify::{ use notify::{
watcher, DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher, watcher, DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher,
}; };
use tokio::{ use tokio::{sync::watch, task::JoinHandle};
sync::{mpsc, watch},
task::JoinHandle,
};
use xdg::BaseDirectories; use xdg::BaseDirectories;
use super::Config; use super::Config;
@ -46,7 +43,7 @@ pub fn spawn_config_watcher_system() -> Result<(JoinHandle<()>, ConfigWatcher)>
} }
async fn start_notify_stream( async fn start_notify_stream(
mut watcher: RecommendedWatcher, _watcher: RecommendedWatcher,
rx: stdmpsc::Receiver<DebouncedEvent>, rx: stdmpsc::Receiver<DebouncedEvent>,
config_home: impl AsRef<Path>, config_home: impl AsRef<Path>,
config_tx: watch::Sender<Config>, config_tx: watch::Sender<Config>,

View file

@ -1,4 +1,4 @@
use anyhow::Result; use anyhow::{Context, Result};
use sqlx::sqlite::{SqlitePool, SqlitePoolOptions}; use sqlx::sqlite::{SqlitePool, SqlitePoolOptions};
use super::MIGRATOR; use super::MIGRATOR;
@ -13,7 +13,10 @@ impl MailStore {
let pool = SqlitePoolOptions::new().connect(uri.as_ref()).await?; let pool = SqlitePoolOptions::new().connect(uri.as_ref()).await?;
// run migrations, if available // run migrations, if available
MIGRATOR.run(&pool).await?; MIGRATOR
.run(&pool)
.await
.context("could not run migrations on the pool")?;
Ok(MailStore { pool }) Ok(MailStore { pool })
} }

View file

@ -5,16 +5,11 @@ extern crate futures;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use clap::Clap; use clap::Clap;
use futures::future::{ use futures::future::FutureExt;
select,
Either::{Left, Right},
FutureExt,
};
use panorama_daemon::{ use panorama_daemon::{
config::{Config, MailAccountConfig, TlsMethod}, config::{Config, MailAccountConfig},
mail::{sync_main, MailStore}, mail::{sync_main, MailStore},
}; };
use panorama_imap::client::ConfigBuilder;
use tokio::{ use tokio::{
fs::{self, OpenOptions}, fs::{self, OpenOptions},
sync::{mpsc, oneshot}, sync::{mpsc, oneshot},

View file

@ -154,7 +154,7 @@ where
std::mem::drop(read); std::mem::drop(read);
let cmd = self.execute(Command::Capability).await?; let cmd = self.execute(Command::Capability).await?;
let (done, res) = cmd.wait().await?; let (_, res) = cmd.wait().await?;
let mut capabilities = HashSet::new(); let mut capabilities = HashSet::new();
// todo!("done: {:?} {:?}", done, res); // todo!("done: {:?} {:?}", done, res);
@ -193,10 +193,9 @@ where
.execute(Command::Starttls) .execute(Command::Starttls)
.await .await
.context("could not send starttls command")?; .context("could not send starttls command")?;
dbg!(resp resp.wait()
.wait()
.await .await
.context("could not receive starttls response")?); .context("could not receive starttls response")?;
debug!("received OK from server"); debug!("received OK from server");
// issue exit to the read loop and retrieve the read half // issue exit to the read loop and retrieve the read half

View file

@ -90,7 +90,7 @@ impl DisplayBytes for Command {
#[cfg(feature = "rfc2177")] #[cfg(feature = "rfc2177")]
Command::Idle => write_bytes!(w, b"IDLE"), Command::Idle => write_bytes!(w, b"IDLE"),
_ => todo!("unimplemented command"), _ => todo!("unimplemented command: {:?}", self),
} }
} }
} }
@ -167,7 +167,7 @@ impl DisplayBytes for FetchItems {
FetchItems::Fast => write_bytes!(w, b"FAST"), FetchItems::Fast => write_bytes!(w, b"FAST"),
FetchItems::Full => write_bytes!(w, b"FULL"), FetchItems::Full => write_bytes!(w, b"FULL"),
FetchItems::Flags => write_bytes!(w, b"FLAGS"), FetchItems::Flags => write_bytes!(w, b"FLAGS"),
FetchItems::Envelope => write_bytes!(w, b"ENVEOPE"), FetchItems::Envelope => write_bytes!(w, b"ENVELOPE"),
} }
} }
} }