Store TLS indicator

pull/194/merge
M66B 4 years ago
parent 956f2c1219
commit 4fc5ab9ff8

File diff suppressed because it is too large Load Diff

@ -3834,6 +3834,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (result.size() > 0)
sb.append(context.getString(R.string.title_authentication_failed, TextUtils.join(", ", result)));
else {
if (BuildConfig.DEBUG)
sb.append("TLS: ")
.append(message.tls == null ? "-" : (message.tls ? "✓" : "✗"))
.append('\n');
sb.append("DKIM: ")
.append(message.dkim == null ? "-" : (message.dkim ? "✓" : "✗"))
.append('\n');
@ -6269,6 +6273,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
same = false;
log("bimi_selector changed", next.id);
}
if (!Objects.equals(prev.tls, next.tls)) {
same = false;
log("tls changed", next.id);
}
if (!Objects.equals(prev.dkim, next.dkim)) {
same = false;
log("dkim changed", next.id);

@ -2790,6 +2790,7 @@ class Core {
message.receipt_request = helper.getReceiptRequested();
message.receipt_to = helper.getReceiptTo();
message.bimi_selector = helper.getBimiSelector();
message.tls = helper.getTLS();
message.dkim = MessageHelper.getAuthentication("dkim", authentication);
message.spf = MessageHelper.getAuthentication("spf", authentication);
if (message.spf == null && helper.getSPF())
@ -3738,9 +3739,6 @@ class Core {
if (received == null)
received = 0L;
if (BuildConfig.DEBUG)
Log.i("--- TLS=" + helper.getTLS());
String[] authentication = helper.getAuthentication();
MessageHelper.MessageParts parts = helper.getMessageParts();
@ -3771,6 +3769,7 @@ class Core {
message.receipt_request = helper.getReceiptRequested();
message.receipt_to = helper.getReceiptTo();
message.bimi_selector = helper.getBimiSelector();
message.tls = helper.getTLS();
message.dkim = MessageHelper.getAuthentication("dkim", authentication);
message.spf = MessageHelper.getAuthentication("spf", authentication);
if (message.spf == null && helper.getSPF())

@ -70,7 +70,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 219,
version = 220,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2222,6 +2222,12 @@ public abstract class DB extends RoomDatabase {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `resend` INTEGER");
}
}).addMigrations(new Migration(219, 220) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `tls` INTEGER");
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

@ -144,6 +144,7 @@ public class EntityMessage implements Serializable {
public Boolean receipt_request;
public Address[] receipt_to;
public String bimi_selector;
public Boolean tls;
public Boolean dkim;
public Boolean spf;
public Boolean dmarc;
@ -563,6 +564,7 @@ public class EntityMessage implements Serializable {
Objects.equals(this.receipt_request, other.receipt_request) &&
MessageHelper.equal(this.receipt_to, other.receipt_to) &&
Objects.equals(this.bimi_selector, other.bimi_selector) &&
Objects.equals(this.tls, other.tls) &&
Objects.equals(this.dkim, other.dkim) &&
Objects.equals(this.spf, other.spf) &&
Objects.equals(this.dmarc, other.dmarc) &&

@ -1936,6 +1936,9 @@ public class MessageHelper {
// Protocol = "ESMTP" / "SMTP" / Attdl-Protocol
// Attdl-Protocol = Atom
if (!BuildConfig.DEBUG)
return null;
String[] received = imessage.getHeader("Received");
if (received == null || received.length == 0)
return null;

Loading…
Cancel
Save