|
|
@ -69,6 +69,8 @@ import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
|
|
|
|
import org.bouncycastle.asn1.edec.EdECObjectIdentifiers;
|
|
|
|
import org.bouncycastle.asn1.edec.EdECObjectIdentifiers;
|
|
|
|
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
|
|
|
|
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
|
|
|
|
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
|
|
|
|
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
|
|
|
|
|
|
|
|
import org.commonmark.parser.Parser;
|
|
|
|
|
|
|
|
import org.commonmark.renderer.html.HtmlRenderer;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import org.jsoup.nodes.Document;
|
|
|
|
import org.jsoup.nodes.Document;
|
|
|
|
import org.jsoup.nodes.Element;
|
|
|
|
import org.jsoup.nodes.Element;
|
|
|
@ -3497,6 +3499,10 @@ public class MessageHelper {
|
|
|
|
return "text/html".equalsIgnoreCase(contentType.getBaseType());
|
|
|
|
return "text/html".equalsIgnoreCase(contentType.getBaseType());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean isMarkdown() {
|
|
|
|
|
|
|
|
return "text/markdown".equalsIgnoreCase(contentType.getBaseType());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
boolean isReport() {
|
|
|
|
boolean isReport() {
|
|
|
|
String ct = contentType.getBaseType();
|
|
|
|
String ct = contentType.getBaseType();
|
|
|
|
return (Report.isDeliveryStatus(ct) ||
|
|
|
|
return (Report.isDeliveryStatus(ct) ||
|
|
|
@ -3903,6 +3909,16 @@ public class MessageHelper {
|
|
|
|
Helper.copy(h.part.getDataHandler().getInputStream(), bos);
|
|
|
|
Helper.copy(h.part.getDataHandler().getInputStream(), bos);
|
|
|
|
result = bos.toString(override);
|
|
|
|
result = bos.toString(override);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (h.isMarkdown()) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Parser p = Parser.builder().build();
|
|
|
|
|
|
|
|
org.commonmark.node.Node d = p.parse(result);
|
|
|
|
|
|
|
|
HtmlRenderer r = HtmlRenderer.builder().build();
|
|
|
|
|
|
|
|
return r.render(d);
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
|
|
|
return HtmlHelper.formatPlainText(Log.formatThrowable(ex));
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (h.isReport()) {
|
|
|
|
} else if (h.isReport()) {
|
|
|
|
Report report = new Report(h.contentType.getBaseType(), result);
|
|
|
|
Report report = new Report(h.contentType.getBaseType(), result);
|
|
|
|
result = report.html;
|
|
|
|
result = report.html;
|
|
|
@ -5028,6 +5044,9 @@ public class MessageHelper {
|
|
|
|
filename += ".html";
|
|
|
|
filename += ".html";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("text/markdown".equalsIgnoreCase(ct))
|
|
|
|
|
|
|
|
parts.extra.add(new PartHolder(part, contentType));
|
|
|
|
|
|
|
|
|
|
|
|
if (Report.isDeliveryStatus(ct) ||
|
|
|
|
if (Report.isDeliveryStatus(ct) ||
|
|
|
|
Report.isDispositionNotification(ct) ||
|
|
|
|
Report.isDispositionNotification(ct) ||
|
|
|
|
Report.isFeedbackReport(ct))
|
|
|
|
Report.isFeedbackReport(ct))
|
|
|
|