Remove MessagingListener methods that are never used

This commit is contained in:
cketti 2017-01-26 22:33:42 +01:00
parent 93aaa85c14
commit 82f3c67ff0
6 changed files with 0 additions and 132 deletions

View file

@ -223,10 +223,6 @@ public class MessagingController {
if (K9.DEBUG) {
Log.i(K9.LOG_TAG, " Command '" + command.description + "' completed");
}
for (MessagingListener l : getListeners(command.listener)) {
l.controllerCommandCompleted(!queuedCommands.isEmpty());
}
}
} catch (Exception e) {
Log.e(K9.LOG_TAG, "Error running command '" + commandDescription + "'", e);
@ -544,24 +540,12 @@ public class MessagingController {
}
};
// alert everyone the search has started
if (listener != null) {
listener.listLocalMessagesStarted(account, null);
}
// build and do the query in the localstore
try {
LocalStore localStore = account.getLocalStore();
localStore.searchForMessages(retrievalListener, search);
} catch (Exception e) {
if (listener != null) {
listener.listLocalMessagesFailed(account, null, e.getMessage());
}
addErrorMessage(account, null, e);
} finally {
if (listener != null) {
listener.listLocalMessagesFinished(account, null);
}
}
}
@ -713,10 +697,6 @@ public class MessagingController {
localFolder.appendMessages(Collections.singletonList(message));
localMsg = localFolder.getMessage(message.getUid());
}
if (listener != null) {
listener.remoteSearchAddMessage(remoteFolder.getName(), localMsg, i, messages.size());
}
}
}
@ -1316,7 +1296,6 @@ public class MessagingController {
localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, message.isSet(Flag.X_DOWNLOADED_PARTIAL));
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
if (!localMessage.isSet(Flag.SEEN)) {
l.synchronizeMailboxNewMessage(account, folder, localMessage);
}
@ -1470,7 +1449,6 @@ public class MessagingController {
// Update the listener with what we've found
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
l.synchronizeMailboxProgress(account, folder, progress.get(), todo);
if (!localMessage.isSet(Flag.SEEN)) {
l.synchronizeMailboxNewMessage(account, folder, localMessage);
@ -1543,7 +1521,6 @@ public class MessagingController {
newMessages.incrementAndGet();
}
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
l.synchronizeMailboxProgress(account, folder, progress.get(), todo);
if (!localMessage.isSet(Flag.SEEN)) {
l.synchronizeMailboxNewMessage(account, folder, localMessage);
@ -1670,9 +1647,6 @@ public class MessagingController {
l.synchronizeMailboxRemovedMessage(account, folder, localMessage);
}
} else {
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
}
if (shouldNotifyForMessage(account, localFolder, localMessage)) {
shouldBeNotifiedOf = true;
}
@ -2194,9 +2168,6 @@ public class MessagingController {
for (Message message : messages) {
if (!message.isSet(Flag.SEEN)) {
message.setFlag(Flag.SEEN, true);
for (MessagingListener l : getListeners()) {
l.listLocalMessagesUpdateMessage(account, folder, message);
}
}
}

View file

@ -26,12 +26,7 @@ public interface MessagingListener {
void listFoldersFinished(Account account);
void listFoldersFailed(Account account, String message);
void listLocalMessagesStarted(Account account, String folder);
void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages);
void listLocalMessagesUpdateMessage(Account account, String folder, Message message);
void listLocalMessagesRemoveMessage(Account account, String folder, Message message);
void listLocalMessagesFinished(Account account, String folder);
void listLocalMessagesFailed(Account account, String folder, String message);
void synchronizeMailboxStarted(Account account, String folder);
void synchronizeMailboxHeadersStarted(Account account, String folder);
@ -40,7 +35,6 @@ public interface MessagingListener {
int numNewMessages);
void synchronizeMailboxProgress(Account account, String folder, int completed, int total);
void synchronizeMailboxNewMessage(Account account, String folder, Message message);
void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message);
void synchronizeMailboxRemovedMessage(Account account, String folder, Message message);
void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages);
void synchronizeMailboxFailed(Account account, String folder, String message);
@ -50,7 +44,6 @@ public interface MessagingListener {
void checkMailStarted(Context context, Account account);
void checkMailFinished(Context context, Account account);
void checkMailFailed(Context context, Account account, String reason);
void sendPendingMessagesStarted(Account account);
void sendPendingMessagesCompleted(Account account);
@ -76,20 +69,8 @@ public interface MessagingListener {
void remoteSearchStarted(String folder);
void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults);
void remoteSearchAddMessage(String folder, Message message, int numDone, int numTotal);
void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults);
void remoteSearchFailed(String folder, String err);
/**
* General notification messages subclasses can override to be notified that the controller
* has completed a command. This is useful for turning off progress indicators that may have
* been left over from previous commands.
*
* @param moreCommandsToRun
* {@code true} if the controller will continue on to another command immediately.
* {@code false} otherwise.
*/
void controllerCommandCompleted(boolean moreCommandsToRun);
void enableProgressIndicator(boolean enable);
}

View file

@ -44,30 +44,10 @@ public abstract class SimpleMessagingListener implements MessagingListener {
public void listFoldersFailed(Account account, String message) {
}
@Override
public void listLocalMessagesStarted(Account account, String folder) {
}
@Override
public void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages) {
}
@Override
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message) {
}
@Override
public void listLocalMessagesRemoveMessage(Account account, String folder, Message message) {
}
@Override
public void listLocalMessagesFinished(Account account, String folder) {
}
@Override
public void listLocalMessagesFailed(Account account, String folder, String message) {
}
@Override
public void synchronizeMailboxStarted(Account account, String folder) {
}
@ -93,10 +73,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
}
@Override
public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message) {
}
@Override
public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) {
}
@ -126,10 +102,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
public void checkMailFinished(Context context, Account account) {
}
@Override
public void checkMailFailed(Context context, Account account, String reason) {
}
@Override
public void sendPendingMessagesStarted(Account account) {
}
@ -198,10 +170,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
public void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults) {
}
@Override
public void remoteSearchAddMessage(String folder, Message message, int numDone, int numTotal) {
}
@Override
public void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults) {
}
@ -210,10 +178,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
public void remoteSearchFailed(String folder, String err) {
}
@Override
public void controllerCommandCompleted(boolean moreCommandsToRun) {
}
@Override
public void enableProgressIndicator(boolean enable) {
}

View file

@ -108,11 +108,6 @@ public class PollService extends CoreService {
accountsChecked.clear();
}
@Override
public void checkMailFailed(Context context, Account account, String reason) {
release();
}
@Override
public void synchronizeMailboxFinished(
Account account,

View file

@ -140,16 +140,6 @@ public class ActivityListenerTest {
assertEquals("", operation);
}
@Test
public void getOperation__whenSynchronizeMailboxAddOrUpdateMessage() {
activityListener.synchronizeMailboxStarted(account, FOLDER);
activityListener.synchronizeMailboxAddOrUpdateMessage(account, FOLDER, message);
String operation = activityListener.getOperation(context);
assertEquals("Poll account:folder", operation);
}
@Test
public void getOperation__whenSynchronizeMailboxNewMessage() {
activityListener.synchronizeMailboxStarted(account, FOLDER);

View file

@ -360,17 +360,6 @@ public class MessagingControllerTest {
verify(listener, never()).listFoldersFinished(account);
}
@Test
public void searchLocalMessagesSynchronous_shouldNotifyStartedListingLocalMessages()
throws Exception {
setAccountsInPreferences(Collections.singletonMap("1", account));
when(search.getAccountUuids()).thenReturn(new String[]{"allAccounts"});
controller.searchLocalMessagesSynchronous(search, listener);
verify(listener).listLocalMessagesStarted(account, null);
}
@Test
public void searchLocalMessagesSynchronous_shouldCallSearchForMessagesOnLocalStore()
throws Exception {
@ -382,18 +371,6 @@ public class MessagingControllerTest {
verify(localStore).searchForMessages(any(MessageRetrievalListener.class), eq(search));
}
@Test
public void searchLocalMessagesSynchronous_shouldNotifyFailureIfStoreThrowsException() throws Exception {
setAccountsInPreferences(Collections.singletonMap("1", account));
when(search.getAccountUuids()).thenReturn(new String[]{"allAccounts"});
when(localStore.searchForMessages(any(MessageRetrievalListener.class), eq(search)))
.thenThrow(new MessagingException("Test"));
controller.searchLocalMessagesSynchronous(search, listener);
verify(listener).listLocalMessagesFailed(account, null, "Test");
}
@Test
public void searchLocalMessagesSynchronous_shouldNotifyWhenStoreFinishesRetrievingAMessage()
throws Exception {
@ -522,16 +499,6 @@ public class MessagingControllerTest {
fetchProfileCaptor.capture(), Matchers.<MessageRetrievalListener>eq(null));
}
@Test
public void searchRemoteMessagesSynchronous_shouldNotifyListenerOfNewMessages() throws Exception {
setupRemoteSearch();
controller.searchRemoteMessagesSynchronous("1", FOLDER_NAME, "query", reqFlags, forbiddenFlags, listener);
verify(listener).remoteSearchAddMessage(FOLDER_NAME, localNewMessage1, 1, 2);
verify(listener).remoteSearchAddMessage(FOLDER_NAME, localNewMessage2, 2, 2);
}
@Test
public void searchRemoteMessagesSynchronous_shouldNotifyOnFailure() throws Exception {
setupRemoteSearch();