Refactored impa synchronization.

This commit is contained in:
Burak Kaan Köse
2026-02-14 12:52:17 +01:00
parent 4a0dcd2899
commit 744145be06
26 changed files with 1492 additions and 1243 deletions
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
namespace Wino.Core.Integration;
internal sealed class ImapServerQuirkProfile
{
public static readonly ImapServerQuirkProfile Default = new();
public bool DisableQResync { get; init; }
public bool DisableCondstore { get; init; }
public bool UseConservativeConnections { get; init; }
}
internal static class ImapServerQuirks
{
private static readonly Dictionary<string, ImapServerQuirkProfile> Quirks = new(StringComparer.OrdinalIgnoreCase)
{
// Some strict providers are more stable with conservative behavior.
["qq.com"] = new ImapServerQuirkProfile { DisableQResync = true, UseConservativeConnections = true },
["163.com"] = new ImapServerQuirkProfile { DisableQResync = true, UseConservativeConnections = true },
["126.com"] = new ImapServerQuirkProfile { DisableQResync = true, UseConservativeConnections = true },
["yeah.net"] = new ImapServerQuirkProfile { DisableQResync = true, UseConservativeConnections = true }
};
public static ImapServerQuirkProfile Resolve(string host)
{
if (string.IsNullOrWhiteSpace(host))
return ImapServerQuirkProfile.Default;
foreach (var (key, profile) in Quirks)
{
if (host.Contains(key, StringComparison.OrdinalIgnoreCase))
return profile;
}
return ImapServerQuirkProfile.Default;
}
}