Bring back store sent

pull/148/head
M66B 7 years ago
parent a5a727b900
commit 72de959ceb

@ -265,6 +265,9 @@ public interface DaoMessage {
@Update @Update
int updateMessage(EntityMessage message); int updateMessage(EntityMessage message);
@Query("UPDATE message SET folder = :folder WHERE id = :id")
int setMessageFolder(long id, long folder);
@Query("UPDATE message SET uid = :uid WHERE id = :id") @Query("UPDATE message SET uid = :uid WHERE id = :id")
int setMessageUid(long id, long uid); int setMessageUid(long id, long uid);

@ -82,7 +82,7 @@ public class EntityIdentity {
@NonNull @NonNull
public Boolean read_receipt = false; public Boolean read_receipt = false;
@NonNull @NonNull
public Boolean store_sent = false; // obsolete public Boolean store_sent = false;
public Long sent_folder = null; // obsolete public Long sent_folder = null; // obsolete
public Boolean tbd; public Boolean tbd;
public String state; public String state;
@ -122,6 +122,7 @@ public class EntityIdentity {
json.put("plain_only", plain_only); json.put("plain_only", plain_only);
json.put("delivery_receipt", delivery_receipt); json.put("delivery_receipt", delivery_receipt);
json.put("read_receipt", read_receipt); json.put("read_receipt", read_receipt);
json.put("store_sent", store_sent);
// not state // not state
// not error // not error
return json; return json;
@ -164,6 +165,9 @@ public class EntityIdentity {
if (json.has("read_receipt")) if (json.has("read_receipt"))
identity.read_receipt = json.getBoolean("read_receipt"); identity.read_receipt = json.getBoolean("read_receipt");
if (json.has("store_sent"))
identity.store_sent = json.getBoolean("store_sent");
return identity; return identity;
} }
@ -191,6 +195,7 @@ public class EntityIdentity {
(this.bcc == null ? other.bcc == null : this.bcc.equals(other.bcc)) && (this.bcc == null ? other.bcc == null : this.bcc.equals(other.bcc)) &&
this.delivery_receipt.equals(other.delivery_receipt) && this.delivery_receipt.equals(other.delivery_receipt) &&
this.read_receipt.equals(other.read_receipt) && this.read_receipt.equals(other.read_receipt) &&
this.store_sent.equals(other.store_sent) &&
(this.tbd == null ? other.tbd == null : this.tbd.equals(other.tbd)) && (this.tbd == null ? other.tbd == null : this.tbd.equals(other.tbd)) &&
(this.state == null ? other.state == null : this.state.equals(other.state)) && (this.state == null ? other.state == null : this.state.equals(other.state)) &&
(this.error == null ? other.error == null : this.error.equals(other.error)) && (this.error == null ? other.error == null : this.error.equals(other.error)) &&

@ -102,6 +102,8 @@ public class FragmentIdentity extends FragmentBase {
private CheckBox cbDeliveryReceipt; private CheckBox cbDeliveryReceipt;
private CheckBox cbReadReceipt; private CheckBox cbReadReceipt;
private CheckBox cbStoreSent;
private Button btnSave; private Button btnSave;
private ContentLoadingProgressBar pbSave; private ContentLoadingProgressBar pbSave;
private TextView tvError; private TextView tvError;
@ -167,6 +169,8 @@ public class FragmentIdentity extends FragmentBase {
cbDeliveryReceipt = view.findViewById(R.id.cbDeliveryReceipt); cbDeliveryReceipt = view.findViewById(R.id.cbDeliveryReceipt);
cbReadReceipt = view.findViewById(R.id.cbReadReceipt); cbReadReceipt = view.findViewById(R.id.cbReadReceipt);
cbStoreSent = view.findViewById(R.id.cbStoreSent);
btnSave = view.findViewById(R.id.btnSave); btnSave = view.findViewById(R.id.btnSave);
pbSave = view.findViewById(R.id.pbSave); pbSave = view.findViewById(R.id.pbSave);
tvError = view.findViewById(R.id.tvError); tvError = view.findViewById(R.id.tvError);
@ -463,6 +467,7 @@ public class FragmentIdentity extends FragmentBase {
args.putBoolean("plain_only", cbPlainOnly.isChecked()); args.putBoolean("plain_only", cbPlainOnly.isChecked());
args.putBoolean("delivery_receipt", cbDeliveryReceipt.isChecked()); args.putBoolean("delivery_receipt", cbDeliveryReceipt.isChecked());
args.putBoolean("read_receipt", cbReadReceipt.isChecked()); args.putBoolean("read_receipt", cbReadReceipt.isChecked());
args.putBoolean("store_sent", cbStoreSent.isChecked());
args.putLong("account", account == null ? -1 : account.id); args.putLong("account", account == null ? -1 : account.id);
args.putInt("auth_type", auth_type); args.putInt("auth_type", auth_type);
args.putString("host", etHost.getText().toString()); args.putString("host", etHost.getText().toString());
@ -522,6 +527,7 @@ public class FragmentIdentity extends FragmentBase {
boolean plain_only = args.getBoolean("plain_only"); boolean plain_only = args.getBoolean("plain_only");
boolean delivery_receipt = args.getBoolean("delivery_receipt"); boolean delivery_receipt = args.getBoolean("delivery_receipt");
boolean read_receipt = args.getBoolean("read_receipt"); boolean read_receipt = args.getBoolean("read_receipt");
boolean store_sent = args.getBoolean("store_sent");
if (TextUtils.isEmpty(name)) if (TextUtils.isEmpty(name))
throw new IllegalArgumentException(context.getString(R.string.title_no_name)); throw new IllegalArgumentException(context.getString(R.string.title_no_name));
@ -626,6 +632,8 @@ public class FragmentIdentity extends FragmentBase {
identity.plain_only = plain_only; identity.plain_only = plain_only;
identity.delivery_receipt = delivery_receipt; identity.delivery_receipt = delivery_receipt;
identity.read_receipt = read_receipt; identity.read_receipt = read_receipt;
identity.store_sent = store_sent;
identity.sent_folder = null;
identity.error = null; identity.error = null;
identity.last_connected = last_connected; identity.last_connected = last_connected;
@ -726,6 +734,7 @@ public class FragmentIdentity extends FragmentBase {
cbPlainOnly.setChecked(identity == null ? false : identity.plain_only); cbPlainOnly.setChecked(identity == null ? false : identity.plain_only);
cbDeliveryReceipt.setChecked(identity == null ? false : identity.delivery_receipt); cbDeliveryReceipt.setChecked(identity == null ? false : identity.delivery_receipt);
cbReadReceipt.setChecked(identity == null ? false : identity.read_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); color = (identity == null || identity.color == null ? Color.TRANSPARENT : identity.color);

@ -1987,7 +1987,13 @@ public class ServiceSynchronize extends LifecycleService {
EntityLog.log(this, "Sent via " + ident.host + "/" + ident.user + EntityLog.log(this, "Sent via " + ident.host + "/" + ident.user +
" to " + TextUtils.join(", ", to)); " to " + TextUtils.join(", ", to));
// Append replied/forwarded text
StringBuilder sb = new StringBuilder();
sb.append(Helper.readText(EntityMessage.getFile(this, message.id)));
File refFile = EntityMessage.getRefFile(this, message.id); File refFile = EntityMessage.getRefFile(this, message.id);
if (refFile.exists())
sb.append(Helper.readText(refFile));
Helper.writeText(EntityMessage.getFile(this, message.id), sb.toString());
try { try {
db.beginTransaction(); db.beginTransaction();
@ -1997,13 +2003,13 @@ public class ServiceSynchronize extends LifecycleService {
db.message().setMessageUiSeen(message.id, true); db.message().setMessageUiSeen(message.id, true);
db.message().setMessageError(message.id, null); db.message().setMessageError(message.id, null);
// Append replied/forwarded text EntityFolder sent = db.folder().getFolderByType(message.account, EntityFolder.SENT);
StringBuilder sb = new StringBuilder(); if (ident.store_sent && sent != null) {
sb.append(Helper.readText(EntityMessage.getFile(this, message.id))); db.message().setMessageFolder(message.id, sent.id);
if (refFile.exists()) message.folder = sent.id;
sb.append(Helper.readText(refFile)); EntityOperation.queue(this, db, message, EntityOperation.ADD);
} else
Helper.writeText(EntityMessage.getFile(this, message.id), sb.toString()); db.message().setMessageUiHide(message.id, true);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {

@ -485,6 +485,25 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbReadReceipt" /> app:layout_constraintTop_toBottomOf="@id/cbReadReceipt" />
<CheckBox
android:id="@+id/cbStoreSent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_identity_store_sent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReceipt" />
<TextView
android:id="@+id/tvStoreSent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_identity_store_sent_remark"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbStoreSent" />
<Button <Button
android:id="@+id/btnSave" android:id="@+id/btnSave"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -493,7 +512,7 @@
android:tag="disable" android:tag="disable"
android:text="@string/title_save" android:text="@string/title_save"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReceipt" /> app:layout_constraintTop_toBottomOf="@id/tvStoreSent" />
<eu.faircode.email.ContentLoadingProgressBar <eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbSave" android:id="@+id/pbSave"

@ -199,6 +199,8 @@
<string name="title_identity_read_receipt">Request read receipt</string> <string name="title_identity_read_receipt">Request read receipt</string>
<string name="title_identity_delivery_receipt">Request delivery receipt</string> <string name="title_identity_delivery_receipt">Request delivery receipt</string>
<string name="title_identity_receipt_remark">Most providers ignore receipt requests</string> <string name="title_identity_receipt_remark">Most providers ignore receipt requests</string>
<string name="title_identity_store_sent">Store sent messages</string>
<string name="title_identity_store_sent_remark">Enable this only if your provider does not automatically stores sent messages</string>
<string name="title_optional">Optional</string> <string name="title_optional">Optional</string>
<string name="title_account_linked">Linked account</string> <string name="title_account_linked">Linked account</string>
<string name="title_account_name">Account name</string> <string name="title_account_name">Account name</string>

Loading…
Cancel
Save