Remove local folder handling from Backend implementations

This commit is contained in:
cketti 2020-02-04 19:27:50 +01:00
parent b233104622
commit 2a760ef4bb
9 changed files with 8 additions and 33 deletions

View file

@ -36,9 +36,4 @@ interface BackendFolder {
FALSE,
TRUE
}
companion object {
// TODO: Change the interface to be able to hide this (ugly) implementation detail.
const val LOCAL_UID_PREFIX = "K9LOCAL:"
}
}

View file

@ -6,7 +6,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fsck.k9.backend.api.BackendFolder;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.store.imap.ImapFolder;
@ -44,10 +43,7 @@ class CommandMoveOrCopyMessages {
List<Message> messages = new ArrayList<>();
for (String uid : uids) {
// TODO: Local messages should never end up here. Throw in debug builds.
if (!uid.startsWith(BackendFolder.LOCAL_UID_PREFIX)) {
messages.add(remoteSrcFolder.getMessage(uid));
}
messages.add(remoteSrcFolder.getMessage(uid));
}
if (messages.isEmpty()) {

View file

@ -5,7 +5,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.fsck.k9.backend.api.BackendFolder;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
@ -37,9 +36,7 @@ class CommandSetFlag {
}
List<Message> messages = new ArrayList<>();
for (String uid : messageServerIds) {
if (!uid.startsWith(BackendFolder.LOCAL_UID_PREFIX)) {
messages.add(remoteFolder.getMessage(uid));
}
messages.add(remoteFolder.getMessage(uid));
}
if (messages.isEmpty()) {

View file

@ -172,8 +172,7 @@ class ImapSync {
if (syncConfig.getSyncRemoteDeletions()) {
List<String> destroyMessageUids = new ArrayList<>();
for (String localMessageUid : localUidMap.keySet()) {
if (!localMessageUid.startsWith(BackendFolder.LOCAL_UID_PREFIX) &&
remoteUidMap.get(localMessageUid) == null) {
if (remoteUidMap.get(localMessageUid) == null) {
destroyMessageUids.add(localMessageUid);
}
}

View file

@ -5,7 +5,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.fsck.k9.backend.api.BackendFolder;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
@ -34,9 +33,7 @@ class CommandSetFlag {
remoteFolder.open();
List<Message> messages = new ArrayList<>();
for (String uid : messageServerIds) {
if (!uid.startsWith(BackendFolder.LOCAL_UID_PREFIX)) {
messages.add(remoteFolder.getMessage(uid));
}
messages.add(remoteFolder.getMessage(uid));
}
if (messages.isEmpty()) {

View file

@ -162,8 +162,7 @@ class Pop3Sync {
if (syncConfig.getSyncRemoteDeletions()) {
List<String> destroyMessageUids = new ArrayList<>();
for (String localMessageUid : localUidMap.keySet()) {
if (!localMessageUid.startsWith(BackendFolder.LOCAL_UID_PREFIX) &&
remoteUidMap.get(localMessageUid) == null) {
if (remoteUidMap.get(localMessageUid) == null) {
destroyMessageUids.add(localMessageUid);
}
}

View file

@ -6,7 +6,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.fsck.k9.backend.api.BackendFolder;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.store.webdav.WebDavFolder;
@ -44,10 +43,7 @@ class CommandMoveOrCopyMessages {
List<Message> messages = new ArrayList<>();
for (String uid : uids) {
// TODO: Local messages should never end up here. Throw in debug builds.
if (!uid.startsWith(BackendFolder.LOCAL_UID_PREFIX)) {
messages.add(remoteSrcFolder.getMessage(uid));
}
messages.add(remoteSrcFolder.getMessage(uid));
}
if (messages.isEmpty()) {

View file

@ -5,7 +5,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.fsck.k9.backend.api.BackendFolder;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
@ -31,9 +30,7 @@ class CommandSetFlag {
List<Message> messages = new ArrayList<>();
for (String uid : messageServerIds) {
if (!uid.startsWith(BackendFolder.LOCAL_UID_PREFIX)) {
messages.add(remoteFolder.getMessage(uid));
}
messages.add(remoteFolder.getMessage(uid));
}
if (messages.isEmpty()) {

View file

@ -163,8 +163,7 @@ class WebDavSync {
if (syncConfig.getSyncRemoteDeletions()) {
List<String> destroyMessageUids = new ArrayList<>();
for (String localMessageUid : localUidMap.keySet()) {
if (!localMessageUid.startsWith(BackendFolder.LOCAL_UID_PREFIX) &&
remoteUidMap.get(localMessageUid) == null) {
if (remoteUidMap.get(localMessageUid) == null) {
destroyMessageUids.add(localMessageUid);
}
}