mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-27 19:26:26 +02:00
Skip suggesting no-reply addresses of received messages
This commit is contained in:
@@ -1148,7 +1148,9 @@ public class FragmentCompose extends FragmentBase {
|
||||
if (suggest_sent)
|
||||
items.addAll(db.contact().searchContacts(null, EntityContact.TYPE_TO, wildcard));
|
||||
if (suggest_received)
|
||||
items.addAll(db.contact().searchContacts(null, EntityContact.TYPE_FROM, wildcard));
|
||||
for (EntityContact item : db.contact().searchContacts(null, EntityContact.TYPE_FROM, wildcard))
|
||||
if (!MessageHelper.isNoReply(item.email))
|
||||
items.add(item);
|
||||
for (EntityContact item : items) {
|
||||
EntityContact existing = map.get(item.email);
|
||||
if (existing == null)
|
||||
|
||||
@@ -5284,21 +5284,27 @@ public class MessageHelper {
|
||||
static boolean isNoReply(Address address) {
|
||||
if (address instanceof InternetAddress) {
|
||||
String email = ((InternetAddress) address).getAddress();
|
||||
String username = UriHelper.getEmailUser(email);
|
||||
String domain = UriHelper.getEmailDomain(email);
|
||||
if (isNoReply(email))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(username)) {
|
||||
username = username.toLowerCase(Locale.ROOT);
|
||||
for (String value : DO_NOT_REPLY)
|
||||
if (username.contains(value))
|
||||
return true;
|
||||
}
|
||||
if (!TextUtils.isEmpty(domain)) {
|
||||
domain = domain.toLowerCase(Locale.ROOT);
|
||||
for (String value : DO_NOT_REPLY)
|
||||
if (domain.startsWith(value))
|
||||
return true;
|
||||
}
|
||||
static boolean isNoReply(String email) {
|
||||
String username = UriHelper.getEmailUser(email);
|
||||
if (!TextUtils.isEmpty(username)) {
|
||||
username = username.toLowerCase(Locale.ROOT);
|
||||
for (String value : DO_NOT_REPLY)
|
||||
if (username.contains(value))
|
||||
return true;
|
||||
}
|
||||
|
||||
String domain = UriHelper.getEmailDomain(email);
|
||||
if (!TextUtils.isEmpty(domain)) {
|
||||
domain = domain.toLowerCase(Locale.ROOT);
|
||||
for (String value : DO_NOT_REPLY)
|
||||
if (domain.startsWith(value))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user