Removed dependency on UIDPLUS

pull/146/head
M66B 6 years ago
parent 626eef1922
commit 747b39ac70

@ -76,7 +76,6 @@ import java.util.Properties;
import javax.mail.AuthenticationFailedException;
import javax.mail.Folder;
import javax.mail.MessagingException;
import javax.mail.Session;
import androidx.annotation.NonNull;
@ -476,9 +475,6 @@ public class FragmentAccount extends FragmentEx {
throw ex;
}
if (!istore.hasCapability("UIDPLUS"))
throw new MessagingException(getContext().getString(R.string.title_no_uidplus));
result.idle = istore.hasCapability("IDLE");
for (Folder ifolder : istore.getDefaultFolder().list("*")) {
@ -695,9 +691,6 @@ public class FragmentAccount extends FragmentEx {
} else
throw ex;
}
if (!istore.hasCapability("UIDPLUS"))
throw new MessagingException(getContext().getString(R.string.title_no_uidplus));
} finally {
if (istore != null)
istore.close();

@ -1360,7 +1360,7 @@ public class ServiceSynchronize extends LifecycleService {
doKeyword(folder, ifolder, message, jargs, db);
else if (EntityOperation.ADD.equals(op.name))
doAdd(folder, isession, ifolder, message, jargs, db);
doAdd(folder, isession, istore, ifolder, message, jargs, db);
else if (EntityOperation.MOVE.equals(op.name))
doMove(folder, isession, istore, ifolder, message, jargs, db);
@ -1514,17 +1514,21 @@ public class ServiceSynchronize extends LifecycleService {
db.message().setMessageKeywords(message.id, DB.Converters.fromStringArray(keywords.toArray(new String[0])));
}
private void doAdd(EntityFolder folder, Session isession, IMAPFolder ifolder, EntityMessage message, JSONArray jargs, DB db) throws MessagingException, JSONException, IOException {
private void doAdd(EntityFolder folder, Session isession, IMAPStore istore, IMAPFolder ifolder, EntityMessage message, JSONArray jargs, DB db) throws MessagingException, JSONException, IOException {
// Append message
MimeMessage imessage = MessageHelper.from(this, message, isession);
if (EntityFolder.DRAFTS.equals(folder.type) && ifolder.getPermanentFlags().contains(Flags.Flag.DRAFT))
imessage.setFlag(Flags.Flag.DRAFT, true);
AppendUID[] uid = ifolder.appendUIDMessages(new Message[]{imessage});
Log.i(Helper.TAG, "Appended uid=" + uid[0].uid + " draft=" + imessage.getFlags().contains(Flags.Flag.DRAFT));
db.message().setMessageUid(message.id, uid[0].uid);
if (istore.hasCapability("UIDPLUS")) {
AppendUID[] uid = ifolder.appendUIDMessages(new Message[]{imessage});
Log.i(Helper.TAG, "Appended uid=" + uid[0].uid + " draft=" + imessage.getFlags().contains(Flags.Flag.DRAFT));
db.message().setMessageUid(message.id, uid[0].uid);
} else {
ifolder.appendMessages(new Message[]{imessage});
db.message().setMessageUid(message.id, null);
}
if (message.uid != null) {
Message iprev = ifolder.getMessageByUID(message.uid);

@ -159,7 +159,6 @@
<string name="title_no_primary_drafts">No primary account or no drafts folder</string>
<string name="title_no_primary_archive">No primary account or no archive folder</string>
<string name="title_no_idle">This provider does not support push messages. This will delay reception of new messages and increase battery usage.</string>
<string name="title_no_uidplus">IMAP UIDPLUS not supported, see the FAQ</string>
<string name="title_account_delete">Delete this account permanently?</string>
<string name="title_identity_delete">Delete this identity permanently?</string>
<string name="title_pop">POP is not supported</string>

Loading…
Cancel
Save