mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 09:47:13 +00:00
Find provider by host
This commit is contained in:
parent
09de7c36f4
commit
14087eb744
2 changed files with 17 additions and 5 deletions
|
@ -333,6 +333,17 @@ public class EmailProvider implements Parcelable {
|
|||
throw new FileNotFoundException("provider id=" + id);
|
||||
}
|
||||
|
||||
static EmailProvider getProviderByHost(Context context, @NonNull String host) {
|
||||
for (EmailProvider provider : loadProfiles(context)) {
|
||||
if (provider.imap != null && host.equals(provider.imap.host))
|
||||
return provider;
|
||||
if (provider.smtp != null && host.equals(provider.smtp.host))
|
||||
return provider;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<EmailProvider> getProviders(Context context) {
|
||||
List<EmailProvider> result = new ArrayList<>();
|
||||
for (EmailProvider provider : loadProfiles(context))
|
||||
|
|
|
@ -432,14 +432,15 @@ public class EmailService implements AutoCloseable {
|
|||
}
|
||||
|
||||
boolean strict = ssl_harden_strict;
|
||||
if (strict && provider != null)
|
||||
try {
|
||||
EmailProvider p = EmailProvider.getProvider(context, provider);
|
||||
if ("1.2".equals(p.maxtls)) {
|
||||
if (strict)
|
||||
if ("pop3".equals(protocol) || "pop3s".equals(protocol))
|
||||
strict = false;
|
||||
else {
|
||||
EmailProvider p = EmailProvider.getProviderByHost(context, host);
|
||||
if (p != null && "1.2".equals(p.maxtls)) {
|
||||
strict = false;
|
||||
Log.i(p.name + " maxtls=" + p.maxtls);
|
||||
}
|
||||
} catch (FileNotFoundException ignored) {
|
||||
}
|
||||
|
||||
factory = new SSLSocketFactoryService(host, insecure, ssl_harden, strict, cert_strict, key, chain, fingerprint);
|
||||
|
|
Loading…
Reference in a new issue