From e475e5173111374214bab35fba3bc4f192c09811 Mon Sep 17 00:00:00 2001 From: Joe Steele Date: Thu, 6 Mar 2014 17:30:15 -0500 Subject: [PATCH] Rework handling of certificate errors while pushing Eliminate import of MessagingController in ImapStore. --- src/com/fsck/k9/controller/MessagingController.java | 4 ++-- .../fsck/k9/controller/MessagingControllerPushReceiver.java | 1 + src/com/fsck/k9/mail/store/ImapStore.java | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 2fa6d3fd5..0be607b48 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -2628,7 +2628,7 @@ public class MessagingController implements Runnable { } } - public static void notifyUserIfCertificateProblem(Context context, Exception e, + void notifyUserIfCertificateProblem(Context context, Exception e, Account account, boolean incoming) { if (!(e instanceof CertificateValidationException)) { return; @@ -5044,7 +5044,7 @@ public class MessagingController implements Runnable { * @param ringAndVibrate * {@code true}, if ringtone/vibration are allowed. {@code false}, otherwise. */ - private static void configureNotification(NotificationCompat.Builder builder, String ringtone, + private void configureNotification(NotificationCompat.Builder builder, String ringtone, long[] vibrationPattern, Integer ledColor, int ledSpeed, boolean ringAndVibrate) { // if it's quiet time, then we shouldn't be ringing, buzzing or flashing diff --git a/src/com/fsck/k9/controller/MessagingControllerPushReceiver.java b/src/com/fsck/k9/controller/MessagingControllerPushReceiver.java index 8c6cba860..0a2a1711b 100644 --- a/src/com/fsck/k9/controller/MessagingControllerPushReceiver.java +++ b/src/com/fsck/k9/controller/MessagingControllerPushReceiver.java @@ -77,6 +77,7 @@ public class MessagingControllerPushReceiver implements PushReceiver { public void pushError(String errorMessage, Exception e) { String errMess = errorMessage; + controller.notifyUserIfCertificateProblem(mApplication, e, account, true); if (errMess == null && e != null) { errMess = e.getMessage(); } diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index f4986d05f..64e0d9fd2 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -67,7 +67,6 @@ import com.fsck.k9.Account; import com.fsck.k9.K9; import com.fsck.k9.R; import com.fsck.k9.controller.MessageRetrievalListener; -import com.fsck.k9.controller.MessagingController; import com.fsck.k9.helper.StringUtils; import com.fsck.k9.helper.Utility; import com.fsck.k9.helper.power.TracingPowerManager; @@ -3133,7 +3132,6 @@ public class ImapStore extends Store { if (stop.get()) { Log.i(K9.LOG_TAG, "Got exception while idling, but stop is set for " + getLogId()); } else { - MessagingController.notifyUserIfCertificateProblem(K9.app, e, getAccount(), true); receiver.pushError("Push error for " + getName(), e); Log.e(K9.LOG_TAG, "Got exception while idling for " + getLogId(), e); int delayTimeInt = delayTime.get();