Delete junk contacts

pull/162/head
M66B 5 years ago
parent 01af183a80
commit fce2d3c1db

@ -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);

Loading…
Cancel
Save