diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java
index ac91072883..1aeef4f228 100644
--- a/app/src/main/java/eu/faircode/email/DaoMessage.java
+++ b/app/src/main/java/eu/faircode/email/DaoMessage.java
@@ -209,9 +209,6 @@ public interface DaoMessage {
@Query("UPDATE message SET avatar = :avatar WHERE id = :id")
int setMessageAvatar(long id, String avatar);
- @Query("UPDATE message SET avatar = NULL")
- void clearMessageAvatars();
-
@Query("DELETE FROM message WHERE id = :id")
int deleteMessage(long id);
diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java
index 05514e278b..baff3aff1f 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptions.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java
@@ -22,7 +22,6 @@ package eu.faircode.email;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -36,6 +35,7 @@ public class FragmentOptions extends FragmentEx {
private CheckBox cbCompressImap;
private CheckBox cbAvatars;
private CheckBox cbLight;
+ private CheckBox cbIpV4;
private CheckBox cbDebug;
@Override
@@ -49,6 +49,7 @@ public class FragmentOptions extends FragmentEx {
cbCompressImap = view.findViewById(R.id.cbCompressImap);
cbAvatars = view.findViewById(R.id.cbAvatars);
cbLight = view.findViewById(R.id.cbLight);
+ cbIpV4 = view.findViewById(R.id.cbIpV4);
cbDebug = view.findViewById(R.id.cbDebug);
// Wire controls
@@ -60,6 +61,7 @@ public class FragmentOptions extends FragmentEx {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("compress", checked).apply();
+ ServiceSynchronize.reload(getContext(), "compress=" + checked);
}
});
@@ -68,14 +70,6 @@ public class FragmentOptions extends FragmentEx {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("avatars", checked).apply();
- if (!checked)
- new Thread(new Runnable() {
- @Override
- public void run() {
- Log.i(Helper.TAG, "Clearing avatars");
- DB.getInstance(getContext()).message().clearMessageAvatars();
- }
- }).start();
}
});
@@ -87,11 +81,21 @@ public class FragmentOptions extends FragmentEx {
}
});
+ cbIpV4.setChecked(prefs.getBoolean("ipv4", false));
+ cbIpV4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("ipv4", checked).apply();
+ ServiceSynchronize.reload(getContext(), "IPv4=" + checked);
+ }
+ });
+
cbDebug.setChecked(prefs.getBoolean("debug", false));
cbDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("debug", checked).apply();
+ ServiceSynchronize.reload(getContext(), "debug=" + checked);
}
});
diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java
index eaff9b101b..579106ef07 100644
--- a/app/src/main/java/eu/faircode/email/MessageHelper.java
+++ b/app/src/main/java/eu/faircode/email/MessageHelper.java
@@ -140,7 +140,10 @@ public class MessageHelper {
System.setProperty("mail.mime.multipart.ignoremissingboundaryparameter", "true"); // javax.mail.internet.ParseException: In parameter list
System.setProperty("mail.mime.multipart.ignoreexistingboundaryparameter", "true");
- //System.setProperty("java.net.preferIPv4Stack", "true");
+ if (prefs.getBoolean("ipv4", false)) {
+ Log.i(Helper.TAG, "Prefering IPv4");
+ System.setProperty("java.net.preferIPv4Stack", "true");
+ }
// https://javaee.github.io/javamail/OAuth2
Log.i(Helper.TAG, "Auth type=" + auth_type);
diff --git a/app/src/main/res/layout/fragment_options.xml b/app/src/main/res/layout/fragment_options.xml
index 8f4ce340df..bf9b49d034 100644
--- a/app/src/main/res/layout/fragment_options.xml
+++ b/app/src/main/res/layout/fragment_options.xml
@@ -41,6 +41,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAvatars" />
+
+
+ app:layout_constraintTop_toBottomOf="@id/cbIpV4" />
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 963c7c4526..4fbc7215d7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -79,6 +79,7 @@
Compress IMAP data
Show contact photos
Use notification light
+ Prefer IPv4 connections
Debug
Select …