From cca70f33e5c435e05091a9e721389122f652d321 Mon Sep 17 00:00:00 2001 From: Archi Date: Fri, 5 May 2023 19:53:45 +0200 Subject: [PATCH] Closes #2891 We used user initiated before as a neat way to let plugins know that the disconnection was initiated by us. Since we use it in other situations now, namely as a result of failed login, we can't do it like this anymore. Instead, trust last log on result, and set it to OK where the disconnection was clean and expected. --- ArchiSteamFarm/Steam/Bot.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index ef0204fba..3cbeb37a4 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -1848,6 +1848,8 @@ public sealed class Bot : IAsyncDisposable, IDisposable { return; } + LastLogOnResult = EResult.Invalid; + ArchiLogger.LogGenericInfo(Strings.BotConnecting); InitConnectionFailureTimer(); SteamClient.Connect(); @@ -1873,6 +1875,8 @@ public sealed class Bot : IAsyncDisposable, IDisposable { private void Disconnect() { StopConnectionFailureTimer(); + + LastLogOnResult = EResult.OK; SteamClient.Disconnect(); } @@ -2578,7 +2582,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable { FirstTradeSent = false; OwnedPackageIDs = ImmutableDictionary.Empty; - await PluginsCore.OnBotDisconnected(this, callback.UserInitiated ? EResult.OK : lastLogOnResult).ConfigureAwait(false); + await PluginsCore.OnBotDisconnected(this, lastLogOnResult).ConfigureAwait(false); // If we initiated disconnect, do not attempt to reconnect if (callback.UserInitiated && !ReconnectOnUserInitiated) {