From 801143198bdab82a5f1462e1f3ef7d49958af852 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 12 Sep 2019 22:10:56 +0200 Subject: [PATCH] Collect enabled email addresses only --- app/src/main/java/eu/faircode/email/Core.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index f93bc4ea03..2a445e9979 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1776,12 +1776,23 @@ class Core { private static void updateContactInfo(Context context, final EntityFolder folder, final EntityMessage message) { final DB db = DB.getInstance(context); - if (EntityFolder.ARCHIVE.equals(folder.type) || + if (EntityFolder.DRAFTS.equals(folder.type) || + EntityFolder.ARCHIVE.equals(folder.type) || EntityFolder.TRASH.equals(folder.type) || EntityFolder.JUNK.equals(folder.type)) return; final int type = (folder.isOutgoing() ? EntityContact.TYPE_TO : EntityContact.TYPE_FROM); + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean suggest_sent = prefs.getBoolean("suggest_sent", false); + boolean suggest_received = prefs.getBoolean("suggest_received", false); + + if (type == EntityContact.TYPE_TO && !suggest_sent) + return; + if (type == EntityContact.TYPE_FROM && !suggest_received) + return; + Address[] recipients = (type == EntityContact.TYPE_TO ? message.to : (message.reply != null ? message.reply : message.from));