diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 41a297e5a0..b8e9d86178 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -18,7 +18,6 @@ import android.text.TextUtils; import com.sun.mail.iap.ConnectionException; import com.sun.mail.iap.Response; -import com.sun.mail.imap.AppendUID; import com.sun.mail.imap.IMAPFolder; import com.sun.mail.imap.IMAPMessage; import com.sun.mail.imap.IMAPStore; @@ -680,32 +679,25 @@ class Core { } private static long append(IMAPStore istore, IMAPFolder ifolder, MimeMessage imessage) throws MessagingException { - if (istore.hasCapability("UIDPLUS")) { - AppendUID[] uids = ifolder.appendUIDMessages(new Message[]{imessage}); - if (uids == null || uids.length == 0) - throw new MessageRemovedException("Message not appended"); - return uids[0].uid; - } else { - ifolder.appendMessages(new Message[]{imessage}); + ifolder.appendMessages(new Message[]{imessage}); - long uid = -1; - String msgid = imessage.getMessageID(); - Log.i("Searching for appended msgid=" + msgid); - Message[] messages = ifolder.search(new MessageIDTerm(msgid)); - if (messages != null) - for (Message iappended : messages) { - long muid = ifolder.getUID(iappended); - Log.i("Found appended uid=" + muid); - // RFC3501: Unique identifiers are assigned in a strictly ascending fashion - if (muid > uid) - uid = muid; - } + long uid = -1; + String msgid = imessage.getMessageID(); + Log.i("Searching for appended msgid=" + msgid); + Message[] messages = ifolder.search(new MessageIDTerm(msgid)); + if (messages != null) + for (Message iappended : messages) { + long muid = ifolder.getUID(iappended); + Log.i("Found appended uid=" + muid); + // RFC3501: Unique identifiers are assigned in a strictly ascending fashion + if (muid > uid) + uid = muid; + } - if (uid < 0) - throw new IllegalArgumentException("uid not found"); + if (uid < 0) + throw new IllegalArgumentException("uid not found"); - return uid; - } + return uid; } static void onSynchronizeFolders(Context context, EntityAccount account, Store istore, State state) throws MessagingException { diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index e3970a08ec..843251f0e7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -119,7 +119,6 @@ public class FragmentAccount extends FragmentBase { private ContentLoadingProgressBar pbCheck; private TextView tvIdle; private TextView tvMove; - private TextView tvUidPlus; private TextView tvUtf8; private ArrayAdapter adapter; @@ -198,7 +197,6 @@ public class FragmentAccount extends FragmentBase { tvIdle = view.findViewById(R.id.tvIdle); tvMove = view.findViewById(R.id.tvMove); - tvUidPlus = view.findViewById(R.id.tvUidPlus); tvUtf8 = view.findViewById(R.id.tvUtf8); spDrafts = view.findViewById(R.id.spDrafts); @@ -238,7 +236,6 @@ public class FragmentAccount extends FragmentBase { btnCheck.setVisibility(position > 0 ? View.VISIBLE : View.GONE); tvIdle.setVisibility(View.GONE); tvMove.setVisibility(View.GONE); - tvUidPlus.setVisibility(View.GONE); tvUtf8.setVisibility(View.GONE); Object tag = adapterView.getTag(); @@ -444,7 +441,6 @@ public class FragmentAccount extends FragmentBase { tvIdle.setVisibility(View.GONE); tvMove.setVisibility(View.GONE); - tvUidPlus.setVisibility(View.GONE); tvUtf8.setVisibility(View.GONE); btnCheck.setVisibility(View.GONE); @@ -523,7 +519,6 @@ public class FragmentAccount extends FragmentBase { pbCheck.setVisibility(View.VISIBLE); tvIdle.setVisibility(View.GONE); tvMove.setVisibility(View.GONE); - tvUidPlus.setVisibility(View.GONE); tvUtf8.setVisibility(View.GONE); grpFolders.setVisibility(View.GONE); tvError.setVisibility(View.GONE); @@ -584,7 +579,6 @@ public class FragmentAccount extends FragmentBase { result.idle = ((IMAPStore) istore).hasCapability("IDLE"); result.move = ((IMAPStore) istore).hasCapability("MOVE"); - result.uidplus = ((IMAPStore) istore).hasCapability("UIDPLUS"); boolean inbox = false; boolean archive = false; @@ -685,7 +679,6 @@ public class FragmentAccount extends FragmentBase { protected void onExecuted(Bundle args, CheckResult result) { tvIdle.setVisibility(result.idle ? View.GONE : View.VISIBLE); tvMove.setVisibility(result.move ? View.GONE : View.VISIBLE); - tvUidPlus.setVisibility(result.uidplus ? View.GONE : View.VISIBLE); tvUtf8.setVisibility(result.utf8 == null || result.utf8 ? View.GONE : View.VISIBLE); setFolders(result.folders, result.account); @@ -1455,7 +1448,6 @@ public class FragmentAccount extends FragmentBase { List folders; boolean idle; boolean move; - boolean uidplus; Boolean utf8; } } diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 504847ed20..9bc313dde8 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -604,8 +604,7 @@ public class ServiceSynchronize extends LifecycleService { } final boolean capIdle = ((IMAPStore) istore).hasCapability("IDLE"); - final boolean capUidPlus = ((IMAPStore) istore).hasCapability("UIDPLUS"); - Log.i(account.name + " idle=" + capIdle + " uidplus=" + capUidPlus); + Log.i(account.name + " idle=" + capIdle); db.account().setAccountState(account.id, "connected"); EntityLog.log(this, account.name + " connected"); diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml index 9f930d748e..7c4a0ec518 100644 --- a/app/src/main/res/layout/fragment_account.xml +++ b/app/src/main/res/layout/fragment_account.xml @@ -466,17 +466,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/tvIdle" /> - - + app:layout_constraintTop_toBottomOf="@+id/tvMove" /> No primary account or no drafts folder This provider does not support push messages. This will delay reception of new messages and increase battery usage. This provider does not support MOVE - This provider does not support UIDPLUS This provider does not support UTF-8 Synchronization errors since %1$s Synchronizing some folders failed