Remove LocalFolder-specific methods from Folder
This commit is contained in:
parent
61e0df5513
commit
ab1e5ce691
6 changed files with 13 additions and 52 deletions
|
@ -90,23 +90,6 @@ public abstract class Folder<T extends Message> {
|
|||
public abstract boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate)
|
||||
throws IOException, MessagingException;
|
||||
|
||||
/**
|
||||
* Fetches the given list of messages. The specified listener is notified as
|
||||
* each fetch completes. Messages are downloaded as (as) lightweight (as
|
||||
* possible) objects to be filled in with later requests. In most cases this
|
||||
* means that only the UID is downloaded.
|
||||
* @param listener Listener to notify as we download messages.
|
||||
* @return List of messages
|
||||
*/
|
||||
public abstract List<T> getMessages(MessageRetrievalListener<T> listener) throws MessagingException;
|
||||
|
||||
public List<T> getMessages(MessageRetrievalListener<T> listener, boolean includeDeleted) throws MessagingException {
|
||||
return getMessages(listener);
|
||||
}
|
||||
|
||||
public abstract List<T> getMessages(String[] uids, MessageRetrievalListener<T> listener)
|
||||
throws MessagingException;
|
||||
|
||||
public abstract Map<String, String> appendMessages(List<? extends Message> messages) throws MessagingException;
|
||||
|
||||
public Map<String, String> copyMessages(List<? extends Message> msgs, Folder folder) throws MessagingException {
|
||||
|
|
|
@ -645,13 +645,11 @@ class ImapFolder extends Folder<ImapMessage> {
|
|||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImapMessage> getMessages(MessageRetrievalListener<ImapMessage> listener) throws MessagingException {
|
||||
List<ImapMessage> getMessages(MessageRetrievalListener<ImapMessage> listener) throws MessagingException {
|
||||
return getMessages(null, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImapMessage> getMessages(String[] uids, MessageRetrievalListener<ImapMessage> listener)
|
||||
private List<ImapMessage> getMessages(String[] uids, MessageRetrievalListener<ImapMessage> listener)
|
||||
throws MessagingException {
|
||||
checkOpen();
|
||||
|
||||
|
|
|
@ -761,17 +761,6 @@ public class Pop3Store extends RemoteStore {
|
|||
mUidToMsgNumMap.put(message.getUid(), msgNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pop3Message> getMessages(MessageRetrievalListener listener) throws MessagingException {
|
||||
throw new UnsupportedOperationException("Pop3: No getMessages");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pop3Message> getMessages(String[] uids, MessageRetrievalListener listener)
|
||||
throws MessagingException {
|
||||
throw new UnsupportedOperationException("Pop3: No getMessages by uids");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the items contained in the FetchProfile into the given set of
|
||||
* Messages in as efficient a manner as possible.
|
||||
|
|
|
@ -1456,13 +1456,7 @@ public class WebDavStore extends RemoteStore {
|
|||
return indexOfOldestMessage > 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WebDavMessage> getMessages(MessageRetrievalListener<WebDavMessage> listener) throws MessagingException {
|
||||
return getMessages(null, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WebDavMessage> getMessages(String[] uids, MessageRetrievalListener<WebDavMessage> listener) throws MessagingException {
|
||||
private List<WebDavMessage> getMessages(String[] uids, MessageRetrievalListener<WebDavMessage> listener) throws MessagingException {
|
||||
List<WebDavMessage> messageList = new ArrayList<WebDavMessage>();
|
||||
|
||||
if (uids == null ||
|
||||
|
|
|
@ -3037,11 +3037,11 @@ public class MessagingController implements Runnable {
|
|||
* @param account
|
||||
*/
|
||||
public void sendPendingMessagesSynchronous(final Account account) {
|
||||
Folder localFolder = null;
|
||||
LocalFolder localFolder = null;
|
||||
Exception lastFailure = null;
|
||||
boolean wasPermanentFailure = false;
|
||||
try {
|
||||
Store localStore = account.getLocalStore();
|
||||
LocalStore localStore = account.getLocalStore();
|
||||
localFolder = localStore.getFolder(
|
||||
account.getOutboxFolderName());
|
||||
if (!localFolder.exists()) {
|
||||
|
@ -3052,7 +3052,7 @@ public class MessagingController implements Runnable {
|
|||
}
|
||||
localFolder.open(Folder.OPEN_MODE_RW);
|
||||
|
||||
List<? extends Message> localMessages = localFolder.getMessages(null);
|
||||
List<LocalMessage> localMessages = localFolder.getMessages(null);
|
||||
int progress = 0;
|
||||
int todo = localMessages.size();
|
||||
for (MessagingListener l : getListeners()) {
|
||||
|
@ -3067,10 +3067,10 @@ public class MessagingController implements Runnable {
|
|||
fp.add(FetchProfile.Item.BODY);
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Scanning folder '" + account.getOutboxFolderName() + "' (" + ((LocalFolder)localFolder).getId() + ") for messages to send");
|
||||
Log.i(K9.LOG_TAG, "Scanning folder '" + account.getOutboxFolderName() + "' (" + localFolder.getId() + ") for messages to send");
|
||||
|
||||
Transport transport = Transport.getInstance(K9.app, account);
|
||||
for (Message message : localMessages) {
|
||||
for (LocalMessage message : localMessages) {
|
||||
if (message.isSet(Flag.DELETED)) {
|
||||
message.destroy();
|
||||
continue;
|
||||
|
@ -3121,7 +3121,7 @@ public class MessagingController implements Runnable {
|
|||
Log.i(K9.LOG_TAG, "Account does not have a sent mail folder; deleting sent message");
|
||||
message.setFlag(Flag.DELETED, true);
|
||||
} else {
|
||||
LocalFolder localSentFolder = (LocalFolder) localStore.getFolder(account.getSentFolderName());
|
||||
LocalFolder localSentFolder = localStore.getFolder(account.getSentFolderName());
|
||||
if (K9.DEBUG)
|
||||
Log.i(K9.LOG_TAG, "Moving sent message to folder '" + account.getSentFolderName() + "' (" + localSentFolder.getId() + ") ");
|
||||
|
||||
|
@ -3450,7 +3450,7 @@ public class MessagingController implements Runnable {
|
|||
|
||||
try {
|
||||
Map<String, String> uidMap = new HashMap<String, String>();
|
||||
Store localStore = account.getLocalStore();
|
||||
LocalStore localStore = account.getLocalStore();
|
||||
Store remoteStore = account.getRemoteStore();
|
||||
if (!isCopy && (!remoteStore.isMoveCapable() || !localStore.isMoveCapable())) {
|
||||
return;
|
||||
|
@ -3459,7 +3459,7 @@ public class MessagingController implements Runnable {
|
|||
return;
|
||||
}
|
||||
|
||||
Folder localSrcFolder = localStore.getFolder(srcFolder);
|
||||
LocalFolder localSrcFolder = localStore.getFolder(srcFolder);
|
||||
Folder localDestFolder = localStore.getFolder(destFolder);
|
||||
|
||||
boolean unreadCountAffected = false;
|
||||
|
@ -3475,7 +3475,7 @@ public class MessagingController implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
List<? extends Message> messages = localSrcFolder.getMessages(uids.toArray(EMPTY_STRING_ARRAY), null);
|
||||
List<LocalMessage> messages = localSrcFolder.getMessages(uids.toArray(EMPTY_STRING_ARRAY), null);
|
||||
if (messages.size() > 0) {
|
||||
Map<String, Message> origUidMap = new HashMap<String, Message>();
|
||||
|
||||
|
|
|
@ -872,12 +872,10 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalMessage> getMessages(MessageRetrievalListener<LocalMessage> listener) throws MessagingException {
|
||||
return getMessages(listener, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalMessage> getMessages(final MessageRetrievalListener<LocalMessage> listener,
|
||||
final boolean includeDeleted) throws MessagingException {
|
||||
try {
|
||||
|
@ -904,9 +902,8 @@ public class LocalFolder extends Folder<LocalMessage> implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalMessage> getMessages(String[] uids, MessageRetrievalListener<LocalMessage> listener)
|
||||
throws MessagingException {
|
||||
throws MessagingException {
|
||||
open(OPEN_MODE_RW);
|
||||
if (uids == null) {
|
||||
return getMessages(listener);
|
||||
|
|
Loading…
Reference in a new issue