Loading app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +13 −16 Original line number Diff line number Diff line Loading @@ -1501,7 +1501,6 @@ public class MessagingController { @VisibleForTesting protected void sendPendingMessagesSynchronous(final Account account) { Exception lastFailure = null; boolean wasPermanentFailure = false; try { if (isAuthenticationProblem(account, false)) { Timber.d("Authentication will fail. Skip sending messages."); Loading Loading @@ -1551,10 +1550,16 @@ public class MessagingController { long messageId = message.getDatabaseId(); OutboxState outboxState = outboxStateRepository.getOutboxState(messageId); if (outboxState.getSendState() != SendState.READY) { Timber.v("Skipping sending message %s", message.getUid()); notificationController.showSendFailedNotification(account, new MessagingException(message.getSubject())); SendState sendState = outboxState.getSendState(); if (sendState != SendState.READY) { Timber.v("Skipping sending message %s (reason: %s)", message.getUid(), sendState.getDatabaseName()); if (sendState == SendState.RETRIES_EXCEEDED) { lastFailure = new MessagingException("Retries exceeded", true); } else { lastFailure = new MessagingException(outboxState.getSendError(), true); } continue; } Loading Loading @@ -1587,22 +1592,19 @@ public class MessagingController { } catch (AuthenticationFailedException e) { outboxStateRepository.decrementSendAttempts(messageId); lastFailure = e; wasPermanentFailure = false; handleAuthenticationFailure(account, false); handleSendFailure(account, localFolder, message, e); } catch (CertificateValidationException e) { outboxStateRepository.decrementSendAttempts(messageId); lastFailure = e; wasPermanentFailure = false; notifyUserIfCertificateProblem(account, e, false); handleSendFailure(account, localFolder, message, e); } catch (MessagingException e) { lastFailure = e; wasPermanentFailure = e.isPermanentFailure(); if (wasPermanentFailure) { if (e.isPermanentFailure()) { String errorMessage = e.getMessage(); outboxStateRepository.setSendAttemptError(messageId, errorMessage); } else if (outboxState.getNumberOfSendAttempts() + 1 >= MAX_SEND_ATTEMPTS) { Loading @@ -1612,24 +1614,19 @@ public class MessagingController { handleSendFailure(account, localFolder, message, e); } catch (Exception e) { lastFailure = e; wasPermanentFailure = true; handleSendFailure(account, localFolder, message, e); } } catch (Exception e) { lastFailure = e; wasPermanentFailure = false; Timber.e(e, "Failed to fetch message for sending"); notifySynchronizeMailboxFailed(account, localFolder, e); } } if (lastFailure != null) { if (wasPermanentFailure) { notificationController.showSendFailedNotification(account, lastFailure); } else { notificationController.showSendFailedNotification(account, lastFailure); } } } catch (Exception e) { Timber.v(e, "Failed to send pending messages"); Loading Loading
app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +13 −16 Original line number Diff line number Diff line Loading @@ -1501,7 +1501,6 @@ public class MessagingController { @VisibleForTesting protected void sendPendingMessagesSynchronous(final Account account) { Exception lastFailure = null; boolean wasPermanentFailure = false; try { if (isAuthenticationProblem(account, false)) { Timber.d("Authentication will fail. Skip sending messages."); Loading Loading @@ -1551,10 +1550,16 @@ public class MessagingController { long messageId = message.getDatabaseId(); OutboxState outboxState = outboxStateRepository.getOutboxState(messageId); if (outboxState.getSendState() != SendState.READY) { Timber.v("Skipping sending message %s", message.getUid()); notificationController.showSendFailedNotification(account, new MessagingException(message.getSubject())); SendState sendState = outboxState.getSendState(); if (sendState != SendState.READY) { Timber.v("Skipping sending message %s (reason: %s)", message.getUid(), sendState.getDatabaseName()); if (sendState == SendState.RETRIES_EXCEEDED) { lastFailure = new MessagingException("Retries exceeded", true); } else { lastFailure = new MessagingException(outboxState.getSendError(), true); } continue; } Loading Loading @@ -1587,22 +1592,19 @@ public class MessagingController { } catch (AuthenticationFailedException e) { outboxStateRepository.decrementSendAttempts(messageId); lastFailure = e; wasPermanentFailure = false; handleAuthenticationFailure(account, false); handleSendFailure(account, localFolder, message, e); } catch (CertificateValidationException e) { outboxStateRepository.decrementSendAttempts(messageId); lastFailure = e; wasPermanentFailure = false; notifyUserIfCertificateProblem(account, e, false); handleSendFailure(account, localFolder, message, e); } catch (MessagingException e) { lastFailure = e; wasPermanentFailure = e.isPermanentFailure(); if (wasPermanentFailure) { if (e.isPermanentFailure()) { String errorMessage = e.getMessage(); outboxStateRepository.setSendAttemptError(messageId, errorMessage); } else if (outboxState.getNumberOfSendAttempts() + 1 >= MAX_SEND_ATTEMPTS) { Loading @@ -1612,24 +1614,19 @@ public class MessagingController { handleSendFailure(account, localFolder, message, e); } catch (Exception e) { lastFailure = e; wasPermanentFailure = true; handleSendFailure(account, localFolder, message, e); } } catch (Exception e) { lastFailure = e; wasPermanentFailure = false; Timber.e(e, "Failed to fetch message for sending"); notifySynchronizeMailboxFailed(account, localFolder, e); } } if (lastFailure != null) { if (wasPermanentFailure) { notificationController.showSendFailedNotification(account, lastFailure); } else { notificationController.showSendFailedNotification(account, lastFailure); } } } catch (Exception e) { Timber.v(e, "Failed to send pending messages"); Loading