Improved DSN decoding

pull/194/head
M66B 5 years ago
parent 57f6edcb41
commit 1530322087

@ -1920,23 +1920,28 @@ 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 {
int colon = line.indexOf(':');
if (colon < 0)
report.append(line);
else { else {
int colon = line.indexOf(':'); String name = line.substring(0, colon).trim();
if (colon < 0) String value = line.substring(colon + 1).trim();
report.append(line); value = decodeMime(value);
else report
report .append("<strong>")
.append("<strong>") .append(TextUtils.htmlEncode(name))
.append(line.substring(0, colon)) .append("</strong>")
.append("</strong>") .append(": ")
.append(line.substring(colon)) .append(TextUtils.htmlEncode(value))
.append("<br />"); .append("<br>");
} }
} }
report.append("</div>"); report.append("</div>");
result = report.toString(); result = report.toString();
} else } else

Loading…
Cancel
Save