From 1d3cd1d44f69ffb7364a1532d2a4402758efe06e Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 27 Jul 2019 11:11:24 +0200 Subject: [PATCH] Sync instead of store sent --- FAQ.md | 19 +++++++++------ app/src/main/java/eu/faircode/email/Core.java | 1 + .../eu/faircode/email/FragmentIdentity.java | 10 -------- .../java/eu/faircode/email/ServiceSend.java | 12 ++++------ app/src/main/res/layout/fragment_identity.xml | 24 ++----------------- app/src/main/res/values/strings.xml | 2 -- 6 files changed, 19 insertions(+), 49 deletions(-) diff --git a/FAQ.md b/FAQ.md index 95dfa7d8c8..b2ed9314ea 100644 --- a/FAQ.md +++ b/FAQ.md @@ -384,14 +384,19 @@ See [this FAQ](#user-content-faq111) about why OAuth is not being used. Sent messages are normally moved from the outbox to the sent folder as soon as your provider adds sent messages to the sent folder. This requires a sent folder to be selected in the account settings and the sent folder to be set to synchronizing. -If this doesn't happen, your provider might not keep track of sent messages or you might be using an SMTP server not related to the provider. -In these cases you can enable the advanced identity setting *Store sent messages* to let FairEmail add sent messages to the sent folder right after sending a message. -Note that enabling this setting might result in duplicate messages if your provider adds sent messages to the sent folder too. -Also beware that enabling this setting will result in extra data usage, especially when when sending messages with large attachments. -If sent messages in the outbox are not found in the sent folder on a full synchronize, they will be moved from the outbox to the sent folder too. -A full synchronize happens when reconnecting to the server or when synchronizing periodically or manually. -You'll likely want to enable the advanced setting *Store sent messages* instead to move messages to the sent folder sooner. +Some providers do not keep track of sent messages or the used SMTP server might not be related to the provider. +In these cases FairEmail will automatically add sent messages to the sent folder on synchronizing the sent folder, which will happen after a message have been sent. +Note that this will result in extra internet traffic. + +~~If this doesn't happen, your provider might not keep track of sent messages or you might be using an SMTP server not related to the provider.~~ +~~In these cases you can enable the advanced identity setting *Store sent messages* to let FairEmail add sent messages to the sent folder right after sending a message.~~ +~~Note that enabling this setting might result in duplicate messages if your provider adds sent messages to the sent folder too.~~ +~~Also beware that enabling this setting will result in extra data usage, especially when when sending messages with large attachments.~~ + +~~If sent messages in the outbox are not found in the sent folder on a full synchronize, they will be moved from the outbox to the sent folder too.~~ +~~A full synchronize happens when reconnecting to the server or when synchronizing periodically or manually.~~ +~~You'll likely want to enable the advanced setting *Store sent messages* instead to move messages to the sent folder sooner.~~
diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 57b9fad189..46ad2bc222 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1265,6 +1265,7 @@ class Core { for (EntityMessage orphan : orphans) { Log.i(folder.name + " adding orphan id=" + orphan.id + " sent=" + new Date(orphan.sent)); orphan.folder = folder.id; + orphan.ui_hide = 0L; db.message().updateMessage(orphan); EntityOperation.queue(context, orphan, EntityOperation.ADD); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 4bedb6e38d..1f213adaae 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -121,8 +121,6 @@ public class FragmentIdentity extends FragmentBase { private CheckBox cbDeliveryReceipt; private CheckBox cbReadReceipt; - private CheckBox cbStoreSent; - private Button btnSave; private ContentLoadingProgressBar pbSave; private TextView tvError; @@ -199,8 +197,6 @@ public class FragmentIdentity extends FragmentBase { cbDeliveryReceipt = view.findViewById(R.id.cbDeliveryReceipt); cbReadReceipt = view.findViewById(R.id.cbReadReceipt); - cbStoreSent = view.findViewById(R.id.cbStoreSent); - btnSave = view.findViewById(R.id.btnSave); pbSave = view.findViewById(R.id.pbSave); tvError = view.findViewById(R.id.tvError); @@ -505,7 +501,6 @@ public class FragmentIdentity extends FragmentBase { args.putBoolean("encrypt", cbEncrypt.isChecked()); args.putBoolean("delivery_receipt", cbDeliveryReceipt.isChecked()); args.putBoolean("read_receipt", cbReadReceipt.isChecked()); - args.putBoolean("store_sent", cbStoreSent.isChecked()); args.putLong("account", account == null ? -1 : account.id); args.putString("host", etHost.getText().toString()); args.putBoolean("starttls", rgEncryption.getCheckedRadioButtonId() == R.id.radio_starttls); @@ -570,7 +565,6 @@ public class FragmentIdentity extends FragmentBase { boolean encrypt = args.getBoolean("encrypt"); boolean delivery_receipt = args.getBoolean("delivery_receipt"); boolean read_receipt = args.getBoolean("read_receipt"); - boolean store_sent = args.getBoolean("store_sent"); boolean should = args.getBoolean("should"); @@ -662,8 +656,6 @@ public class FragmentIdentity extends FragmentBase { return true; if (!Objects.equals(identity.read_receipt, read_receipt)) return true; - if (!Objects.equals(identity.store_sent, store_sent)) - return true; if (identity.error != null) return true; @@ -746,7 +738,6 @@ public class FragmentIdentity extends FragmentBase { identity.encrypt = encrypt; identity.delivery_receipt = delivery_receipt; identity.read_receipt = read_receipt; - identity.store_sent = store_sent; identity.sent_folder = null; identity.sign_key = null; identity.error = null; @@ -887,7 +878,6 @@ public class FragmentIdentity extends FragmentBase { cbEncrypt.setChecked(identity == null ? false : identity.encrypt); cbDeliveryReceipt.setChecked(identity == null ? false : identity.delivery_receipt); cbReadReceipt.setChecked(identity == null ? false : identity.read_receipt); - cbStoreSent.setChecked(identity == null ? false : identity.store_sent); color = (identity == null || identity.color == null ? Color.TRANSPARENT : identity.color); diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index b113c44024..8a7904689b 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -398,16 +398,12 @@ public class ServiceSend extends ServiceBase { db.message().setMessageSeen(message.id, true); db.message().setMessageUiSeen(message.id, true); db.message().setMessageError(message.id, null); + if (!BuildConfig.DEBUG && !debug) + db.message().setMessageUiHide(message.id, new Date().getTime()); EntityFolder sent = db.folder().getFolderByType(message.account, EntityFolder.SENT); - if (ident.store_sent && sent != null) { - db.message().setMessageFolder(message.id, sent.id); - message.folder = sent.id; - EntityOperation.queue(this, message, EntityOperation.ADD); - } else { - if (!BuildConfig.DEBUG && !debug) - db.message().setMessageUiHide(message.id, new Date().getTime()); - } + if (sent != null) + EntityOperation.sync(this, sent.id, false); if (message.inreplyto != null) { List replieds = db.message().getMessageByMsgId(message.account, message.inreplyto); diff --git a/app/src/main/res/layout/fragment_identity.xml b/app/src/main/res/layout/fragment_identity.xml index 72a10415e9..5d14469433 100644 --- a/app/src/main/res/layout/fragment_identity.xml +++ b/app/src/main/res/layout/fragment_identity.xml @@ -584,25 +584,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbReadReceipt" /> - - - -