mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 09:47:13 +00:00
Simplified references
This commit is contained in:
parent
bf0532c46c
commit
ba186235e0
1 changed files with 20 additions and 14 deletions
|
@ -1267,22 +1267,20 @@ public class MessageHelper {
|
||||||
|
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
String refs = imessage.getHeader("References", null);
|
String refs = imessage.getHeader("References", null);
|
||||||
if (refs != null)
|
result.addAll(getReferences(refs));
|
||||||
result.addAll(Arrays.asList(getReferences(refs)));
|
|
||||||
|
|
||||||
// Merge references of reported message for threading
|
// Merge references of reported message for threading
|
||||||
InternetHeaders iheaders = getReportHeaders();
|
InternetHeaders iheaders = getReportHeaders();
|
||||||
if (iheaders != null) {
|
if (iheaders != null) {
|
||||||
String arefs = iheaders.getHeader("References", null);
|
String arefs = iheaders.getHeader("References", null);
|
||||||
if (arefs != null)
|
for (String ref : getReferences(arefs))
|
||||||
for (String ref : getReferences(arefs))
|
if (!result.contains(ref)) {
|
||||||
if (!result.contains(ref)) {
|
Log.i("rfc822 ref=" + ref);
|
||||||
Log.i("rfc822 ref=" + ref);
|
result.add(ref);
|
||||||
result.add(ref);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
String amsgid = iheaders.getHeader("Message-Id", null);
|
String amsgid = iheaders.getHeader("Message-Id", null);
|
||||||
if (amsgid != null) {
|
if (!TextUtils.isEmpty(amsgid)) {
|
||||||
String msgid = MimeUtility.unfold(amsgid);
|
String msgid = MimeUtility.unfold(amsgid);
|
||||||
if (!result.contains(msgid)) {
|
if (!result.contains(msgid)) {
|
||||||
Log.i("rfc822 id=" + msgid);
|
Log.i("rfc822 id=" + msgid);
|
||||||
|
@ -1294,8 +1292,17 @@ public class MessageHelper {
|
||||||
return result.toArray(new String[0]);
|
return result.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] getReferences(String header) {
|
private List<String> getReferences(String header) {
|
||||||
return MimeUtility.unfold(header).split("[,\\s]+");
|
List<String> result = new ArrayList<>();
|
||||||
|
if (header == null)
|
||||||
|
return result;
|
||||||
|
header = MimeUtility.unfold(header);
|
||||||
|
if (TextUtils.isEmpty(header))
|
||||||
|
return result;
|
||||||
|
for (String ref : header.split("[,\\s]+"))
|
||||||
|
if (!result.contains(ref))
|
||||||
|
result.add(ref);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getDeliveredTo() throws MessagingException {
|
String getDeliveredTo() throws MessagingException {
|
||||||
|
@ -1325,15 +1332,14 @@ public class MessageHelper {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
String header = imessage.getHeader("In-Reply-To", null);
|
String header = imessage.getHeader("In-Reply-To", null);
|
||||||
if (header != null)
|
result.addAll(getReferences(header));
|
||||||
result.addAll(Arrays.asList(getReferences(header)));
|
|
||||||
|
|
||||||
if (result.size() == 0) {
|
if (result.size() == 0) {
|
||||||
// Use reported message ID as synthetic in-reply-to
|
// Use reported message ID as synthetic in-reply-to
|
||||||
InternetHeaders iheaders = getReportHeaders();
|
InternetHeaders iheaders = getReportHeaders();
|
||||||
if (iheaders != null) {
|
if (iheaders != null) {
|
||||||
header = iheaders.getHeader("Message-Id", null);
|
header = iheaders.getHeader("Message-Id", null);
|
||||||
if (header != null) {
|
if (!TextUtils.isEmpty(header)) {
|
||||||
result.add(header);
|
result.add(header);
|
||||||
Log.i("rfc822 id=" + header);
|
Log.i("rfc822 id=" + header);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue