mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Auto junk experiment
This commit is contained in:
parent
96e6e77bdf
commit
8149036b96
2 changed files with 18 additions and 0 deletions
|
@ -2693,6 +2693,18 @@ class Core {
|
|||
Log.e(ex);
|
||||
db.message().setMessageError(message.id, Log.formatThrowable(ex));
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG &&
|
||||
message.sender != null && EntityFolder.INBOX.equals(folder.type)) {
|
||||
EntityFolder junk = db.folder().getFolderByType(message.account, EntityFolder.JUNK);
|
||||
if (junk != null) {
|
||||
int senders = db.message().countSender(junk.id, message.sender);
|
||||
if (senders > 0) {
|
||||
EntityLog.log(context, "JUNK sender=" + message.sender + " count=" + senders);
|
||||
EntityOperation.queue(context, message, EntityOperation.KEYWORD, "$MoreJunk", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void reportNewMessage(Context context, EntityAccount account, EntityFolder folder, EntityMessage message) {
|
||||
|
|
|
@ -409,6 +409,12 @@ public interface DaoMessage {
|
|||
" AND (NOT :filter_snoozed OR message.ui_snoozed IS NULL OR " + is_drafts + ")")
|
||||
int countVisible(long id, boolean filter_seen, boolean filter_unflagged, boolean filter_snoozed);
|
||||
|
||||
@Query("SELECT COUNT(id)" +
|
||||
" FROM message" +
|
||||
" WHERE folder = :folder" +
|
||||
" AND sender = :sender")
|
||||
int countSender(long folder, String sender);
|
||||
|
||||
@Query("SELECT message.*" +
|
||||
", account.pop AS accountProtocol, account.name AS accountName, identity.color AS accountColor" +
|
||||
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
|
||||
|
|
Loading…
Reference in a new issue