mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-08 18:13:24 +02:00
Native DKIM: strict alignment option
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user