From 16c3a985bfeb025d418f74725ae50a3c5c233491 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 4 Mar 2023 13:30:47 +0100 Subject: [PATCH] Debug info: auth type --- app/src/main/java/eu/faircode/email/Log.java | 8 +++++--- .../eu/faircode/email/ServiceAuthenticator.java | 13 +++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 067d0c67f4..8eb40a67a9 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -2427,8 +2427,9 @@ public class Log { } size += write(os, account.name + (account.primary ? "*" : "") + - " " + (account.protocol == EntityAccount.TYPE_IMAP ? "IMAP" : "POP") + "/" + account.auth_type + - (account.provider == null ? "" : " [" + account.provider + "]") + + " " + (account.protocol == EntityAccount.TYPE_IMAP ? "IMAP" : "POP") + + " [" + (account.provider == null ? "" : account.provider) + + ":" + ServiceAuthenticator.getAuthTypeName(account.auth_type) + "]" + " " + account.host + ":" + account.port + "/" + account.encryption + " sync=" + account.synchronize + " exempted=" + account.poll_exempted + @@ -2487,7 +2488,8 @@ public class Log { size += write(os, account.name + "/" + identity.name + (identity.primary ? "*" : "") + " " + identity.display + " " + identity.email + (identity.self ? "" : " !self") + - (identity.provider == null ? "" : " [" + identity.provider + "]") + + " [" + (identity.provider == null ? "" : identity.provider) + + ":" + ServiceAuthenticator.getAuthTypeName(identity.auth_type) + "]" + (TextUtils.isEmpty(identity.sender_extra_regex) ? "" : " regex=" + identity.sender_extra_regex) + (!identity.sender_extra ? "" : " edit" + (identity.sender_extra_name ? "+name" : "-name") + diff --git a/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java b/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java index c7f75bebd2..9959f63548 100644 --- a/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java +++ b/app/src/main/java/eu/faircode/email/ServiceAuthenticator.java @@ -232,6 +232,19 @@ public class ServiceAuthenticator extends Authenticator { } } + static String getAuthTypeName(int auth_type) { + if (auth_type == AUTH_TYPE_PASSWORD) + return "password"; + else if (auth_type == AUTH_TYPE_GMAIL) + return "gmail"; + else if (auth_type == AUTH_TYPE_OAUTH) + return "oauth"; + else if (auth_type == AUTH_TYPE_GRAPH) + return "graph"; + else + return "?" + auth_type; + } + static String getAuthTokenType(String type) { // https://developers.google.com/gmail/imap/xoauth2-protocol if (TYPE_GOOGLE.equals(type))