Native DKIM: strict alignment option

pull/215/head
M66B 7 months ago
parent 296b2a0395
commit 7a6d9dcab1

@ -3200,6 +3200,7 @@ class Core {
boolean sync_quick_pop = prefs.getBoolean("sync_quick_pop", true);
boolean notify_known = prefs.getBoolean("notify_known", false);
boolean native_dkim = prefs.getBoolean("native_dkim", false);
boolean strict_alignment = prefs.getBoolean("strict_alignment", false);
boolean download_eml = prefs.getBoolean("download_eml", false);
boolean download_plain = prefs.getBoolean("download_plain", false);
boolean check_blocklist = prefs.getBoolean("check_blocklist", false);
@ -3518,16 +3519,18 @@ class Core {
message.dmarc = true;
else if (message.dmarc != null) {
boolean found = false;
String asigner = helper.getSigner(authentication);
String adomain = UriHelper.getRootDomain(context, asigner);
if (adomain != null)
for (String signer : signers) {
String sdomain = UriHelper.getRootDomain(context, signer);
if (adomain.equalsIgnoreCase(sdomain)) {
found = true;
break;
if (!strict_alignment) {
String asigner = helper.getSigner(authentication);
String adomain = UriHelper.getRootDomain(context, asigner);
if (adomain != null)
for (String signer : signers) {
String sdomain = UriHelper.getRootDomain(context, signer);
if (adomain.equalsIgnoreCase(sdomain)) {
found = true;
break;
}
}
}
}
if (!found)
message.dmarc = false;
}
@ -4435,6 +4438,7 @@ class Core {
boolean download_plain = prefs.getBoolean("download_plain", false);
boolean notify_known = prefs.getBoolean("notify_known", false);
boolean native_dkim = prefs.getBoolean("native_dkim", false);
boolean strict_alignment = prefs.getBoolean("strict_alignment", false);
boolean experiments = prefs.getBoolean("experiments", false);
boolean mdn = prefs.getBoolean("mdn", experiments);
boolean pro = ActivityBilling.isPro(context);
@ -4705,16 +4709,18 @@ class Core {
message.dmarc = true;
else if (message.dmarc != null) {
boolean found = false;
String asigner = helper.getSigner(authentication);
String adomain = UriHelper.getRootDomain(context, asigner);
if (adomain != null)
for (String signer : signers) {
String sdomain = UriHelper.getRootDomain(context, signer);
if (adomain.equalsIgnoreCase(sdomain)) {
found = true;
break;
if (!strict_alignment) {
String asigner = helper.getSigner(authentication);
String adomain = UriHelper.getRootDomain(context, asigner);
if (adomain != null)
for (String signer : signers) {
String sdomain = UriHelper.getRootDomain(context, signer);
if (adomain.equalsIgnoreCase(sdomain)) {
found = true;
break;
}
}
}
}
if (!found)
message.dmarc = false;
}

@ -217,6 +217,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swNativeDkim;
private SwitchCompat swNativeArc;
private EditText etNativeArcWhitelist;
private SwitchCompat swStrictAlignment;
private SwitchCompat swWebp;
private SwitchCompat swAnimate;
private SwitchCompat swEasyCorrect;
@ -294,7 +295,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"keep_alive_poll", "empty_pool", "idle_done", "fast_fetch",
"max_backoff_power", "logarithmic_backoff",
"exact_alarms",
"native_dkim", "native_arc", "native_arc_whitelist",
"native_dkim", "native_arc", "native_arc_whitelist", "strict_alignment",
"webp", "animate_images",
"easy_correct", "paste_plain", "infra", "tld_flags", "json_ld", "dup_msgids", "thread_byref", "save_user_flags", "mdn",
"app_chooser", "app_chooser_share", "adjacent_links", "adjacent_documents", "adjacent_portrait", "adjacent_landscape",
@ -465,6 +466,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swNativeDkim = view.findViewById(R.id.swNativeDkim);
swNativeArc = view.findViewById(R.id.swNativeArc);
etNativeArcWhitelist = view.findViewById(R.id.etNativeArcWhitelist);
swStrictAlignment = view.findViewById(R.id.swStrictAlignment);
swWebp = view.findViewById(R.id.swWebp);
swAnimate = view.findViewById(R.id.swAnimate);
swEasyCorrect = view.findViewById(R.id.swEasyCorrect);
@ -1525,6 +1527,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
prefs.edit().putBoolean("native_dkim", checked).apply();
swNativeArc.setEnabled(checked && swNativeDkim.isEnabled());
etNativeArcWhitelist.setEnabled(checked && swNativeDkim.isEnabled());
swStrictAlignment.setEnabled(checked && swNativeDkim.isEnabled());
}
});
@ -1553,6 +1556,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swStrictAlignment.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("strict_alignment", checked).apply();
}
});
swWebp.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -2419,6 +2429,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swNativeArc.setChecked(prefs.getBoolean("native_arc", true));
etNativeArcWhitelist.setEnabled(swNativeDkim.isEnabled() && swNativeDkim.isChecked());
etNativeArcWhitelist.setText(prefs.getString("native_arc_whitelist", null));
swStrictAlignment.setChecked(prefs.getBoolean("strict_alignment", false));
swStrictAlignment.setEnabled(swNativeDkim.isEnabled() && swNativeDkim.isChecked());
swWebp.setChecked(prefs.getBoolean("webp", true));
swAnimate.setChecked(prefs.getBoolean("animate_images", true));
swEasyCorrect.setChecked(prefs.getBoolean("easy_correct", false));

@ -1603,6 +1603,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swNativeArc" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swStrictAlignment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_strict_alignment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etNativeArcWhitelist"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swWebp"
android:layout_width="0dp"
@ -1611,7 +1623,7 @@
android:text="@string/title_advanced_webp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etNativeArcWhitelist"
app:layout_constraintTop_toBottomOf="@id/swStrictAlignment"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -965,6 +965,7 @@
<string name="title_advanced_exact_alarms" translatable="false">Use exact timers</string>
<string name="title_advanced_native_dkim" translatable="false">Native DKIM verification</string>
<string name="title_advanced_native_arc" translatable="false">Native ARC verification</string>
<string name="title_advanced_strict_alignment" translatable="false">Strict alignment</string>
<string name="title_advanced_webp" translatable="false">WebP</string>
<string name="title_advanced_animate" translatable="false">Animate images (GIF, etc.)</string>
<string name="title_advanced_easy_correct" translatable="false">Easy correct</string>

Loading…
Cancel
Save