Files
AI-Studio/app/MindWork AI Studio/Tools/Mail/MailboxConnectionFailureExtensions.cs
T

29 lines
2.4 KiB
C#

using AIStudio.Tools.PluginSystem;
namespace AIStudio.Tools.Mail;
public static class MailboxConnectionFailureExtensions
{
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(MailboxConnectionFailureExtensions).Namespace, nameof(MailboxConnectionFailureExtensions));
private static string TA(string fallbackEN) => I18N.I.TA(fallbackEN, typeof(MailboxConnectionFailureExtensions).Namespace, nameof(MailboxConnectionFailureExtensions));
extension(MailboxConnectionFailure failure)
{
/// <summary>
/// What went wrong, and what the user can do about it.
/// </summary>
public string Description => failure switch
{
MailboxConnectionFailure.AUTHENTICATION_FAILED => TA("The server rejected the username or the password. Some providers require an app password instead of your usual password."),
MailboxConnectionFailure.NETWORK_UNAVAILABLE => TA("The server could not be reached. Please check the host and the port, and whether you need a VPN connection."),
MailboxConnectionFailure.TLS_FAILED => TA("No encrypted connection to the server could be established. When your organization uses a certificate authority of its own, enable the additional root certificates in the app settings, select the bundle with its root certificate, and add the host of the server to the allowed hosts. Your IT department can also configure this for you."),
MailboxConnectionFailure.SERVER_ERROR => TA("The server reported an error. Please try again later."),
MailboxConnectionFailure.INVALID_SETTINGS => TB("The settings of this mailbox are incomplete, or they were made by a newer version of AI Studio."),
MailboxConnectionFailure.SERVER_NOT_ALLOWED => TA("Your organization allows mailboxes only on its own mail servers, and this server is none of them. AI Studio does not connect to it, and the AI does not read this mailbox."),
MailboxConnectionFailure.UNSUITABLE_ENCODING => TA("The chosen encoding cannot carry your username or your password to this server: it lacks one of their characters, or the server accepts no other encoding than UTF-8. AI Studio did not try to sign in, so that your account is not locked. Choose another encoding in the server details of the mailbox, or ask your IT department which one the server expects."),
_ => TB("The connection to the server failed for an unknown reason."),
};
}
}