mirror of https://github.com/M66B/FairEmail.git
Same message has same hash
This commit is contained in:
parent
628a4709e3
commit
312aa299f7
|
@ -122,6 +122,7 @@ public class MessageHelper {
|
||||||
private boolean ensuredHeaders = false;
|
private boolean ensuredHeaders = false;
|
||||||
private boolean ensuredStructure = false;
|
private boolean ensuredStructure = false;
|
||||||
private MimeMessage imessage;
|
private MimeMessage imessage;
|
||||||
|
private String hash = null;
|
||||||
|
|
||||||
private static File cacheDir = null;
|
private static File cacheDir = null;
|
||||||
|
|
||||||
|
@ -1176,7 +1177,7 @@ public class MessageHelper {
|
||||||
if (thread == null) {
|
if (thread == null) {
|
||||||
List<EntityMessage> similar = db.message().getMessagesByMsgId(account, msgid);
|
List<EntityMessage> similar = db.message().getMessagesByMsgId(account, msgid);
|
||||||
for (EntityMessage message : similar)
|
for (EntityMessage message : similar)
|
||||||
if (!TextUtils.isEmpty(message.thread) && message.folder != folder) {
|
if (!TextUtils.isEmpty(message.thread) && Objects.equals(message.hash, getHash())) {
|
||||||
thread = message.thread;
|
thread = message.thread;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1835,7 +1836,9 @@ public class MessageHelper {
|
||||||
|
|
||||||
String getHash() throws MessagingException {
|
String getHash() throws MessagingException {
|
||||||
try {
|
try {
|
||||||
return Helper.sha1(getHeaders().getBytes());
|
if (hash == null)
|
||||||
|
hash = Helper.sha1(getHeaders().getBytes());
|
||||||
|
return hash;
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue