mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-02 23:26:12 +02:00
Delete junk contacts
This commit is contained in:
@@ -653,6 +653,17 @@ class Core {
|
||||
}
|
||||
ifolder.expunge();
|
||||
}
|
||||
|
||||
// Delete junk contacts
|
||||
if (EntityFolder.JUNK.equals(target.type)) {
|
||||
Address[] recipients = (message.reply != null ? message.reply : message.from);
|
||||
if (recipients != null)
|
||||
for (Address recipient : recipients) {
|
||||
String email = ((InternetAddress) recipient).getAddress();
|
||||
int count = db.contact().deleteContact(target.account, EntityContact.TYPE_FROM, email);
|
||||
Log.i("Deleted contact email=" + email + " count=" + count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void onDelete(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPFolder ifolder) throws MessagingException {
|
||||
|
||||
@@ -79,6 +79,12 @@ public interface DaoContact {
|
||||
@Query("DELETE FROM contact WHERE id = :id")
|
||||
int deleteContact(long id);
|
||||
|
||||
@Query("DELETE FROM contact" +
|
||||
" WHERE account = :account" +
|
||||
" AND type = :type" +
|
||||
" AND email = :email")
|
||||
int deleteContact(long account, int type, String email);
|
||||
|
||||
@Query("UPDATE contact SET state = :state WHERE id = :id")
|
||||
int setContactState(long id, int state);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user