Remove unused MessagingListener callbacks for pending commands

This commit is contained in:
cketti 2020-01-21 15:58:36 +01:00
parent 79259b678c
commit 56151e7b7e
4 changed files with 0 additions and 97 deletions

View file

@ -31,7 +31,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
Memory syncStarted = null;
Memory sendStarted = null;
Memory processingStarted = null;
for (Memory memory : memories.values()) {
@ -76,17 +75,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
break;
}
}
if (memory.processingState != null) {
switch (memory.processingState) {
case STARTED:
processingStarted = memory;
break;
case FINISHED:
case FAILED:
other.pendingCommandsFinished(memory.account);
break;
}
}
}
Memory somethingStarted = null;
if (syncStarted != null) {
@ -98,17 +86,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
other.sendPendingMessagesStarted(sendStarted.account);
somethingStarted = sendStarted;
}
if (processingStarted != null) {
other.pendingCommandsProcessing(processingStarted.account);
if (processingStarted.processingCommandTitle != null) {
other.pendingCommandStarted(processingStarted.account,
processingStarted.processingCommandTitle);
} else {
other.pendingCommandCompleted(processingStarted.account, null);
}
somethingStarted = processingStarted;
}
if (somethingStarted != null && somethingStarted.folderTotal > 0) {
other.synchronizeMailboxProgress(somethingStarted.account, somethingStarted.folderServerId,
somethingStarted.folderCompleted, somethingStarted.folderTotal);
@ -180,33 +157,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
memory.folderTotal = total;
}
@Override
public synchronized void pendingCommandsProcessing(Account account) {
Memory memory = getMemory(account, null);
memory.processingState = MemorizingState.STARTED;
memory.folderCompleted = 0;
memory.folderTotal = 0;
}
@Override
public synchronized void pendingCommandsFinished(Account account) {
Memory memory = getMemory(account, null);
memory.processingState = MemorizingState.FINISHED;
}
@Override
public synchronized void pendingCommandStarted(Account account, String commandTitle) {
Memory memory = getMemory(account, null);
memory.processingCommandTitle = commandTitle;
}
@Override
public synchronized void pendingCommandCompleted(Account account, String commandTitle) {
Memory memory = getMemory(account, null);
memory.processingCommandTitle = null;
}
private Memory getMemory(Account account, String folderServerId) {
Memory memory = memories.get(getMemoryKey(account, folderServerId));
if (memory == null) {
@ -229,7 +179,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
MemorizingState syncingState = null;
MemorizingState sendingState = null;
MemorizingState pushingState = null;
MemorizingState processingState = null;
String failureMessage = null;
int syncingTotalMessagesInMailbox;
@ -237,7 +186,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
int folderCompleted = 0;
int folderTotal = 0;
String processingCommandTitle = null;
Memory(Account account, String folderServerId) {
this.account = account;

View file

@ -696,26 +696,12 @@ public class MessagingController {
LocalStore localStore = localStoreProvider.getInstance(account);
List<PendingCommand> commands = localStore.getPendingCommands();
int progress = 0;
int todo = commands.size();
if (todo == 0) {
return;
}
for (MessagingListener l : getListeners()) {
l.pendingCommandsProcessing(account);
l.synchronizeMailboxProgress(account, null, progress, todo);
}
PendingCommand processingCommand = null;
try {
for (PendingCommand command : commands) {
processingCommand = command;
Timber.d("Processing pending command '%s'", command);
for (MessagingListener l : getListeners()) {
l.pendingCommandStarted(account, command.getCommandName());
}
/*
* We specifically do not catch any exceptions here. If a command fails it is
* most likely due to a server or IO error and it must be retried before any
@ -734,22 +720,12 @@ public class MessagingController {
} else {
throw me;
}
} finally {
progress++;
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxProgress(account, null, progress, todo);
l.pendingCommandCompleted(account, command.getCommandName());
}
}
}
} catch (MessagingException me) {
notifyUserIfCertificateProblem(account, me, true);
Timber.e(me, "Could not process command '%s'", processingCommand);
throw me;
} finally {
for (MessagingListener l : getListeners()) {
l.pendingCommandsFinished(account);
}
}
}

View file

@ -52,11 +52,6 @@ public interface MessagingListener {
void loadAttachmentFinished(Account account, Message message, Part part);
void loadAttachmentFailed(Account account, Message message, Part part, String reason);
void pendingCommandStarted(Account account, String commandTitle);
void pendingCommandsProcessing(Account account);
void pendingCommandCompleted(Account account, String commandTitle);
void pendingCommandsFinished(Account account);
void remoteSearchStarted(String folder);
void remoteSearchServerQueryComplete(String folderServerId, int numResults, int maxResults);
void remoteSearchFinished(String folderServerId, int numResults, int maxResults, List<String> extraResults);

View file

@ -123,22 +123,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
public void loadAttachmentFailed(Account account, Message message, Part part, String reason) {
}
@Override
public void pendingCommandStarted(Account account, String commandTitle) {
}
@Override
public void pendingCommandsProcessing(Account account) {
}
@Override
public void pendingCommandCompleted(Account account, String commandTitle) {
}
@Override
public void pendingCommandsFinished(Account account) {
}
@Override
public void remoteSearchStarted(String folder) {
}