file scoped namespaces (#565)

This commit is contained in:
Aleh Khantsevich
2025-02-16 11:54:23 +01:00
committed by GitHub
parent cf9869b71e
commit 3ddc1a6229
617 changed files with 32107 additions and 32721 deletions

View File

@@ -3,66 +3,65 @@ using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Accounts;
namespace Wino.Services
namespace Wino.Services;
public class SpecialImapProviderConfigResolver : ISpecialImapProviderConfigResolver
{
public class SpecialImapProviderConfigResolver : ISpecialImapProviderConfigResolver
private readonly CustomServerInformation iCloudServerConfig = new CustomServerInformation()
{
private readonly CustomServerInformation iCloudServerConfig = new CustomServerInformation()
IncomingServer = "imap.mail.me.com",
IncomingServerPort = "993",
IncomingServerType = CustomIncomingServerType.IMAP4,
IncomingServerSocketOption = ImapConnectionSecurity.Auto,
IncomingAuthenticationMethod = ImapAuthenticationMethod.Auto,
OutgoingServer = "smtp.mail.me.com",
OutgoingServerPort = "587",
OutgoingServerSocketOption = ImapConnectionSecurity.Auto,
OutgoingAuthenticationMethod = ImapAuthenticationMethod.Auto,
MaxConcurrentClients = 5,
};
private readonly CustomServerInformation yahooServerConfig = new CustomServerInformation()
{
IncomingServer = "imap.mail.yahoo.com",
IncomingServerPort = "993",
IncomingServerType = CustomIncomingServerType.IMAP4,
IncomingServerSocketOption = ImapConnectionSecurity.Auto,
IncomingAuthenticationMethod = ImapAuthenticationMethod.Auto,
OutgoingServer = "smtp.mail.yahoo.com",
OutgoingServerPort = "587",
OutgoingServerSocketOption = ImapConnectionSecurity.Auto,
OutgoingAuthenticationMethod = ImapAuthenticationMethod.Auto,
MaxConcurrentClients = 5,
};
public CustomServerInformation GetServerInformation(MailAccount account, AccountCreationDialogResult dialogResult)
{
CustomServerInformation resolvedConfig = null;
if (dialogResult.SpecialImapProviderDetails.SpecialImapProvider == SpecialImapProvider.iCloud)
{
IncomingServer = "imap.mail.me.com",
IncomingServerPort = "993",
IncomingServerType = CustomIncomingServerType.IMAP4,
IncomingServerSocketOption = ImapConnectionSecurity.Auto,
IncomingAuthenticationMethod = ImapAuthenticationMethod.Auto,
OutgoingServer = "smtp.mail.me.com",
OutgoingServerPort = "587",
OutgoingServerSocketOption = ImapConnectionSecurity.Auto,
OutgoingAuthenticationMethod = ImapAuthenticationMethod.Auto,
MaxConcurrentClients = 5,
};
resolvedConfig = iCloudServerConfig;
private readonly CustomServerInformation yahooServerConfig = new CustomServerInformation()
{
IncomingServer = "imap.mail.yahoo.com",
IncomingServerPort = "993",
IncomingServerType = CustomIncomingServerType.IMAP4,
IncomingServerSocketOption = ImapConnectionSecurity.Auto,
IncomingAuthenticationMethod = ImapAuthenticationMethod.Auto,
OutgoingServer = "smtp.mail.yahoo.com",
OutgoingServerPort = "587",
OutgoingServerSocketOption = ImapConnectionSecurity.Auto,
OutgoingAuthenticationMethod = ImapAuthenticationMethod.Auto,
MaxConcurrentClients = 5,
};
public CustomServerInformation GetServerInformation(MailAccount account, AccountCreationDialogResult dialogResult)
{
CustomServerInformation resolvedConfig = null;
if (dialogResult.SpecialImapProviderDetails.SpecialImapProvider == SpecialImapProvider.iCloud)
{
resolvedConfig = iCloudServerConfig;
// iCloud takes username before the @icloud part for incoming, but full address as outgoing.
resolvedConfig.IncomingServerUsername = dialogResult.SpecialImapProviderDetails.Address.Split('@')[0];
resolvedConfig.OutgoingServerUsername = dialogResult.SpecialImapProviderDetails.Address;
}
else if (dialogResult.SpecialImapProviderDetails.SpecialImapProvider == SpecialImapProvider.Yahoo)
{
resolvedConfig = yahooServerConfig;
// Yahoo uses full address for both incoming and outgoing.
resolvedConfig.IncomingServerUsername = dialogResult.SpecialImapProviderDetails.Address;
resolvedConfig.OutgoingServerUsername = dialogResult.SpecialImapProviderDetails.Address;
}
// Fill in account details.
resolvedConfig.Address = dialogResult.SpecialImapProviderDetails.Address;
resolvedConfig.IncomingServerPassword = dialogResult.SpecialImapProviderDetails.Password;
resolvedConfig.OutgoingServerPassword = dialogResult.SpecialImapProviderDetails.Password;
resolvedConfig.DisplayName = dialogResult.SpecialImapProviderDetails.SenderName;
return resolvedConfig;
// iCloud takes username before the @icloud part for incoming, but full address as outgoing.
resolvedConfig.IncomingServerUsername = dialogResult.SpecialImapProviderDetails.Address.Split('@')[0];
resolvedConfig.OutgoingServerUsername = dialogResult.SpecialImapProviderDetails.Address;
}
else if (dialogResult.SpecialImapProviderDetails.SpecialImapProvider == SpecialImapProvider.Yahoo)
{
resolvedConfig = yahooServerConfig;
// Yahoo uses full address for both incoming and outgoing.
resolvedConfig.IncomingServerUsername = dialogResult.SpecialImapProviderDetails.Address;
resolvedConfig.OutgoingServerUsername = dialogResult.SpecialImapProviderDetails.Address;
}
// Fill in account details.
resolvedConfig.Address = dialogResult.SpecialImapProviderDetails.Address;
resolvedConfig.IncomingServerPassword = dialogResult.SpecialImapProviderDetails.Password;
resolvedConfig.OutgoingServerPassword = dialogResult.SpecialImapProviderDetails.Password;
resolvedConfig.DisplayName = dialogResult.SpecialImapProviderDetails.SenderName;
return resolvedConfig;
}
}