Added option to enable TLS check

This commit is contained in:
M66B 2022-01-08 08:01:41 +01:00
parent a5bed77a80
commit b16cbbdc18
5 changed files with 32 additions and 6 deletions

View File

@ -257,6 +257,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private boolean avatars;
private boolean color_stripe;
private boolean check_authentication;
private boolean check_tls;
private boolean check_reply_domain;
private boolean check_mx;
private boolean check_blocklist;
@ -1207,12 +1208,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
!Boolean.FALSE.equals(message.dmarc))
auths = 3;
if (BuildConfig.DEBUG && auths > 1 && !Boolean.TRUE.equals(message.tls))
auths--;
boolean verified = (auths == 3 && (!check_tls || Boolean.TRUE.equals(message.tls)));
ibAuth.setImageLevel(auths + 1);
ibAuth.setImageTintList(ColorStateList.valueOf(
auths < 3 ? colorControlNormal : colorVerified));
verified ? colorVerified : colorControlNormal));
ibAuth.setVisibility(auths > 0 ? View.VISIBLE : View.GONE);
} else
ibAuth.setVisibility(View.GONE);
@ -6162,6 +6162,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
this.avatars = (contacts && avatars) || (gravatars || favicons || generated);
this.color_stripe = prefs.getBoolean("color_stripe", true);
this.check_authentication = prefs.getBoolean("check_authentication", true);
this.check_tls = prefs.getBoolean("check_tls", true);
this.check_reply_domain = prefs.getBoolean("check_reply_domain", true);
this.check_mx = prefs.getBoolean("check_mx", false);
this.check_blocklist = prefs.getBoolean("check_blocklist", false);

View File

@ -123,7 +123,7 @@ public class FragmentOptions extends FragmentBase {
static String[] OPTIONS_RESTART = new String[]{
"first", "app_support", "notify_archive", "message_swipe", "message_select", "folder_actions", "folder_sync",
"subscriptions",
"check_authentication", "check_reply_domain", "check_mx", "check_blocklist",
"check_authentication", "check_tls", "check_reply_domain", "check_mx", "check_blocklist",
"send_pending",
"startup", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_highlight",
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",

View File

@ -91,6 +91,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
private SwitchCompat swTuneKeepAlive;
private SwitchCompat swCheckAuthentication;
private SwitchCompat swCheckTls;
private SwitchCompat swCheckReply;
private SwitchCompat swCheckMx;
private SwitchCompat swCheckBlocklist;
@ -108,7 +109,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
"sync_nodate", "sync_unseen", "sync_flagged", "delete_unseen", "sync_kept",
"gmail_thread_id", "subject_threading",
"sync_folders", "sync_folders_poll", "sync_shared_folders", "subscriptions",
"check_authentication", "check_reply_domain", "check_mx", "check_blocklist", "use_blocklist",
"check_authentication", "check_tls", "check_reply_domain", "check_mx", "check_blocklist", "use_blocklist",
"tune_keep_alive"
};
@ -161,6 +162,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swTuneKeepAlive = view.findViewById(R.id.swTuneKeepAlive);
swCheckAuthentication = view.findViewById(R.id.swCheckAuthentication);
swCheckTls = view.findViewById(R.id.swCheckTls);
swCheckReply = view.findViewById(R.id.swCheckReply);
swCheckMx = view.findViewById(R.id.swCheckMx);
swCheckBlocklist = view.findViewById(R.id.swCheckBlocklist);
@ -382,6 +384,14 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
prefs.edit().putBoolean("check_authentication", checked).apply();
swCheckTls.setEnabled(checked);
}
});
swCheckTls.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
prefs.edit().putBoolean("check_tls", checked).apply();
}
});
@ -518,6 +528,8 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false));
swTuneKeepAlive.setChecked(prefs.getBoolean("tune_keep_alive", true));
swCheckAuthentication.setChecked(prefs.getBoolean("check_authentication", true));
swCheckTls.setChecked(prefs.getBoolean("check_tls", false));
swCheckTls.setEnabled(swCheckAuthentication.isChecked());
swCheckReply.setChecked(prefs.getBoolean("check_reply_domain", true));
swCheckMx.setChecked(prefs.getBoolean("check_mx", false));
swCheckBlocklist.setChecked(prefs.getBoolean("check_blocklist", false));

View File

@ -745,6 +745,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swCheckAuthentication" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCheckTls"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_check_tls"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheckAuthenticationHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCheckReply"
android:layout_width="0dp"
@ -754,7 +766,7 @@
android:text="@string/title_advanced_check_reply_domain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheckAuthenticationHint"
app:layout_constraintTop_toBottomOf="@id/swCheckTls"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

View File

@ -357,6 +357,7 @@
<string name="title_advanced_sync_shared_folders">Synchronize shared folder lists</string>
<string name="title_advanced_subscriptions">Manage folder subscriptions</string>
<string name="title_advanced_check_authentication">Check message authentication</string>
<string name="title_advanced_check_tls">Check transport layer security (TLS)</string>
<string name="title_advanced_check_reply_domain">Check reply address on synchronizing messages</string>
<string name="title_advanced_check_mx">Check sender email addresses on synchronizing messages</string>
<string name="title_advanced_check_blocklist">Check if the sender\'s domain name is on a spam block list</string>