adjust trade subcommand loop
This commit is contained in:
parent
e3f7d10394
commit
bbc2f77b30
2 changed files with 17 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
use std::{collections::HashMap, convert::TryInto, thread, time};
|
use std::{collections::HashMap, convert::TryInto, thread, time};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use confirmation::{Confirmation, ConfirmationType};
|
pub use confirmation::{Confirmation, ConfirmationType};
|
||||||
use hmacsha1::hmac_sha1;
|
use hmacsha1::hmac_sha1;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use reqwest::{Url, cookie::CookieStore, header::{COOKIE, USER_AGENT}};
|
use reqwest::{Url, cookie::CookieStore, header::{COOKIE, USER_AGENT}};
|
||||||
|
|
26
src/main.rs
26
src/main.rs
|
@ -130,19 +130,11 @@ fn main() {
|
||||||
let mut account = a; // why is this necessary?
|
let mut account = a; // why is this necessary?
|
||||||
|
|
||||||
info!("Checking for trade confirmations");
|
info!("Checking for trade confirmations");
|
||||||
|
let confirmations: Vec<Confirmation>;
|
||||||
loop {
|
loop {
|
||||||
match account.get_trade_confirmations() {
|
match account.get_trade_confirmations() {
|
||||||
Ok(confs) => {
|
Ok(confs) => {
|
||||||
for conf in &confs {
|
confirmations = 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Err(_) => {
|
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 {
|
} else {
|
||||||
let server_time = steamapi::get_server_time();
|
let server_time = steamapi::get_server_time();
|
||||||
|
|
Loading…
Reference in a new issue