mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 12:44:42 +00:00
Added option for forward threading
This commit is contained in:
parent
4fee7ecfdc
commit
0fac4cf7f0
5 changed files with 50 additions and 3 deletions
|
@ -4520,6 +4520,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
boolean auto_identity = prefs.getBoolean("auto_identity", true);
|
||||
boolean suggest_sent = prefs.getBoolean("suggest_sent", true);
|
||||
boolean suggest_received = prefs.getBoolean("suggest_received", false);
|
||||
boolean forward_new = prefs.getBoolean("forward_new", true);
|
||||
|
||||
Log.i("Load draft action=" + action + " id=" + id + " reference=" + reference);
|
||||
|
||||
|
@ -4851,7 +4852,12 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
|
||||
} else if ("forward".equals(action)) {
|
||||
data.draft.thread = data.draft.msgid; // new thread
|
||||
if (forward_new)
|
||||
data.draft.thread = data.draft.msgid; // new thread
|
||||
else {
|
||||
data.draft.thread = ref.thread;
|
||||
data.draft.references = (ref.references == null ? "" : ref.references + " ") + ref.msgid;
|
||||
}
|
||||
data.draft.wasforwardedfrom = ref.msgid;
|
||||
} else if ("resend".equals(action)) {
|
||||
data.draft.resend = true;
|
||||
|
|
|
@ -102,6 +102,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
private SwitchCompat swReceipt;
|
||||
private Spinner spReceiptType;
|
||||
private SwitchCompat swReceiptLegacy;
|
||||
private SwitchCompat swForwardNew;
|
||||
private SwitchCompat swLookupMx;
|
||||
private SwitchCompat swReplyMove;
|
||||
|
||||
|
@ -118,7 +119,9 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
"separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
|
||||
"signature_location", "signature_new", "signature_reply", "signature_reply_once", "signature_forward",
|
||||
"attach_new", "auto_link", "plain_only", "format_flowed", "usenet_signature", "remove_signatures",
|
||||
"receipt_default", "receipt_type", "receipt_legacy", "lookup_mx", "reply_move"
|
||||
"receipt_default", "receipt_type", "receipt_legacy",
|
||||
"forward_new",
|
||||
"lookup_mx", "reply_move"
|
||||
};
|
||||
|
||||
@Override
|
||||
|
@ -178,6 +181,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
swReceipt = view.findViewById(R.id.swReceipt);
|
||||
spReceiptType = view.findViewById(R.id.spReceiptType);
|
||||
swReceiptLegacy = view.findViewById(R.id.swReceiptLegacy);
|
||||
swForwardNew = view.findViewById(R.id.swForwardNew);
|
||||
swLookupMx = view.findViewById(R.id.swLookupMx);
|
||||
swReplyMove = view.findViewById(R.id.swReplyMove);
|
||||
|
||||
|
@ -566,6 +570,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swForwardNew.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("forward_new", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swLookupMx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -711,6 +722,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
|
||||
swReceiptLegacy.setChecked(prefs.getBoolean("receipt_legacy", false));
|
||||
|
||||
swForwardNew.setChecked(prefs.getBoolean("forward_new", true));
|
||||
swLookupMx.setChecked(prefs.getBoolean("lookup_mx", false));
|
||||
swReplyMove.setChecked(prefs.getBoolean("reply_move", false));
|
||||
}
|
||||
|
|
|
@ -281,6 +281,7 @@ public class MessageHelper {
|
|||
boolean autocrypt = prefs.getBoolean("autocrypt", true);
|
||||
boolean mutual = prefs.getBoolean("autocrypt_mutual", true);
|
||||
boolean encrypt_subject = prefs.getBoolean("encrypt_subject", false);
|
||||
boolean forward_new = prefs.getBoolean("forward_new", true);
|
||||
|
||||
Map<String, String> c = new HashMap<>();
|
||||
c.put("id", message.id == null ? null : Long.toString(message.id));
|
||||
|
@ -338,8 +339,13 @@ public class MessageHelper {
|
|||
}
|
||||
imessage.addHeader("References", references);
|
||||
}
|
||||
|
||||
if (message.inreplyto != null)
|
||||
imessage.addHeader("In-Reply-To", message.inreplyto);
|
||||
|
||||
if (message.wasforwardedfrom != null && !forward_new)
|
||||
imessage.addHeader("X-Forwarded-Message-Id", message.wasforwardedfrom);
|
||||
|
||||
imessage.addHeader(HEADER_CORRELATION_ID, message.msgid);
|
||||
|
||||
MailDateFormat mdf = new MailDateFormat();
|
||||
|
@ -1493,6 +1499,16 @@ public class MessageHelper {
|
|||
if (!TextUtils.isEmpty(inreplyto) && !refs.contains(inreplyto))
|
||||
refs.add(inreplyto);
|
||||
|
||||
boolean forward_new = prefs.getBoolean("forward_new", true);
|
||||
if (!forward_new)
|
||||
try {
|
||||
String fwd = imessage.getHeader("X-Forwarded-Message-Id", null);
|
||||
if (!TextUtils.isEmpty(fwd) && !refs.contains(fwd))
|
||||
refs.add(fwd);
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
List<String> all = new ArrayList<>(refs);
|
||||
|
|
|
@ -840,6 +840,18 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/spReceiptType"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swForwardNew"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_forward_new"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swReceiptLegacy"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swLookupMx"
|
||||
android:layout_width="0dp"
|
||||
|
@ -848,7 +860,7 @@
|
|||
android:text="@string/title_advanced_lookup_mx"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swReceiptLegacy"
|
||||
app:layout_constraintTop_toBottomOf="@id/swForwardNew"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -427,6 +427,7 @@
|
|||
<string name="title_advanced_usenet_signature">Follow Usenet signature convention</string>
|
||||
<string name="title_advanced_remove_signatures">Remove recognized signatures</string>
|
||||
<string name="title_advanced_receipt">When requesting a receipt</string>
|
||||
<string name="title_advanced_forward_new">Start a new conversation when forwarding</string>
|
||||
<string name="title_advanced_lookup_mx">Check recipient email addresses before sending</string>
|
||||
|
||||
<string name="title_advanced_metered">Use metered connections</string>
|
||||
|
|
Loading…
Reference in a new issue