Skip to content

Commit

Permalink
Volvo and it's 7-days locks
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Oct 29, 2015
1 parent 7c9e5d8 commit abe3bea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
16 changes: 15 additions & 1 deletion ArchiSteamFarm/ArchiWebHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,21 @@ internal async Task<bool> AcceptTradeOffer(ulong tradeID) {
{"tradeofferid", tradeID.ToString()}
};

return await Utilities.UrlPostRequest(request, postData, SteamCookieDictionary, referer).ConfigureAwait(false);
HttpResponseMessage result = await Utilities.UrlPostRequestWithResponse(request, postData, SteamCookieDictionary, referer).ConfigureAwait(false);
bool success = result.IsSuccessStatusCode;

if (!success) {
Logging.LogGenericWarning(Bot.BotName, "Request failed, reason: " + result.ReasonPhrase);
switch (result.StatusCode) {
case HttpStatusCode.InternalServerError:
Logging.LogGenericWarning(Bot.BotName, "That might be caused by 7-days trade lock from new device");
Logging.LogGenericWarning(Bot.BotName, "Try again in 7 days, declining that offer for now");
DeclineTradeOffer(tradeID);
break;
}
}

return success;
}

internal bool DeclineTradeOffer(ulong tradeID) {
Expand Down
4 changes: 0 additions & 4 deletions ArchiSteamFarm/Trading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ private async Task ParseTrade(SteamTradeOffer tradeOffer) {
success = Bot.ArchiWebHandler.DeclineTradeOffer(tradeID);
}

if (!success) {
Logging.LogGenericWarning(Bot.BotName, "Response <accept: " + tradeAccepted + "> to trade " + tradeID + " failed!");
}

if (tradeAccepted && success) {
// Do whatever we want with success
}
Expand Down
2 changes: 1 addition & 1 deletion ArchiSteamFarm/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ internal static async Task<HttpResponseMessage> UrlPostRequestWithResponse(strin
requestMessage.Headers.Referrer = new Uri(referer);
}
HttpResponseMessage responseMessage = await client.SendAsync(requestMessage).ConfigureAwait(false);
if (responseMessage != null && responseMessage.IsSuccessStatusCode) {
if (responseMessage != null) {
result = responseMessage;
}
}
Expand Down

0 comments on commit abe3bea

Please sign in to comment.