Allow multiple In-reply-to addresses

This commit is contained in:
M66B 2022-06-13 19:14:54 +02:00
parent 9fbc7ee94e
commit 3bac46e478
1 changed files with 16 additions and 7 deletions

View File

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