diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java index ce62a6bc9..b1e4d98c6 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java @@ -32,21 +32,21 @@ public class MessagingControllerPushReceiver implements PushReceiver { this.context = context; } - public void messagesFlagsChanged(Folder folder, List messages) { - syncFolder(folder); + public void messagesFlagsChanged(String folderServerId, List messages) { + syncFolder(folderServerId); } - public void messagesArrived(Folder folder, List messages) { - syncFolder(folder); + public void messagesArrived(String folderServerId, List messages) { + syncFolder(folderServerId); } - public void messagesRemoved(Folder folder, List messages) { - syncFolder(folder); + public void messagesRemoved(String folderServerId, List messages) { + syncFolder(folderServerId); } - public void syncFolder(Folder folder) { - Timber.v("syncFolder(%s)", folder.getServerId()); + public void syncFolder(String folderServerId) { + Timber.v("syncFolder(%s)", folderServerId); final CountDownLatch latch = new CountDownLatch(1); - controller.synchronizeMailbox(account, folder.getServerId(), new SimpleMessagingListener() { + controller.synchronizeMailbox(account, folderServerId, new SimpleMessagingListener() { @Override public void synchronizeMailboxFinished(Account account, String folderServerId, int totalMessagesInMailbox, int numNewMessages) { @@ -58,13 +58,13 @@ public class MessagingControllerPushReceiver implements PushReceiver { String message) { latch.countDown(); } - }, folder); + }, null); - Timber.v("syncFolder(%s) about to await latch release", folder.getServerId()); + Timber.v("syncFolder(%s) about to await latch release", folderServerId); try { latch.await(); - Timber.v("syncFolder(%s) got latch release", folder.getServerId()); + Timber.v("syncFolder(%s) got latch release", folderServerId); } catch (Exception e) { Timber.e(e, "Interrupted while awaiting latch release"); } diff --git a/mail/common/src/main/java/com/fsck/k9/mail/PushReceiver.java b/mail/common/src/main/java/com/fsck/k9/mail/PushReceiver.java index fa27292f8..905f9c30f 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/PushReceiver.java +++ b/mail/common/src/main/java/com/fsck/k9/mail/PushReceiver.java @@ -7,10 +7,10 @@ import com.fsck.k9.mail.power.WakeLock; public interface PushReceiver { - void syncFolder(Folder folder); - void messagesArrived(Folder folder, List mess); - void messagesFlagsChanged(Folder folder, List mess); - void messagesRemoved(Folder folder, List mess); + void syncFolder(String folderServerId); + void messagesArrived(String folderServerId, List mess); + void messagesFlagsChanged(String folderServerId, List mess); + void messagesRemoved(String folderServerId, List mess); String getPushState(String folderServerId); void pushError(String errorMessage, Exception e); void authenticationFailed(); diff --git a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java index 6621489b0..e09f64105 100644 --- a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java +++ b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/ImapFolderPusher.java @@ -592,7 +592,7 @@ class ImapFolderPusher extends ImapFolder { } if (!messages.isEmpty()) { - pushReceiver.messagesArrived(ImapFolderPusher.this, messages); + pushReceiver.messagesArrived(getServerId(), messages); } } } @@ -604,7 +604,7 @@ class ImapFolderPusher extends ImapFolder { List messageList = getMessages(messageSeqSet, true, null); List messages = new ArrayList<>(messageList); - pushReceiver.messagesFlagsChanged(ImapFolderPusher.this, messages); + pushReceiver.messagesFlagsChanged(getServerId(), messages); } catch (Exception e) { pushReceiver.pushError("Exception while processing Push untagged responses", e); } @@ -637,7 +637,7 @@ class ImapFolderPusher extends ImapFolder { messages.add(message); } - pushReceiver.messagesRemoved(ImapFolderPusher.this, messages); + pushReceiver.messagesRemoved(getServerId(), messages); } catch (Exception e) { Timber.e("Cannot remove EXPUNGEd messages"); } @@ -650,7 +650,7 @@ class ImapFolderPusher extends ImapFolder { throw new MessagingException("Message count = -1 for idling"); } - pushReceiver.syncFolder(ImapFolderPusher.this); + pushReceiver.syncFolder(getServerId()); } private void notifyMessagesArrived(long startUid, long uidNext) { @@ -666,7 +666,7 @@ class ImapFolderPusher extends ImapFolder { messages.add(message); } - pushReceiver.messagesArrived(ImapFolderPusher.this, messages); + pushReceiver.messagesArrived(getServerId(), messages); } private long getOldUidNext() {