Remove unused callbacks from MessageRetrievalListener
This commit is contained in:
parent
065f98cfdd
commit
e59f57f602
11 changed files with 4 additions and 97 deletions
|
@ -418,14 +418,6 @@ public class MessagingController {
|
||||||
|
|
||||||
// Collecting statistics of the search result
|
// Collecting statistics of the search result
|
||||||
MessageRetrievalListener<LocalMessage> retrievalListener = new MessageRetrievalListener<LocalMessage>() {
|
MessageRetrievalListener<LocalMessage> retrievalListener = new MessageRetrievalListener<LocalMessage>() {
|
||||||
@Override
|
|
||||||
public void messageStarted(String message, int number, int ofTotal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messagesFinished(int number) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageFinished(LocalMessage message, int number, int ofTotal) {
|
public void messageFinished(LocalMessage message, int number, int ofTotal) {
|
||||||
if (!isMessageSuppressed(message)) {
|
if (!isMessageSuppressed(message)) {
|
||||||
|
|
|
@ -395,9 +395,9 @@ public class LocalStore {
|
||||||
final String queryString, final String[] placeHolders
|
final String queryString, final String[] placeHolders
|
||||||
) throws MessagingException {
|
) throws MessagingException {
|
||||||
final List<LocalMessage> messages = new ArrayList<>();
|
final List<LocalMessage> messages = new ArrayList<>();
|
||||||
final int j = database.execute(false, new DbCallback<Integer>() {
|
database.execute(false, new DbCallback<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer doDbWork(final SQLiteDatabase db) {
|
public Void doDbWork(final SQLiteDatabase db) {
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
try {
|
try {
|
||||||
|
@ -431,12 +431,10 @@ public class LocalStore {
|
||||||
} finally {
|
} finally {
|
||||||
Utility.closeQuietly(cursor);
|
Utility.closeQuietly(cursor);
|
||||||
}
|
}
|
||||||
return i;
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (listener != null) {
|
|
||||||
listener.messagesFinished(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Collections.unmodifiableList(messages);
|
return Collections.unmodifiableList(messages);
|
||||||
|
|
||||||
|
|
|
@ -509,9 +509,6 @@ internal class ImapSync(
|
||||||
Timber.e(e, "Error while storing downloaded message.")
|
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
|
syncConfig.maximumAutoDownloadMessageSize
|
||||||
)
|
)
|
||||||
|
@ -562,9 +559,6 @@ internal class ImapSync(
|
||||||
Timber.e(e, "SYNC: fetch small messages")
|
Timber.e(e, "SYNC: fetch small messages")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun messageStarted(uid: String, number: Int, ofTotal: Int) = Unit
|
|
||||||
override fun messagesFinished(total: Int) = Unit
|
|
||||||
},
|
},
|
||||||
-1
|
-1
|
||||||
)
|
)
|
||||||
|
|
|
@ -447,16 +447,6 @@ class Pop3Sync {
|
||||||
Timber.e(e, "Error while storing downloaded message.");
|
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());
|
syncConfig.getMaximumAutoDownloadMessageSize());
|
||||||
}
|
}
|
||||||
|
@ -503,14 +493,6 @@ class Pop3Sync {
|
||||||
Timber.e(e, "SYNC: fetch small messages");
|
Timber.e(e, "SYNC: fetch small messages");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messageStarted(String uid, int number, int ofTotal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messagesFinished(int total) {
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
|
|
@ -433,16 +433,6 @@ class WebDavSync {
|
||||||
Timber.e(e, "Error while storing downloaded message.");
|
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());
|
syncConfig.getMaximumAutoDownloadMessageSize());
|
||||||
}
|
}
|
||||||
|
@ -488,14 +478,6 @@ class WebDavSync {
|
||||||
Timber.e(e, "SYNC: fetch small messages");
|
Timber.e(e, "SYNC: fetch small messages");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messageStarted(String uid, int number, int ofTotal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messagesFinished(int total) {
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,5 @@ package com.fsck.k9.mail;
|
||||||
|
|
||||||
|
|
||||||
public interface MessageRetrievalListener<T extends Message> {
|
public interface MessageRetrievalListener<T extends Message> {
|
||||||
void messageStarted(String uid, int number, int ofTotal);
|
|
||||||
|
|
||||||
void messageFinished(T message, int number, int ofTotal);
|
void messageFinished(T message, int number, int ofTotal);
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME <strong>this method is almost never invoked by various Stores! Don't rely on it unless fixed!!</strong>
|
|
||||||
*/
|
|
||||||
void messagesFinished(int total);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,7 +505,6 @@ internal class RealImapFolder(
|
||||||
val count = uids.size
|
val count = uids.size
|
||||||
return uids.mapIndexed { index, uidLong ->
|
return uids.mapIndexed { index, uidLong ->
|
||||||
val uid = uidLong.toString()
|
val uid = uidLong.toString()
|
||||||
listener?.messageStarted(uid, index, count)
|
|
||||||
val message = ImapMessage(uid)
|
val message = ImapMessage(uid)
|
||||||
listener?.messageFinished(message, index, count)
|
listener?.messageFinished(message, index, count)
|
||||||
|
|
||||||
|
@ -596,8 +595,6 @@ internal class RealImapFolder(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
listener?.messageStarted(uid, messageNumber++, messageMap.size)
|
|
||||||
|
|
||||||
val literal = handleFetchResponse(message, fetchList)
|
val literal = handleFetchResponse(message, fetchList)
|
||||||
if (literal != null) {
|
if (literal != null) {
|
||||||
when (literal) {
|
when (literal) {
|
||||||
|
@ -668,8 +665,6 @@ internal class RealImapFolder(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
listener?.messageStarted(uid, messageNumber++, 1)
|
|
||||||
|
|
||||||
val literal = handleFetchResponse(message, fetchList)
|
val literal = handleFetchResponse(message, fetchList)
|
||||||
if (literal != null) {
|
if (literal != null) {
|
||||||
when (literal) {
|
when (literal) {
|
||||||
|
|
|
@ -475,7 +475,6 @@ class RealImapFolderTest {
|
||||||
|
|
||||||
val messages = folder.getMessages(1, 10, null, listener)
|
val messages = folder.getMessages(1, 10, null, listener)
|
||||||
|
|
||||||
verify(listener).messageStarted("99", 0, 1)
|
|
||||||
verify(listener).messageFinished(messages[0], 0, 1)
|
verify(listener).messageFinished(messages[0], 0, 1)
|
||||||
verifyNoMoreInteractions(listener)
|
verifyNoMoreInteractions(listener)
|
||||||
}
|
}
|
||||||
|
@ -563,7 +562,6 @@ class RealImapFolderTest {
|
||||||
|
|
||||||
val messages = folder.getMessages(setOf(1L), true, listener)
|
val messages = folder.getMessages(setOf(1L), true, listener)
|
||||||
|
|
||||||
verify(listener).messageStarted("99", 0, 1)
|
|
||||||
verify(listener).messageFinished(messages[0], 0, 1)
|
verify(listener).messageFinished(messages[0], 0, 1)
|
||||||
verifyNoMoreInteractions(listener)
|
verifyNoMoreInteractions(listener)
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,9 +133,6 @@ public class Pop3Folder {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener != null) {
|
|
||||||
listener.messageStarted(message.getUid(), i++, (end - start) + 1);
|
|
||||||
}
|
|
||||||
messages.add(message);
|
messages.add(message);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.messageFinished(message, i++, (end - start) + 1);
|
listener.messageFinished(message, i++, (end - start) + 1);
|
||||||
|
@ -320,9 +317,6 @@ public class Pop3Folder {
|
||||||
for (int i = 0, count = messages.size(); i < count; i++) {
|
for (int i = 0, count = messages.size(); i < count; i++) {
|
||||||
Pop3Message pop3Message = messages.get(i);
|
Pop3Message pop3Message = messages.get(i);
|
||||||
try {
|
try {
|
||||||
if (listener != null && !fp.contains(FetchProfile.Item.ENVELOPE)) {
|
|
||||||
listener.messageStarted(pop3Message.getUid(), i, count);
|
|
||||||
}
|
|
||||||
if (fp.contains(FetchProfile.Item.BODY)) {
|
if (fp.contains(FetchProfile.Item.BODY)) {
|
||||||
fetchBody(pop3Message, -1);
|
fetchBody(pop3Message, -1);
|
||||||
} else if (fp.contains(FetchProfile.Item.BODY_SANE)) {
|
} 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++) {
|
for (int i = 0, count = messages.size(); i < count; i++) {
|
||||||
Pop3Message message = messages.get(i);
|
Pop3Message message = messages.get(i);
|
||||||
if (listener != null) {
|
|
||||||
listener.messageStarted(message.getUid(), i, count);
|
|
||||||
}
|
|
||||||
String response = connection.executeSimpleCommand(
|
String response = connection.executeSimpleCommand(
|
||||||
String.format(Locale.US, LIST_COMMAND + " %d",
|
String.format(Locale.US, LIST_COMMAND + " %d",
|
||||||
uidToMsgNumMap.get(message.getUid())));
|
uidToMsgNumMap.get(message.getUid())));
|
||||||
|
@ -400,9 +391,6 @@ public class Pop3Folder {
|
||||||
int msgSize = Integer.parseInt(listParts[1]);
|
int msgSize = Integer.parseInt(listParts[1]);
|
||||||
Pop3Message pop3Message = msgNumToMsgMap.get(msgNum);
|
Pop3Message pop3Message = msgNumToMsgMap.get(msgNum);
|
||||||
if (pop3Message != null && msgUidIndex.contains(pop3Message.getUid())) {
|
if (pop3Message != null && msgUidIndex.contains(pop3Message.getUid())) {
|
||||||
if (listener != null) {
|
|
||||||
listener.messageStarted(pop3Message.getUid(), i, count);
|
|
||||||
}
|
|
||||||
pop3Message.setSize(msgSize);
|
pop3Message.setSize(msgSize);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.messageFinished(pop3Message, i, count);
|
listener.messageFinished(pop3Message, i, count);
|
||||||
|
|
|
@ -235,9 +235,6 @@ public class WebDavFolder {
|
||||||
uidsLength = uids.length;
|
uidsLength = uids.length;
|
||||||
|
|
||||||
for (int i = 0; i < uidsLength; i++) {
|
for (int i = 0; i < uidsLength; i++) {
|
||||||
if (listener != null) {
|
|
||||||
listener.messageStarted(uids[i], i, uidsLength);
|
|
||||||
}
|
|
||||||
WebDavMessage message = new WebDavMessage(uids[i], this);
|
WebDavMessage message = new WebDavMessage(uids[i], this);
|
||||||
message.setUrl(uidToUrl.get(uids[i]));
|
message.setUrl(uidToUrl.get(uids[i]));
|
||||||
messages.add(message);
|
messages.add(message);
|
||||||
|
@ -313,10 +310,6 @@ public class WebDavFolder {
|
||||||
WebDavMessage wdMessage = messages.get(i);
|
WebDavMessage wdMessage = messages.get(i);
|
||||||
int statusCode = 0;
|
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
|
* 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
|
* associated. Verify and fix that
|
||||||
|
@ -514,9 +507,6 @@ public class WebDavFolder {
|
||||||
int count = messages.size();
|
int count = messages.size();
|
||||||
for (int i = messages.size() - 1; i >= 0; i--) {
|
for (int i = messages.size() - 1; i >= 0; i--) {
|
||||||
WebDavMessage message = messages.get(i);
|
WebDavMessage message = messages.get(i);
|
||||||
if (listener != null) {
|
|
||||||
listener.messageStarted(messages.get(i).getUid(), i, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
ParsedMessageEnvelope envelope = envelopes.get(message.getUid());
|
ParsedMessageEnvelope envelope = envelopes.get(message.getUid());
|
||||||
if (envelope != null) {
|
if (envelope != null) {
|
||||||
|
|
|
@ -221,7 +221,6 @@ public class WebDavFolderTest {
|
||||||
FetchProfile profile = new FetchProfile();
|
FetchProfile profile = new FetchProfile();
|
||||||
profile.add(FetchProfile.Item.BODY_SANE);
|
profile.add(FetchProfile.Item.BODY_SANE);
|
||||||
folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE);
|
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));
|
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.FLAGS);
|
||||||
profile.add(FetchProfile.Item.BODY);
|
profile.add(FetchProfile.Item.BODY);
|
||||||
folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE);
|
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());
|
verify(listener, times(25)).messageFinished(any(WebDavMessage.class), anyInt(), anyInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +291,6 @@ public class WebDavFolderTest {
|
||||||
FetchProfile profile = new FetchProfile();
|
FetchProfile profile = new FetchProfile();
|
||||||
profile.add(FetchProfile.Item.BODY_SANE);
|
profile.add(FetchProfile.Item.BODY_SANE);
|
||||||
folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE);
|
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));
|
verify(listener, times(25)).messageFinished(any(WebDavMessage.class), anyInt(), eq(25));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +321,6 @@ public class WebDavFolderTest {
|
||||||
FetchProfile profile = new FetchProfile();
|
FetchProfile profile = new FetchProfile();
|
||||||
profile.add(FetchProfile.Item.BODY_SANE);
|
profile.add(FetchProfile.Item.BODY_SANE);
|
||||||
folder.fetch(messages, profile, listener, MAX_DOWNLOAD_SIZE);
|
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));
|
verify(listener, times(25)).messageFinished(any(WebDavMessage.class), anyInt(), eq(25));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +387,6 @@ public class WebDavFolderTest {
|
||||||
|
|
||||||
folder.getMessages(messageStart, messageEnd, listener);
|
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));
|
verify(listener, times(5)).messageFinished(any(WebDavMessage.class), anyInt(), eq(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue