mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-14 21:13:37 +02:00
Added option for forward threading
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user