From cadc97d77e437f7cecc84658a7387cbb34a73b9a Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 30 Apr 2023 09:11:35 +0200 Subject: [PATCH] Improved debug info --- .../java/eu/faircode/email/EmailService.java | 13 +++++++++++++ app/src/main/java/eu/faircode/email/Log.java | 19 +++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index 82e42f6afe..28ae5c5941 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -1370,6 +1370,19 @@ public class EmailService implements AutoCloseable { } } + static String getEncryptionName(int type) { + switch (type) { + case ENCRYPTION_SSL: + return "ssl"; + case ENCRYPTION_STARTTLS: + return "starttls"; + case ENCRYPTION_NONE: + return "none"; + default: + return Integer.toString(type); + } + } + static class UntrustedException extends MessagingException { private X509Certificate certificate; diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 650772adc2..36efd8b2e9 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -2489,7 +2489,9 @@ public class Log { " " + (account.protocol == EntityAccount.TYPE_IMAP ? "IMAP" : "POP") + " [" + (account.provider == null ? "" : account.provider) + ":" + ServiceAuthenticator.getAuthTypeName(account.auth_type) + "]" + - " " + account.host + ":" + account.port + "/" + account.encryption + + " " + account.host + ":" + account.port + "/" + + EmailService.getEncryptionName(account.encryption) + + (account.insecure ? " !!!" : "") + " sync=" + account.synchronize + " exempted=" + account.poll_exempted + " poll=" + account.poll_interval + @@ -2506,7 +2508,7 @@ public class Log { if (folders.size() > 0) Collections.sort(folders, folders.get(0).getComparator(context)); for (TupleFolderEx folder : folders) - if (folder.synchronize) { + if (folder.synchronize || account.protocol == EntityAccount.TYPE_POP) { int unseen = db.message().countUnseen(folder.id); int hidden = db.message().countHidden(folder.id); int notifying = db.message().countNotifying(folder.id); @@ -2515,7 +2517,7 @@ public class Log { (folder.unified ? " unified" : "") + (folder.notify ? " notify" : "") + " poll=" + folder.poll + "/" + folder.poll_factor + - " days=" + folder.sync_days + "/" + folder.keep_days + + " days=" + getDays(folder.sync_days) + "/" + getDays(folder.keep_days) + " msgs=" + folder.content + "/" + folder.messages + "/" + folder.total + " ops=" + db.operation().getOperationCount(folder.id, null) + " unseen=" + unseen + " hidden=" + hidden + " notifying=" + notifying + @@ -2553,7 +2555,9 @@ public class Log { (!identity.sender_extra ? "" : " edit" + (identity.sender_extra_name ? "+name" : "-name") + (identity.reply_extra_name ? "+copy" : "-copy")) + - " " + identity.host + ":" + identity.port + "/" + identity.encryption + + " " + identity.host + ":" + identity.port + "/" + + EmailService.getEncryptionName(identity.encryption) + + (identity.insecure ? " !!!" : "") + " ops=" + db.operation().getOperationCount(EntityOperation.SEND) + " " + identity.state + (identity.last_connected == null ? "" : " " + dtf.format(identity.last_connected)) + @@ -2641,6 +2645,13 @@ public class Log { } } + private static String getDays(Integer days) { + if (days == null) + return "?"; + else + return (days == Integer.MAX_VALUE ? "∞" : Integer.toString(days)); + } + private static void attachNetworkInfo(Context context, long id, int sequence) { try { DB db = DB.getInstance(context);