Files
AI-Studio/app/MindWork AI Studio/Tools/Databases/IndexStore/MailboxAuthFailure.cs
T
Thorsten Sommer c4400c0ff6
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Added mailboxes as local data sources (#1022)
2026-10-04 12:26:26 +02:00

29 lines
1.3 KiB
C#

namespace AIStudio.Tools.Databases.IndexStore;
/// <summary>
/// A sign-in the server of a mailbox refused.
/// </summary>
/// <param name="FailedAtUtc">When the server refused the sign-in.</param>
/// <param name="FailureMessage">What the server answered, empty when it gave no reason.</param>
public sealed record MailboxAuthFailure(DateTimeOffset FailedAtUtc, string FailureMessage)
{
/// <summary>
/// How much of the answer of the server is kept. The reason is in the first sentence, if at all.
/// </summary>
public const int MAX_FAILURE_MESSAGE_LENGTH = 500;
/// <summary>
/// Records a sign-in the server refused just now, together with what it answered.
/// </summary>
/// <remarks>
/// The answer often says why, e.g., that the provider requires an app password. It may name
/// the user as well, which is why it is kept for the settings of the mailbox and never logged.
/// </remarks>
/// <param name="serverAnswer">What the server answered.</param>
/// <returns>The refused sign-in.</returns>
public static MailboxAuthFailure FromServerAnswer(string serverAnswer)
{
var trimmedAnswer = serverAnswer.Trim();
return new(DateTimeOffset.UtcNow, trimmedAnswer.Length > MAX_FAILURE_MESSAGE_LENGTH ? trimmedAnswer[..MAX_FAILURE_MESSAGE_LENGTH] : trimmedAnswer);
}
}