Debug: added preamble option

pull/210/head
M66B 2 years ago
parent 61e9a6adf7
commit 117bef6551

@ -197,6 +197,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swFakeDark;
private SwitchCompat swShowRecent;
private SwitchCompat swModSeq;
private SwitchCompat swPreamble;
private SwitchCompat swUid;
private SwitchCompat swExpunge;
private SwitchCompat swUidExpunge;
@ -266,7 +267,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"chunk_size", "thread_range", "undo_manager",
"browser_zoom", "fake_dark",
"show_recent",
"use_modseq", "uid_command", "perform_expunge", "uid_expunge",
"use_modseq", "preamble", "uid_command", "perform_expunge", "uid_expunge",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "use_top",
"keep_alive_poll", "empty_pool", "idle_done", "fast_fetch", "logarithmic_backoff",
"exact_alarms", "infra", "dkim_verify", "dup_msgids", "global_keywords", "test_iab"
@ -415,6 +416,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swFakeDark = view.findViewById(R.id.swFakeDark);
swShowRecent = view.findViewById(R.id.swShowRecent);
swModSeq = view.findViewById(R.id.swModSeq);
swPreamble = view.findViewById(R.id.swPreamble);
swUid = view.findViewById(R.id.swUid);
swExpunge = view.findViewById(R.id.swExpunge);
swUidExpunge = view.findViewById(R.id.swUidExpunge);
@ -1434,6 +1436,14 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swPreamble.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("preamble", checked).apply();
System.setProperty("fairemail.preamble", Boolean.toString(checked));
}
});
swUid.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -2228,6 +2238,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swFakeDark.setChecked(prefs.getBoolean("fake_dark", false));
swShowRecent.setChecked(prefs.getBoolean("show_recent", false));
swModSeq.setChecked(prefs.getBoolean("use_modseq", true));
swPreamble.setChecked(prefs.getBoolean("preamble", false));
swUid.setChecked(prefs.getBoolean("uid_command", false));
swExpunge.setChecked(prefs.getBoolean("perform_expunge", true));
swUidExpunge.setChecked(prefs.getBoolean("uid_expunge", false));

@ -273,7 +273,9 @@ public class MessageHelper {
//System.setProperty("mail.imap.parse.debug", "true");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean preamble = prefs.getBoolean("preamble", false);
boolean uid_command = prefs.getBoolean("uid_command", false);
System.setProperty("fairemail.preamble", Boolean.toString(preamble));
System.setProperty("fairemail.uid_command", Boolean.toString(uid_command));
}
@ -3196,7 +3198,7 @@ public class MessageHelper {
return null;
}
if (BuildConfig.DEBUG) {
if (Boolean.parseBoolean(System.getProperty("fairemail.preamble"))) {
String preamble = h.contentType.getParameter("preamble");
if (Boolean.parseBoolean(preamble)) {
String text = ((MimeMultipart) h.part.getContent()).getPreamble();
@ -4474,7 +4476,8 @@ public class MessageHelper {
parts.warnings.add(Log.formatThrowable(ex, false));
}
if (BuildConfig.DEBUG && multipart instanceof MimeMultipart) {
if (multipart instanceof MimeMultipart &&
Boolean.parseBoolean(System.getProperty("fairemail.preamble"))) {
String preamble = ((MimeMultipart) multipart).getPreamble();
if (!TextUtils.isEmpty(preamble)) {
ContentType plain = new ContentType("text/plain; preamble=\"true\"");

@ -1398,6 +1398,17 @@
app:layout_constraintTop_toBottomOf="@id/swShowRecent"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swPreamble"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_preamble"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swModSeq"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swUid"
android:layout_width="0dp"
@ -1406,7 +1417,7 @@
android:text="@string/title_advanced_uid"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swModSeq"
app:layout_constraintTop_toBottomOf="@id/swPreamble"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

@ -818,6 +818,7 @@
<string name="title_advanced_fake_dark" translatable="false">Fake dark</string>
<string name="title_advanced_show_recent" translatable="false">Show recent flag</string>
<string name="title_advanced_modseq" translatable="false">MODSEQ</string>
<string name="title_advanced_preamble" translatable="false">Preamble</string>
<string name="title_advanced_uid" translatable="false">UID command</string>
<string name="title_advanced_expunge" translatable="false">AUTO EXPUNGE</string>
<string name="title_advanced_uid_expunge" translatable="false">UID EXPUNGE</string>

Loading…
Cancel
Save