|
@@ -271,36 +271,6 @@ pub async fn delete_folder(name: String) -> anyhow::Result<()>{
|
|
|
Ok(())
|
|
|
}
|
|
|
|
|
|
-// #[cfg(target_os = "wasi")]
|
|
|
-// pub async fn check_for_updates(mailbox: String) -> anyhow::Result<()>{
|
|
|
-// let mut client = connect_to_imap_server(Config::global().imap_domain.clone(), Config::global().imap_port.clone() as u16).await?;
|
|
|
-// client.login(Config::global().username.clone(), Config::global().password.clone()).await?;
|
|
|
-//
|
|
|
-// client.select(mailbox).await?;
|
|
|
-// let mut id = client.idle().await?;
|
|
|
-//
|
|
|
-// println!("Start looking for updates");
|
|
|
-// loop {
|
|
|
-// println!("UPDATE loop");
|
|
|
-// client.read_response_by_keyword("EXISTS".to_string()).await?;
|
|
|
-//
|
|
|
-// // TODO do not update all emails (IMAP returns * {number} RECENT) and do it only for one mailbox
|
|
|
-// let new_paths = download_email_from_imap().await.expect("Cannot download new emails");
|
|
|
-//
|
|
|
-// for (uid, path) in new_paths.clone() {
|
|
|
-// match add_email(path.clone(), uid.clone()){
|
|
|
-// Ok(_) => {}
|
|
|
-// Err(_) => {println!("Error adding email from {:?}", path.clone())}
|
|
|
-// };
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// client.idle_done().await;
|
|
|
-// client.logout().await;
|
|
|
-// Ok(())
|
|
|
-// }
|
|
|
-//
|
|
|
-
|
|
|
pub async fn check_for_updates(mailbox: String) -> anyhow::Result<()> {
|
|
|
task::spawn(async move {
|
|
|
let mut client = match connect_to_imap().await {
|