diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 78837e8dc1..86636f444f 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -389,23 +389,24 @@ public class ServiceSynchronize extends LifecycleService { final DB db = DB.getInstance(this); final ExecutorService executor = Executors.newSingleThreadExecutor(); - boolean debug = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("debug", false); - if (debug) - System.setProperty("mail.socket.debug", "true"); - - // Refresh token - if (account.auth_type == Helper.AUTH_TYPE_GMAIL) { - account.password = Helper.refreshToken(this, "com.google", account.user, account.password); - db.account().setAccountPassword(account.id, account.password); - } - - Properties props = MessageHelper.getSessionProperties(account.auth_type); - final Session isession = Session.getInstance(props, null); - isession.setDebug(debug); - // adb -t 1 logcat | grep "fairemail\|System.out" - int backoff = CONNECT_BACKOFF_START; while (state.running) { + // Debug + boolean debug = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("debug", false); + if (debug) + System.setProperty("mail.socket.debug", "true"); + + // Refresh token + if (account.auth_type == Helper.AUTH_TYPE_GMAIL) { + account.password = Helper.refreshToken(this, "com.google", account.user, account.password); + db.account().setAccountPassword(account.id, account.password); + } + + Properties props = MessageHelper.getSessionProperties(account.auth_type); + final Session isession = Session.getInstance(props, null); + isession.setDebug(debug); + // adb -t 1 logcat | grep "fairemail\|System.out" + final IMAPStore istore = (IMAPStore) isession.getStore("imaps"); final Map folders = new HashMap<>(); List noops = new ArrayList<>();