Refactoring

pull/209/head
M66B 2 years ago
parent 48e6125ebc
commit e241522132

@ -4308,27 +4308,12 @@ class Core {
boolean check_blocklist = prefs.getBoolean("check_blocklist", false);
if (check_blocklist) {
boolean notJunk = false;
if (message.from != null)
for (Address from : message.from) {
String email = ((InternetAddress) from).getAddress();
if (TextUtils.isEmpty(email))
continue;
EntityContact contact = db.contact().getContact(message.account, EntityContact.TYPE_NO_JUNK, email);
if (contact != null) {
contact.times_contacted++;
contact.last_contacted = new Date().getTime();
db.contact().updateContact(contact);
notJunk = true;
}
}
if (!have &&
!EntityFolder.isOutgoing(folder.type) &&
!EntityFolder.ARCHIVE.equals(folder.type) &&
!EntityFolder.TRASH.equals(folder.type) &&
!EntityFolder.JUNK.equals(folder.type) &&
!notJunk &&
!message.isNotJunk(context) &&
!Arrays.asList(message.keywords).contains(MessageHelper.FLAG_NOT_JUNK))
try {
message.blocklist = DnsBlockList.isJunk(context,

@ -373,6 +373,26 @@ public class EntityMessage implements Serializable {
!EntityMessage.SMIME_SIGNENCRYPT.equals(encrypt));
}
boolean isNotJunk(Context context) {
DB db = DB.getInstance(context);
boolean notJunk = false;
for (Address sender : from) {
String email = ((InternetAddress) sender).getAddress();
if (TextUtils.isEmpty(email))
continue;
EntityContact contact = db.contact().getContact(account, EntityContact.TYPE_NO_JUNK, email);
if (contact != null) {
contact.times_contacted++;
contact.last_contacted = new Date().getTime();
db.contact().updateContact(contact);
notJunk = true;
}
}
return notJunk;
}
String[] checkFromDomain(Context context) {
return MessageHelper.equalRootDomain(context, from, smtp_from);
}

Loading…
Cancel
Save