use of com.fsck.k9.mailstore.LocalFolder in project k-9 by k9mail.
the class MessagingController method processPendingDelete.
void processPendingDelete(PendingDelete command, Account account) throws MessagingException {
long folderId = command.folderId;
List<String> uids = command.uids;
Backend backend = getBackend(account);
String folderServerId = getFolderServerId(account, folderId);
backend.deleteMessages(folderServerId, uids);
if (backend.getSupportsExpunge() && account.getExpungePolicy() == Expunge.EXPUNGE_IMMEDIATELY) {
backend.expungeMessages(folderServerId, uids);
}
LocalStore localStore = localStoreProvider.getInstance(account);
LocalFolder localFolder = localStore.getFolder(folderId);
localFolder.open();
destroyPlaceholderMessages(localFolder, uids);
}
use of com.fsck.k9.mailstore.LocalFolder in project k-9 by k9mail.
the class MessagingController method updateFolderStatus.
private void updateFolderStatus(Account account, String folderServerId, String status) {
try {
LocalStore localStore = localStoreProvider.getInstance(account);
LocalFolder localFolder = localStore.getFolder(folderServerId);
localFolder.setStatus(status);
} catch (MessagingException e) {
Timber.w(e, "Couldn't update folder status for folder %s", folderServerId);
}
}
use of com.fsck.k9.mailstore.LocalFolder in project k-9 by k9mail.
the class MessagingController method processPendingEmptyTrash.
void processPendingEmptyTrash(Account account) throws MessagingException {
if (!account.hasTrashFolder()) {
return;
}
long trashFolderId = account.getTrashFolderId();
LocalStore localStore = localStoreProvider.getInstance(account);
LocalFolder folder = localStore.getFolder(trashFolderId);
folder.open();
String trashFolderServerId = folder.getServerId();
Backend backend = getBackend(account);
backend.deleteAllMessages(trashFolderServerId);
if (account.getExpungePolicy() == Expunge.EXPUNGE_IMMEDIATELY && backend.getSupportsExpunge()) {
backend.expunge(trashFolderServerId);
}
// Remove all messages marked as deleted
folder.destroyDeletedMessages();
compact(account, null);
}
use of com.fsck.k9.mailstore.LocalFolder in project k-9 by k9mail.
the class MessagingController method loadMoreMessages.
public void loadMoreMessages(Account account, long folderId, MessagingListener listener) {
try {
LocalStore localStore = localStoreProvider.getInstance(account);
LocalFolder localFolder = localStore.getFolder(folderId);
if (localFolder.getVisibleLimit() > 0) {
localFolder.setVisibleLimit(localFolder.getVisibleLimit() + account.getDisplayCount());
}
synchronizeMailbox(account, folderId, false, listener);
} catch (MessagingException me) {
throw new RuntimeException("Unable to set visible limit on folder", me);
}
}
use of com.fsck.k9.mailstore.LocalFolder in project k-9 by k9mail.
the class MessagingController method loadSearchResults.
public void loadSearchResults(Account account, long folderId, List<String> messageServerIds, MessagingListener listener) {
threadPool.execute(() -> {
if (listener != null) {
listener.enableProgressIndicator(true);
}
try {
LocalStore localStore = localStoreProvider.getInstance(account);
LocalFolder localFolder = localStore.getFolder(folderId);
if (!localFolder.exists()) {
throw new MessagingException("Folder not found");
}
localFolder.open();
loadSearchResultsSynchronous(account, messageServerIds, localFolder);
} catch (MessagingException e) {
Timber.e(e, "Exception in loadSearchResults");
} finally {
if (listener != null) {
listener.enableProgressIndicator(false);
}
}
});
}
Aggregations