Added setting to disable checking reply domain

This commit is contained in:
M66B 2021-02-25 09:38:21 +01:00
parent 1244ee472d
commit 798c0bf649
4 changed files with 52 additions and 13 deletions

View File

@ -3081,17 +3081,20 @@ class Core {
if (message.avatar == null && notify_known && pro)
message.ui_ignored = true;
// For contact forms
boolean self = false;
if (identity != null && message.from != null)
for (Address from : message.from)
if (identity.sameAddress(from) || identity.similarAddress(from)) {
self = true;
break;
}
if (!self) {
String warning = message.checkReplyDomain(context);
message.reply_domain = (warning == null);
boolean check_reply_domain = prefs.getBoolean("check_reply_domain", true);
if (check_reply_domain) {
// For contact forms
boolean self = false;
if (identity != null && message.from != null)
for (Address from : message.from)
if (identity.sameAddress(from) || identity.similarAddress(from)) {
self = true;
break;
}
if (!self) {
String warning = message.checkReplyDomain(context);
message.reply_domain = (warning == null);
}
}
boolean check_mx = prefs.getBoolean("check_mx", false);

View File

@ -81,6 +81,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
private SwitchCompat swSyncFolders;
private SwitchCompat swSyncSharedFolders;
private SwitchCompat swSubscriptions;
private SwitchCompat swCheckReply;
private SwitchCompat swCheckMx;
private SwitchCompat swTuneKeepAlive;
private Group grpExempted;
@ -91,7 +92,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
"enabled", "poll_interval", "auto_optimize", "schedule", "schedule_start", "schedule_end",
"sync_nodate", "sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "gmail_thread_id",
"sync_folders", "sync_shared_folders", "subscriptions",
"check_mx", "tune_keep_alive"
"check_reply_domain", "check_mx", "tune_keep_alive"
};
@Override
@ -134,6 +135,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swSyncFolders = view.findViewById(R.id.swSyncFolders);
swSyncSharedFolders = view.findViewById(R.id.swSyncSharedFolders);
swSubscriptions = view.findViewById(R.id.swSubscriptions);
swCheckReply = view.findViewById(R.id.swCheckReply);
swCheckMx = view.findViewById(R.id.swCheckMx);
swTuneKeepAlive = view.findViewById(R.id.swTuneKeepAlive);
grpExempted = view.findViewById(R.id.grpExempted);
@ -309,6 +311,13 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
}
});
swCheckReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("check_reply_domain", checked).apply();
}
});
swCheckMx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -409,6 +418,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
swSyncSharedFolders.setChecked(prefs.getBoolean("sync_shared_folders", false));
swSyncSharedFolders.setEnabled(swSyncFolders.isChecked());
swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false));
swCheckReply.setChecked(prefs.getBoolean("check_reply_domain", true));
swCheckMx.setChecked(prefs.getBoolean("check_mx", false));
swTuneKeepAlive.setChecked(prefs.getBoolean("tune_keep_alive", true));
}

View File

@ -493,6 +493,30 @@
app:layout_constraintTop_toBottomOf="@id/swSyncSharedFolders"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCheckReply"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_check_reply_domain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSubscriptions"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCheckReplyHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_check_reply_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swCheckReply" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCheckMx"
android:layout_width="0dp"
@ -501,7 +525,7 @@
android:text="@string/title_advanced_check_mx"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSubscriptions"
app:layout_constraintTop_toBottomOf="@id/tvCheckReplyHint"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

View File

@ -300,6 +300,7 @@
<string name="title_advanced_sync_folders">Synchronize folder list</string>
<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_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_tune_keep_alive">Automatically tune the keep-alive interval</string>
@ -558,6 +559,7 @@
<string name="title_advanced_sync_kept_hint">This will transfer extra data and consume extra battery power, especially if a lot of messages are stored on the device</string>
<string name="title_advanced_gmail_thread_hint">This only applies to newly received messages and can break existing groups</string>
<string name="title_advanced_sync_folders_hint">Disabling this will reduce data and battery usage somewhat, but will disable updating the list of folders too</string>
<string name="title_advanced_check_reply_hint">This will check if the domain name of the sender and the reply address are the same</string>
<string name="title_advanced_lookup_mx_hint">This will check if DNS MX records exist</string>
<string name="title_advanced_sync_delay_hint">This will slow down synchronizing messages</string>