From 7bb4bbb7ccca51bf7506b14992b3e75964ea97d4 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 13 Oct 2019 20:13:00 +0200 Subject: [PATCH] Match identity on add --- app/src/main/java/eu/faircode/email/Core.java | 4 ++++ app/src/main/java/eu/faircode/email/DaoMessage.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index cbf8c44b16..3015cde73b 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -741,6 +741,10 @@ class Core { Log.i(folder.name + " appended uid=" + message.uid); db.message().setMessageUid(message.id, message.uid); + EntityIdentity identity = matchIdentity(context, folder, message); + message.identity = (identity == null ? null : identity.id); + db.message().setMessageIdentity(message.id, message.identity); + List rules = db.rule().getEnabledRules(folder.id); runRules(context, imessage, message, rules); updateContactInfo(context, folder, message); diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index 36de6d5a2e..db083ce441 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -380,6 +380,9 @@ public interface DaoMessage { @Update int updateMessage(EntityMessage message); + @Query("UPDATE message SET identity = :identity WHERE id = :id") + int setMessageIdentity(long id, Long identity); + @Query("UPDATE message SET uid = :uid WHERE id = :id") int setMessageUid(long id, Long uid);