Small improvement

pull/205/head
M66B 4 years ago
parent ddbd823c55
commit 9edadfaafa

@ -3575,45 +3575,46 @@ class Core {
message.warning = Log.formatThrowable(ex, false); message.warning = Log.formatThrowable(ex, false);
} }
boolean notJunk = false; boolean check_blocklist = prefs.getBoolean("check_blocklist", false);
if (message.from != null) if (check_blocklist) {
for (Address from : message.from) { boolean notJunk = false;
String email = ((InternetAddress) from).getAddress(); if (message.from != null)
if (TextUtils.isEmpty(email)) for (Address from : message.from) {
continue; String email = ((InternetAddress) from).getAddress();
EntityContact contact = db.contact().getContact(message.account, EntityContact.TYPE_NO_JUNK, email); if (TextUtils.isEmpty(email))
if (contact != null) { continue;
contact.times_contacted++; EntityContact contact = db.contact().getContact(message.account, EntityContact.TYPE_NO_JUNK, email);
contact.last_contacted = new Date().getTime(); if (contact != null) {
db.contact().updateContact(contact); contact.times_contacted++;
notJunk = true; contact.last_contacted = new Date().getTime();
db.contact().updateContact(contact);
notJunk = true;
}
} }
}
boolean check_blocklist = prefs.getBoolean("check_blocklist", false); if (!have &&
if (check_blocklist && !EntityFolder.isOutgoing(folder.type) &&
!have && !EntityFolder.ARCHIVE.equals(folder.type) &&
!EntityFolder.isOutgoing(folder.type) && !EntityFolder.TRASH.equals(folder.type) &&
!EntityFolder.ARCHIVE.equals(folder.type) && !EntityFolder.JUNK.equals(folder.type) &&
!EntityFolder.TRASH.equals(folder.type) && !notJunk &&
!EntityFolder.JUNK.equals(folder.type) && !Arrays.asList(message.keywords).contains(MessageHelper.FLAG_NOT_JUNK))
!notJunk && try {
!Arrays.asList(message.keywords).contains(MessageHelper.FLAG_NOT_JUNK)) message.blocklist = DnsBlockList.isJunk(context,
try { imessage.getHeader("Received"));
message.blocklist = DnsBlockList.isJunk(context,
imessage.getHeader("Received")); if (message.blocklist == null || !message.blocklist) {
List<Address> senders = new ArrayList<>();
if (message.blocklist == null || !message.blocklist) { if (message.reply != null)
List<Address> senders = new ArrayList<>(); senders.addAll(Arrays.asList(message.reply));
if (message.reply != null) if (message.from != null)
senders.addAll(Arrays.asList(message.reply)); senders.addAll(Arrays.asList(message.from));
if (message.from != null) message.blocklist = DnsBlockList.isJunk(context, senders);
senders.addAll(Arrays.asList(message.from)); }
message.blocklist = DnsBlockList.isJunk(context, senders); } catch (Throwable ex) {
Log.w(folder.name, ex);
} }
} catch (Throwable ex) { }
Log.w(folder.name, ex);
}
try { try {
db.beginTransaction(); db.beginTransaction();

Loading…
Cancel
Save