This commit is contained in:
Michael Zhang 2021-08-09 06:50:32 -05:00
parent f32dd58aac
commit 4575b33525
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
3 changed files with 12 additions and 11 deletions

View file

@ -3,7 +3,7 @@
mod store; mod store;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use futures::stream::{ StreamExt, }; use futures::stream::StreamExt;
use panorama_imap::{ use panorama_imap::{
client::{auth::Login, ConfigBuilder}, client::{auth::Login, ConfigBuilder},
proto::{ proto::{
@ -73,10 +73,12 @@ pub async fn sync_main(
let new_uids = vec![]; let new_uids = vec![];
// let new_uids = stream::iter(1..exists).map(Ok).try_filter_map(|uid| { // let new_uids = stream::iter(1..exists).map(Ok).try_filter_map(|uid| {
// todo!() // todo!()
// // mail_store.try_identify_email(&acct_name, &folder, uid, uidvalidity, None) // // mail_store.try_identify_email(&acct_name, &folder, uid,
// // // invert the option to only select uids that haven't been downloaded // uidvalidity, None) // // invert the option to
// // .map_ok(move |o| o.map_or_else(move || Some(uid), |v| None)) // only select uids that haven't been downloaded //
// // .map_err(|err| err.context("error checking if the email is already downloaded [try_identify_email]")) // .map_ok(move |o| o.map_or_else(move || Some(uid), |v| None))
// // .map_err(|err| err.context("error checking if the email is
// already downloaded [try_identify_email]"))
// }).try_collect::<Vec<_>>().await?; // }).try_collect::<Vec<_>>().await?;
if !new_uids.is_empty() { if !new_uids.is_empty() {
debug!("fetching uids {:?}", new_uids); debug!("fetching uids {:?}", new_uids);
@ -87,8 +89,8 @@ pub async fn sync_main(
// fetched // fetched
// .map(Ok) // .map(Ok)
// .try_for_each_concurrent(None, |(uid, attrs)| { // .try_for_each_concurrent(None, |(uid, attrs)| {
// mail_store.store_email(&acct_name, &folder, uid, uidvalidity, attrs) // mail_store.store_email(&acct_name, &folder, uid,
// }) // uidvalidity, attrs) })
// .await // .await
// .context("error during fetch-store")?; // .context("error during fetch-store")?;
} }

View file

@ -89,7 +89,8 @@ async fn run_single_mail_account(
let imap_cookie = builder let imap_cookie = builder
.hostname(account.imap.server.clone()) .hostname(account.imap.server.clone())
.port(account.imap.port) .port(account.imap.port)
.tls(matches!(account.imap.tls, TlsMethod::On)).open(); .tls(matches!(account.imap.tls, TlsMethod::On))
.open();
pin_mut!(imap_cookie); pin_mut!(imap_cookie);
pin_mut!(exit); pin_mut!(exit);

View file

@ -239,9 +239,7 @@ impl ClientAuthenticated {
pub async fn idle(&mut self) -> Result<IdleToken> { pub async fn idle(&mut self) -> Result<IdleToken> {
let cmd = Command::Idle; let cmd = Command::Idle;
let stream = self.execute(cmd).await?; let stream = self.execute(cmd).await?;
Ok(IdleToken { Ok(IdleToken { stream })
stream,
})
} }
} }