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);
}
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;
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;
}
}
}
boolean check_blocklist = prefs.getBoolean("check_blocklist", false);
if (check_blocklist &&
!have &&
!EntityFolder.isOutgoing(folder.type) &&
!EntityFolder.ARCHIVE.equals(folder.type) &&
!EntityFolder.TRASH.equals(folder.type) &&
!EntityFolder.JUNK.equals(folder.type) &&
!notJunk &&
!Arrays.asList(message.keywords).contains(MessageHelper.FLAG_NOT_JUNK))
try {
message.blocklist = DnsBlockList.isJunk(context,
imessage.getHeader("Received"));
if (message.blocklist == null || !message.blocklist) {
List<Address> senders = new ArrayList<>();
if (message.reply != null)
senders.addAll(Arrays.asList(message.reply));
if (message.from != null)
senders.addAll(Arrays.asList(message.from));
message.blocklist = DnsBlockList.isJunk(context, senders);
if (!have &&
!EntityFolder.isOutgoing(folder.type) &&
!EntityFolder.ARCHIVE.equals(folder.type) &&
!EntityFolder.TRASH.equals(folder.type) &&
!EntityFolder.JUNK.equals(folder.type) &&
!notJunk &&
!Arrays.asList(message.keywords).contains(MessageHelper.FLAG_NOT_JUNK))
try {
message.blocklist = DnsBlockList.isJunk(context,
imessage.getHeader("Received"));
if (message.blocklist == null || !message.blocklist) {
List<Address> senders = new ArrayList<>();
if (message.reply != null)
senders.addAll(Arrays.asList(message.reply));
if (message.from != null)
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 {
db.beginTransaction();

Loading…
Cancel
Save