diff --git a/src/lib.rs b/src/lib.rs index eed5a2d..b51c5ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, convert::TryInto, thread, time}; use anyhow::Result; -use confirmation::{Confirmation, ConfirmationType}; +pub use confirmation::{Confirmation, ConfirmationType}; use hmacsha1::hmac_sha1; use regex::Regex; use reqwest::{Url, cookie::CookieStore, header::{COOKIE, USER_AGENT}}; diff --git a/src/main.rs b/src/main.rs index fb1129c..e3deff5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,19 +130,11 @@ fn main() { let mut account = a; // why is this necessary? info!("Checking for trade confirmations"); + let confirmations: Vec; loop { match account.get_trade_confirmations() { Ok(confs) => { - for conf in &confs { - println!("{}", conf.description()); - } - if trade_matches.is_present("accept-all") { - info!("accepting all confirmations"); - for conf in &confs { - let result = account.accept_confirmation(conf); - debug!("accept confirmation result: {:?}", result); - } - } + confirmations = confs; break; } Err(_) => { @@ -151,6 +143,20 @@ fn main() { } } } + + for conf in &confirmations { + println!("{}", conf.description()); + } + if trade_matches.is_present("accept-all") { + info!("accepting all confirmations"); + for conf in &confirmations { + let result = account.accept_confirmation(conf); + debug!("accept confirmation result: {:?}", result); + } + } + else { + todo!("check atty, show UI for accepting/denying confirmations"); + } } } else { let server_time = steamapi::get_server_time();