Show auth details in case of auth failures

This commit is contained in:
M66B 2024-05-12 09:41:54 +02:00
parent f2882193d7
commit 1e483b7438
1 changed files with 22 additions and 32 deletions

View File

@ -4929,61 +4929,48 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
result.add("MX"); result.add("MX");
if (result.size() > 0) if (result.size() > 0)
sb.append(context.getString(R.string.title_authentication_failed, TextUtils.join(", ", result))); sb.append(context.getString(R.string.title_authentication_failed, TextUtils.join(", ", result)))
else { .append('\n');
if (authentication_indicator) {
if (check_tls) if (check_tls)
sb.append("TLS: ") sb.append("TLS: ")
.append(message.tls == null ? "-" : (message.tls ? "" : "")) .append(message.tls == null ? "-" : (message.tls ? "" : "")).append('\n');
.append('\n');
sb.append("DKIM: ") sb.append("DKIM: ")
.append(message.dkim == null ? "-" : (message.dkim ? "" : "")) .append(message.dkim == null ? "-" : (message.dkim ? "" : "")).append('\n');
.append('\n');
sb.append("SPF: ") sb.append("SPF: ")
.append(message.spf == null ? "-" : (message.spf ? "" : "")) .append(message.spf == null ? "-" : (message.spf ? "" : "")).append('\n');
.append('\n');
sb.append("DMARC: ") sb.append("DMARC: ")
.append(message.dmarc == null ? "-" : (message.dmarc ? "" : "")) .append(message.dmarc == null ? "-" : (message.dmarc ? "" : "")).append('\n');
.append('\n');
if (message.auth != null) if (message.auth != null)
sb.append("SMTP: ").append(message.auth ? "" : ""); sb.append("SMTP: ")
.append(message.auth ? "" : "").append('\n');
if (check_mx) if (check_mx)
sb.append('\n') sb.append("MX: ")
.append("MX: ") .append(message.mx == null ? "-" : (message.mx ? "" : "")).append('\n');
.append(message.mx == null ? "-" : (message.mx ? "" : ""));
} }
if (native_dkim && !TextUtils.isEmpty(message.signedby)) { if (native_dkim && !TextUtils.isEmpty(message.signedby)) {
if (sb.length() > 0)
sb.append('\n');
sb.append("Signed by:"); sb.append("Signed by:");
for (String signer : message.signedby.split(",")) for (String signer : message.signedby.split(","))
sb.append('\n').append(signer); sb.append(signer).append('\n');
} }
if (Boolean.TRUE.equals(message.blocklist)) { if (Boolean.TRUE.equals(message.blocklist))
if (sb.length() > 0) sb.append(context.getString(R.string.title_on_blocklist)).append('\n');
sb.append('\n');
sb.append(context.getString(R.string.title_on_blocklist));
}
if (Boolean.FALSE.equals(message.from_domain) && message.smtp_from != null) if (Boolean.FALSE.equals(message.from_domain) && message.smtp_from != null)
for (Address smtp_from : message.smtp_from) { for (Address smtp_from : message.smtp_from) {
String domain = UriHelper.getEmailDomain(((InternetAddress) smtp_from).getAddress()); String domain = UriHelper.getEmailDomain(((InternetAddress) smtp_from).getAddress());
String root = UriHelper.getRootDomain(context, domain); String root = UriHelper.getRootDomain(context, domain);
if (root != null) { if (root != null)
if (sb.length() > 0) sb.append(context.getString(R.string.title_via, root)).append('\n');
sb.append('\n');
sb.append(context.getString(R.string.title_via, root));
}
} }
if (Boolean.FALSE.equals(message.reply_domain)) { if (Boolean.FALSE.equals(message.reply_domain)) {
String[] warning = message.checkReplyDomain(context); String[] warning = message.checkReplyDomain(context);
if (warning != null) { if (warning != null)
if (sb.length() > 0) sb.append(context.getString(R.string.title_reply_domain, warning[0], warning[1])).append('\n');
sb.append('\n');
sb.append(context.getString(R.string.title_reply_domain, warning[0], warning[1]));
}
} }
if (message.from != null && message.from.length > 0) { if (message.from != null && message.from.length > 0) {
@ -4993,6 +4980,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
sb.insert(0, '\n').insert(0, domain); sb.insert(0, '\n').insert(0, domain);
} }
if (sb.length() > 0 && sb.charAt(sb.length() - 1) == '\n')
sb.deleteCharAt(sb.length() - 1);
ToastEx.makeText(context, sb.toString(), Toast.LENGTH_LONG).show(); ToastEx.makeText(context, sb.toString(), Toast.LENGTH_LONG).show();
} }