mirror of https://github.com/M66B/FairEmail.git
Auto junk experiment
This commit is contained in:
parent
96e6e77bdf
commit
8149036b96
|
@ -2693,6 +2693,18 @@ class Core {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
db.message().setMessageError(message.id, Log.formatThrowable(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) {
|
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 + ")")
|
" 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);
|
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.*" +
|
@Query("SELECT message.*" +
|
||||||
", account.pop AS accountProtocol, account.name AS accountName, identity.color AS accountColor" +
|
", account.pop AS accountProtocol, account.name AS accountName, identity.color AS accountColor" +
|
||||||
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
|
", account.notify AS accountNotify, account.auto_seen AS accountAutoSeen" +
|
||||||
|
|
Loading…
Reference in New Issue