diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java index e3f7af1bc..1743a8128 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java @@ -418,14 +418,6 @@ public class MessagingController { // Collecting statistics of the search result MessageRetrievalListener retrievalListener = new MessageRetrievalListener() { - @Override - public void messageStarted(String message, int number, int ofTotal) { - } - - @Override - public void messagesFinished(int number) { - } - @Override public void messageFinished(LocalMessage message, int number, int ofTotal) { if (!isMessageSuppressed(message)) { diff --git a/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java b/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java index 773e2926e..8e187b76e 100644 --- a/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java +++ b/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java @@ -395,9 +395,9 @@ public class LocalStore { final String queryString, final String[] placeHolders ) throws MessagingException { final List messages = new ArrayList<>(); - final int j = database.execute(false, new DbCallback() { + database.execute(false, new DbCallback() { @Override - public Integer doDbWork(final SQLiteDatabase db) { + public Void doDbWork(final SQLiteDatabase db) { Cursor cursor = null; int i = 0; try { @@ -431,12 +431,10 @@ public class LocalStore { } finally { Utility.closeQuietly(cursor); } - return i; + + return null; } }); - if (listener != null) { - listener.messagesFinished(j); - } return Collections.unmodifiableList(messages); diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.kt index 05c40802d..744186002 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.kt @@ -509,9 +509,6 @@ internal class ImapSync( Timber.e(e, "Error while storing downloaded message.") } } - - override fun messageStarted(uid: String, number: Int, ofTotal: Int) = Unit - override fun messagesFinished(total: Int) = Unit }, syncConfig.maximumAutoDownloadMessageSize ) @@ -562,9 +559,6 @@ internal class ImapSync( Timber.e(e, "SYNC: fetch small messages") } } - - override fun messageStarted(uid: String, number: Int, ofTotal: Int) = Unit - override fun messagesFinished(total: Int) = Unit }, -1 ) diff --git a/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java b/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java index 84f501085..3c2b8f2e7 100644 --- a/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java +++ b/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java @@ -447,16 +447,6 @@ class Pop3Sync { Timber.e(e, "Error while storing downloaded message."); } } - - @Override - public void messageStarted(String uid, int number, int ofTotal) { - } - - @Override - public void messagesFinished(int total) { - // FIXME this method is almost never invoked by various Stores! Don't rely on it unless fixed!! - } - }, syncConfig.getMaximumAutoDownloadMessageSize()); } @@ -503,14 +493,6 @@ class Pop3Sync { Timber.e(e, "SYNC: fetch small messages"); } } - - @Override - public void messageStarted(String uid, int number, int ofTotal) { - } - - @Override - public void messagesFinished(int total) { - } }, -1); diff --git a/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java b/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java index 1b0c627e8..aa8863e4b 100644 --- a/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java +++ b/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java @@ -433,16 +433,6 @@ class WebDavSync { Timber.e(e, "Error while storing downloaded message."); } } - - @Override - public void messageStarted(String uid, int number, int ofTotal) { - } - - @Override - public void messagesFinished(int total) { - // FIXME this method is almost never invoked by various Stores! Don't rely on it unless fixed!! - } - }, syncConfig.getMaximumAutoDownloadMessageSize()); } @@ -488,14 +478,6 @@ class WebDavSync { Timber.e(e, "SYNC: fetch small messages"); } } - - @Override - public void messageStarted(String uid, int number, int ofTotal) { - } - - @Override - public void messagesFinished(int total) { - } }, -1); diff --git a/mail/common/src/main/java/com/fsck/k9/mail/MessageRetrievalListener.java b/mail/common/src/main/java/com/fsck/k9/mail/MessageRetrievalListener.java index 273898acc..df87da0ec 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/MessageRetrievalListener.java +++ b/mail/common/src/main/java/com/fsck/k9/mail/MessageRetrievalListener.java @@ -3,12 +3,5 @@ package com.fsck.k9.mail; public interface MessageRetrievalListener { - void messageStarted(String uid, int number, int ofTotal); - void messageFinished(T message, int number, int ofTotal); - - /** - * FIXME this method is almost never invoked by various Stores! Don't rely on it unless fixed!! - */ - void messagesFinished(int total); } diff --git a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/RealImapFolder.kt b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/RealImapFolder.kt index 959240f39..a7d186ba5 100644 --- a/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/RealImapFolder.kt +++ b/mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/RealImapFolder.kt @@ -505,7 +505,6 @@ internal class RealImapFolder( val count = uids.size return uids.mapIndexed { index, uidLong -> val uid = uidLong.toString() - listener?.messageStarted(uid, index, count) val message = ImapMessage(uid) listener?.messageFinished(message, index, count) @@ -596,8 +595,6 @@ internal class RealImapFolder( continue } - listener?.messageStarted(uid, messageNumber++, messageMap.size) - val literal = handleFetchResponse(message, fetchList) if (literal != null) { when (literal) { @@ -668,8 +665,6 @@ internal class RealImapFolder( continue } - listener?.messageStarted(uid, messageNumber++, 1) - val literal = handleFetchResponse(message, fetchList) if (literal != null) { when (literal) { diff --git a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapFolderTest.kt b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapFolderTest.kt index 96c7555e3..a762f8fc4 100644 --- a/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapFolderTest.kt +++ b/mail/protocols/imap/src/test/java/com/fsck/k9/mail/store/imap/RealImapFolderTest.kt @@ -475,7 +475,6 @@ class RealImapFolderTest { val messages = folder.getMessages(1, 10, null, listener) - verify(listener).messageStarted("99", 0, 1) verify(listener).messageFinished(messages[0], 0, 1) verifyNoMoreInteractions(listener) } @@ -563,7 +562,6 @@ class RealImapFolderTest { val messages = folder.getMessages(setOf(1L), true, listener) - verify(listener).messageStarted("99", 0, 1) verify(listener).messageFinished(messages[0], 0, 1) verifyNoMoreInteractions(listener) } diff --git a/mail/protocols/pop3/src/main/java/com/fsck/k9/mail/store/pop3/Pop3Folder.java b/mail/protocols/pop3/src/main/java/com/fsck/k9/mail/store/pop3/Pop3Folder.java index 260ce705c..3b0dfb2a7 100644 --- a/mail/protocols/pop3/src/main/java/com/fsck/k9/mail/store/pop3/Pop3Folder.java +++ b/mail/protocols/pop3/src/main/java/com/fsck/k9/mail/store/pop3/Pop3Folder.java @@ -133,9 +133,6 @@ public class Pop3Folder { continue; } - if (listener != null) { - listener.messageStarted(message.getUid(), i++, (end - start) + 1); - } messages.add(message); if (listener != null) { listener.messageFinished(message, i++, (end - start) + 1); @@ -320,9 +317,6 @@ public class Pop3Folder { for (int i = 0, count = messages.size(); i < count; i++) { Pop3Message pop3Message = messages.get(i); try { - if (listener != null && !fp.contains(FetchProfile.Item.ENVELOPE)) { - listener.messageStarted(pop3Message.getUid(), i, count); - } if (fp.contains(FetchProfile.Item.BODY)) { fetchBody(pop3Message, -1); } else if (fp.contains(FetchProfile.Item.BODY_SANE)) { @@ -369,9 +363,6 @@ public class Pop3Folder { */ for (int i = 0, count = messages.size(); i < count; i++) { Pop3Message message = messages.get(i); - if (listener != null) { - listener.messageStarted(message.getUid(), i, count); - } String response = connection.executeSimpleCommand( String.format(Locale.US, LIST_COMMAND + " %d", uidToMsgNumMap.get(message.getUid()))); @@ -400,9 +391,6 @@ public class Pop3Folder { int msgSize = Integer.parseInt(listParts[1]); Pop3Message pop3Message = msgNumToMsgMap.get(msgNum); if (pop3Message != null && msgUidIndex.contains(pop3Message.getUid())) { - if (listener != null) { - listener.messageStarted(pop3Message.getUid(), i, count); - } pop3Message.setSize(msgSize); if (listener != null) { listener.messageFinished(pop3Message, i, count); diff --git a/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java b/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java index ead75aaeb..98a79b8b7 100644 --- a/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java +++ b/mail/protocols/webdav/src/main/java/com/fsck/k9/mail/store/webdav/WebDavFolder.java @@ -235,9 +235,6 @@ public class WebDavFolder { uidsLength = uids.length; for (int i = 0; i < uidsLength; i++) { - if (listener != null) { - listener.messageStarted(uids[i], i, uidsLength); - } WebDavMessage message = new WebDavMessage(uids[i], this); message.setUrl(uidToUrl.get(uids[i])); messages.add(message); @@ -313,10 +310,6 @@ public class WebDavFolder { WebDavMessage wdMessage = messages.get(i); int statusCode = 0; - if (listener != null) { - listener.messageStarted(wdMessage.getUid(), i, count); - } - /** * If fetch is called outside of the initial list (ie, a locally stored message), it may not have a URL * associated. Verify and fix that @@ -514,9 +507,6 @@ public class WebDavFolder { int count = messages.size(); for (int i = messages.size() - 1; i >= 0; i--) { WebDavMessage message = messages.get(i); - if (listener != null) { - listener.messageStarted(messages.get(i).getUid(), i, count); - } ParsedMessageEnvelope envelope = envelopes.get(message.getUid()); if (envelope != null) { diff --git a/mail/protocols/webdav/src/test/java/com/fsck/k9/mail/store/webdav/WebDavFolderTest.java b/mail/protocols/webdav/src/test/java/com/fsck/k9/mail/store/webdav/WebDavFolderTest.java index 8fcf00a20..08082308b 100644 --- a/mail/protocols/webdav/src/test/java/com/fsck/k9/mail/store/webdav/WebDavFolderTest.java +++ b/mail/protocols/webdav/src/test/java/com/fsck/k9/mail/store/webdav/WebDavFolderTest.java @@ -221,7 +221,6 @@ public class WebDavFolderTest { FetchProfile profile = new FetchProfile(); profile.add(FetchProfile.Item.BODY_SANE); folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE); - verify(listener, times(25)).messageStarted(any(String.class), anyInt(), eq(25)); verify(listener, times(25)).messageFinished(any(WebDavMessage.class), anyInt(), eq(25)); } @@ -252,7 +251,6 @@ public class WebDavFolderTest { profile.add(FetchProfile.Item.FLAGS); profile.add(FetchProfile.Item.BODY); folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE); - verify(listener, times(25)).messageStarted(any(String.class), anyInt(), anyInt()); verify(listener, times(25)).messageFinished(any(WebDavMessage.class), anyInt(), anyInt()); } @@ -293,7 +291,6 @@ public class WebDavFolderTest { FetchProfile profile = new FetchProfile(); profile.add(FetchProfile.Item.BODY_SANE); folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE); - verify(listener, times(25)).messageStarted(any(String.class), anyInt(), eq(25)); verify(listener, times(25)).messageFinished(any(WebDavMessage.class), anyInt(), eq(25)); } @@ -324,7 +321,6 @@ public class WebDavFolderTest { FetchProfile profile = new FetchProfile(); profile.add(FetchProfile.Item.BODY_SANE); folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE); - verify(listener, times(25)).messageStarted(any(String.class), anyInt(), eq(25)); verify(listener, times(25)).messageFinished(any(WebDavMessage.class), anyInt(), eq(25)); } @@ -391,7 +387,6 @@ public class WebDavFolderTest { folder.getMessages(messageStart, messageEnd, listener); - verify(listener, times(5)).messageStarted(anyString(), anyInt(), eq(5)); verify(listener, times(5)).messageFinished(any(WebDavMessage.class), anyInt(), eq(5)); }