Improved DSN decoding

This commit is contained in:
M66B 2021-02-03 22:02:25 +01:00
parent 57f6edcb41
commit 1530322087
1 changed files with 20 additions and 15 deletions

View File

@ -1920,21 +1920,26 @@ public class MessageHelper {
} else if (h.isDSN()) { } else if (h.isDSN()) {
StringBuilder report = new StringBuilder(); StringBuilder report = new StringBuilder();
report.append("<hr><div style=\"font-family: monospace; font-size: small;\">"); report.append("<hr><div style=\"font-family: monospace; font-size: small;\">");
for (String line : result.split("\\r?\\n")) { for (String line : result.split("\\r?\\n"))
if (line.length() > 0) if (line.length() == 0)
if (Character.isWhitespace(line.charAt(0))) report.append("<br>");
report.append(line).append("<br />"); else if (Character.isWhitespace(line.charAt(0)))
report.append(line).append("<br>");
else { else {
int colon = line.indexOf(':'); int colon = line.indexOf(':');
if (colon < 0) if (colon < 0)
report.append(line); report.append(line);
else else {
String name = line.substring(0, colon).trim();
String value = line.substring(colon + 1).trim();
value = decodeMime(value);
report report
.append("<strong>") .append("<strong>")
.append(line.substring(0, colon)) .append(TextUtils.htmlEncode(name))
.append("</strong>") .append("</strong>")
.append(line.substring(colon)) .append(": ")
.append("<br />"); .append(TextUtils.htmlEncode(value))
.append("<br>");
} }
} }
report.append("</div>"); report.append("</div>");