Allow multiple In-reply-to addresses

pull/208/head
M66B 3 years ago
parent 9fbc7ee94e
commit 3bac46e478

@ -1313,23 +1313,32 @@ public class MessageHelper {
} }
String getInReplyTo() throws MessagingException { String getInReplyTo() throws MessagingException {
String[] a = getInReplyTos();
return (a.length < 1 ? null : a[0]);
}
String[] getInReplyTos() throws MessagingException {
ensureHeaders(); ensureHeaders();
List<String> result = new ArrayList<>();
String header = imessage.getHeader("In-Reply-To", null); String header = imessage.getHeader("In-Reply-To", null);
if (header != null) if (header != null)
header = MimeUtility.unfold(header); result.addAll(Arrays.asList(getReferences(header)));
if (header == null) { 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 (header != null) {
result.add(header);
Log.i("rfc822 id=" + header); Log.i("rfc822 id=" + header);
}
} }
} }
return header; return result.toArray(new String[0]);
} }
private InternetHeaders getReportHeaders() { private InternetHeaders getReportHeaders() {
@ -1393,9 +1402,9 @@ public class MessageHelper {
if (!TextUtils.isEmpty(ref) && !refs.contains(ref)) if (!TextUtils.isEmpty(ref) && !refs.contains(ref))
refs.add(ref); refs.add(ref);
String inreplyto = getInReplyTo(); for (String inreplyto : getInReplyTos())
if (!TextUtils.isEmpty(inreplyto) && !refs.contains(inreplyto)) if (!TextUtils.isEmpty(inreplyto) && !refs.contains(inreplyto))
refs.add(inreplyto); refs.add(inreplyto);
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
List<EntityMessage> before = new ArrayList<>(); List<EntityMessage> before = new ArrayList<>();

Loading…
Cancel
Save