mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 17:57:16 +00:00
Update message hash
This commit is contained in:
parent
8dcd2244b0
commit
5a1f2b4fdf
2 changed files with 17 additions and 7 deletions
|
@ -78,7 +78,6 @@ import java.net.InetAddress;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -2134,12 +2133,7 @@ class Core {
|
||||||
if (TextUtils.isEmpty(message.msgid))
|
if (TextUtils.isEmpty(message.msgid))
|
||||||
Log.w("No Message-ID id=" + message.id + " uid=" + message.uid);
|
Log.w("No Message-ID id=" + message.id + " uid=" + message.uid);
|
||||||
|
|
||||||
try {
|
message.hash = helper.getHash();
|
||||||
message.hash = Helper.sha1(helper.getHeaders().getBytes());
|
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
|
||||||
Log.e(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
message.references = TextUtils.join(" ", helper.getReferences());
|
message.references = TextUtils.join(" ", helper.getReferences());
|
||||||
message.inreplyto = helper.getInReplyTo();
|
message.inreplyto = helper.getInReplyTo();
|
||||||
// Local address contains control or whitespace in string ``mailing list someone@example.org''
|
// Local address contains control or whitespace in string ``mailing list someone@example.org''
|
||||||
|
@ -2418,6 +2412,12 @@ class Core {
|
||||||
" keywords=" + TextUtils.join(" ", keywords));
|
" keywords=" + TextUtils.join(" ", keywords));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.hash == null) {
|
||||||
|
update = true;
|
||||||
|
message.hash = helper.getHash();
|
||||||
|
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " hash=" + message.hash);
|
||||||
|
}
|
||||||
|
|
||||||
if (message.ui_hide &&
|
if (message.ui_hide &&
|
||||||
message.ui_snoozed == null &&
|
message.ui_snoozed == null &&
|
||||||
(message.ui_busy == null || message.ui_busy < new Date().getTime()) &&
|
(message.ui_busy == null || message.ui_busy < new Date().getTime()) &&
|
||||||
|
|
|
@ -52,6 +52,7 @@ import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -1182,6 +1183,15 @@ public class MessageHelper {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getHash() throws MessagingException {
|
||||||
|
try {
|
||||||
|
return Helper.sha1(getHeaders().getBytes());
|
||||||
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static String formatAddresses(Address[] addresses) {
|
static String formatAddresses(Address[] addresses) {
|
||||||
return formatAddresses(addresses, true, false);
|
return formatAddresses(addresses, true, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue