Ignore blocklist for contacts

pull/194/merge
M66B 3 years ago
parent c5741053d3
commit a180392a18

@ -873,22 +873,35 @@ public class ContactInfo {
}
}
static Uri getLookupUri(List<Address> addresses) {
return getLookupUri(addresses.toArray(new Address[0]));
}
static Uri getLookupUri(Address[] addresses) {
if (addresses == null)
return null;
for (Address from : addresses) {
String email = ((InternetAddress) from).getAddress();
if (!TextUtils.isEmpty(email)) {
Lookup lookup = emailLookup.get(email.toLowerCase(Locale.ROOT));
if (lookup != null)
return lookup.uri;
}
if (TextUtils.isEmpty(email))
continue;
Lookup lookup = emailLookup.get(email.toLowerCase(Locale.ROOT));
if (lookup != null)
return lookup.uri;
}
return null;
}
static Uri getLookupUri(String email) {
if (TextUtils.isEmpty(email))
return null;
Lookup lookup = emailLookup.get(email.toLowerCase(Locale.ROOT));
return (lookup == null ? null : lookup.uri);
}
static Address[] fillIn(Address[] addresses, boolean prefer_contact, boolean only_contact) {
if (addresses == null)
return null;

@ -155,6 +155,9 @@ public class DnsBlockList {
}
static Boolean isJunk(Context context, List<Address> addresses) {
if (ContactInfo.getLookupUri(addresses) != null)
return false;
boolean hasDomain = false;
for (Address address : addresses) {
String email = ((InternetAddress) address).getAddress();
@ -165,6 +168,7 @@ public class DnsBlockList {
if (isJunk(context, domain, false, BLOCK_LISTS))
return true;
}
return (hasDomain ? false : null);
}
@ -172,6 +176,14 @@ public class DnsBlockList {
String domain = null;
if ("mailto".equalsIgnoreCase(uri.getScheme())) {
MailTo email = MailTo.parse(uri.toString());
String to = email.getTo();
if (TextUtils.isEmpty(to))
return null;
if (ContactInfo.getLookupUri(to) != null)
return false;
domain = UriHelper.getEmailDomain(email.getTo());
} else
domain = uri.getHost();

Loading…
Cancel
Save