|
|
|
@ -382,11 +382,10 @@ public class EmailProvider implements Parcelable {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
|
static List<EmailProvider> fromEmail(Context context, String email, Discover discover, IDiscovery intf) throws IOException {
|
|
|
|
|
int at = email.indexOf('@');
|
|
|
|
|
String domain = (at < 0 ? email : email.substring(at + 1));
|
|
|
|
|
if (at < 0)
|
|
|
|
|
email = "someone@" + domain;
|
|
|
|
|
static List<EmailProvider> fromEmail(Context context, String _email, Discover discover, IDiscovery intf) throws IOException {
|
|
|
|
|
int at = _email.indexOf('@');
|
|
|
|
|
String domain = (at < 0 ? _email : _email.substring(at + 1));
|
|
|
|
|
String email = (at < 0 ? "someone@" + domain : _email);
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(domain))
|
|
|
|
|
throw new UnknownHostException(context.getString(R.string.title_setup_no_settings, domain));
|
|
|
|
@ -560,16 +559,17 @@ public class EmailProvider implements Parcelable {
|
|
|
|
|
Collections.sort(candidates, new Comparator<EmailProvider>() {
|
|
|
|
|
@Override
|
|
|
|
|
public int compare(EmailProvider p1, EmailProvider p2) {
|
|
|
|
|
return -Integer.compare(p1.getScore(), p2.getScore());
|
|
|
|
|
return -Integer.compare(p1.getScore(email), p2.getScore(email));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Log candidates
|
|
|
|
|
for (EmailProvider candidate : candidates)
|
|
|
|
|
EntityLog.log(context, "Candidate" +
|
|
|
|
|
" score=" + candidate.getScore() +
|
|
|
|
|
" score=" + candidate.getScore(email) +
|
|
|
|
|
" imap=" + candidate.imap +
|
|
|
|
|
" smtp=" + candidate.smtp);
|
|
|
|
|
" smtp=" + candidate.smtp +
|
|
|
|
|
" user=" + candidate.username);
|
|
|
|
|
|
|
|
|
|
// Remove duplicates
|
|
|
|
|
List<EmailProvider> result = new ArrayList<>();
|
|
|
|
@ -1059,10 +1059,11 @@ public class EmailProvider implements Parcelable {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private int getScore() {
|
|
|
|
|
private int getScore(String email) {
|
|
|
|
|
if (imap == null || smtp == null)
|
|
|
|
|
return -1;
|
|
|
|
|
return imap.score + smtp.score;
|
|
|
|
|
return imap.score + smtp.score +
|
|
|
|
|
(TextUtils.isEmpty(username) || username.equalsIgnoreCase(email) ? 0 : 100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1097,6 +1098,7 @@ public class EmailProvider implements Parcelable {
|
|
|
|
|
// +2 trusted host
|
|
|
|
|
// +1 trusted DNS name
|
|
|
|
|
// 20 from autoconfig
|
|
|
|
|
// +100 with username
|
|
|
|
|
// 50 from DNS
|
|
|
|
|
// 100 from profile
|
|
|
|
|
|
|
|
|
|