Remove unused code
This commit is contained in:
parent
34c20ce317
commit
3ccabbf95f
11 changed files with 0 additions and 164 deletions
|
@ -99,13 +99,6 @@ public abstract class Folder<T extends Message> {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void delete(List<? extends Message> msgs, String trashFolder) throws MessagingException {
|
||||
for (Message message : msgs) {
|
||||
Message myMessage = getMessage(message.getUid());
|
||||
myMessage.delete(trashFolder);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void setFlags(List<? extends Message> messages, Set<Flag> flags, boolean value)
|
||||
throws MessagingException;
|
||||
|
||||
|
|
|
@ -137,8 +137,6 @@ public abstract class Message implements Part, Body {
|
|||
|
||||
public abstract long getSize();
|
||||
|
||||
public void delete(String trashFolder) throws MessagingException {}
|
||||
|
||||
/*
|
||||
* TODO Refactor Flags at some point to be able to store user defined flags.
|
||||
*/
|
||||
|
|
|
@ -390,36 +390,6 @@ public class ImapFolder extends Folder<ImapMessage> {
|
|||
return uidMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<? extends Message> messages, String trashFolder) throws MessagingException {
|
||||
if (messages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (trashFolder == null || getServerId().equals(trashFolder)) {
|
||||
setFlags(messages, Collections.singleton(Flag.DELETED), true);
|
||||
} else {
|
||||
ImapFolder remoteTrashFolder = getStore().getFolder(trashFolder);
|
||||
String encodedTrashFolderName = folderNameCodec.encode(remoteTrashFolder.getPrefixedName());
|
||||
String escapedTrashFolderName = ImapUtility.encodeString(encodedTrashFolderName);
|
||||
|
||||
if (!exists(escapedTrashFolderName)) {
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.i("ImapFolder.delete: couldn't find remote trash folder '%s' for %s",
|
||||
trashFolder, getLogId());
|
||||
}
|
||||
throw new FolderNotFoundException(remoteTrashFolder.getServerId());
|
||||
}
|
||||
|
||||
if (K9MailLib.isDebug()) {
|
||||
Timber.d("IMAPMessage.delete: copying remote %d messages to '%s' for %s",
|
||||
messages.size(), trashFolder, getLogId());
|
||||
}
|
||||
|
||||
moveMessages(messages, remoteTrashFolder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMessageCount() {
|
||||
return messageCount;
|
||||
|
|
|
@ -28,9 +28,4 @@ public class ImapMessage extends MimeMessage {
|
|||
super.setFlag(flag, set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String trashFolder) throws MessagingException {
|
||||
getFolder().delete(Collections.singletonList(this), trashFolder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,66 +379,6 @@ public class ImapFolderTest {
|
|||
assertNull(uidMapping);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete_withEmptyMessageList_shouldNotInteractWithImapConnection() throws Exception {
|
||||
ImapFolder folder = createFolder("Source");
|
||||
List<ImapMessage> messages = Collections.emptyList();
|
||||
|
||||
folder.delete(messages, "Trash");
|
||||
|
||||
verifyNoMoreInteractions(imapConnection);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete_fromTrashFolder_shouldIssueUidStoreFlagsCommand() throws Exception {
|
||||
ImapFolder folder = createFolder("Folder");
|
||||
prepareImapFolderForOpen(OPEN_MODE_RW);
|
||||
List<ImapMessage> messages = singletonList(createImapMessage("23"));
|
||||
folder.open(OPEN_MODE_RW);
|
||||
|
||||
folder.delete(messages, "Folder");
|
||||
|
||||
assertCommandWithIdsIssued("UID STORE 23 +FLAGS.SILENT (\\Deleted)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete_shouldMoveMessagesToTrashFolder() throws Exception {
|
||||
ImapFolder folder = createFolder("Folder");
|
||||
prepareImapFolderForOpen(OPEN_MODE_RW);
|
||||
ImapFolder trashFolder = createFolder("Trash");
|
||||
when(imapStore.getFolder("Trash")).thenReturn(trashFolder);
|
||||
List<ImapMessage> messages = singletonList(createImapMessage("2"));
|
||||
setupCopyResponse("x OK [COPYUID 23 2 102] Success");
|
||||
folder.open(OPEN_MODE_RW);
|
||||
|
||||
folder.delete(messages, "Trash");
|
||||
|
||||
assertCommandWithIdsIssued("UID STORE 2 +FLAGS.SILENT (\\Deleted)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete_withoutTrashFolderExisting_shouldThrow() throws Exception {
|
||||
ImapFolder folder = createFolder("Folder");
|
||||
prepareImapFolderForOpen(OPEN_MODE_RW);
|
||||
ImapFolder trashFolder = createFolder("Trash");
|
||||
when(imapStore.getFolder("Trash")).thenReturn(trashFolder);
|
||||
List<ImapMessage> messages = singletonList(createImapMessage("2"));
|
||||
List<ImapResponse> copyResponses = singletonList(
|
||||
createImapResponse("x OK [COPYUID 23 2 102] Success")
|
||||
);
|
||||
when(imapConnection.executeSimpleCommand("UID COPY 2 \"Trash\"")).thenReturn(copyResponses);
|
||||
folder.open(OPEN_MODE_RW);
|
||||
doThrow(NegativeImapResponseException.class).doReturn(Collections.emptyList())
|
||||
.when(imapConnection).executeSimpleCommand("STATUS \"Trash\" (RECENT)");
|
||||
|
||||
try {
|
||||
folder.delete(messages, "Trash");
|
||||
fail("Expected exception");
|
||||
} catch (FolderNotFoundException e) {
|
||||
assertEquals("Trash", e.getFolderServerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getUnreadMessageCount_withClosedFolder_shouldThrow() throws Exception {
|
||||
ImapFolder folder = createFolder("Folder");
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.fsck.k9.mail.store.pop3;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -523,11 +522,6 @@ public class Pop3Folder extends Folder<Pop3Message> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<? extends Message> msgs, String trashFolder) throws MessagingException {
|
||||
setFlags(msgs, Collections.singleton(Flag.DELETED), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUidFromMessageId(String messageId) throws MessagingException {
|
||||
return null;
|
||||
|
|
|
@ -24,17 +24,4 @@ public class Pop3Message extends MimeMessage {
|
|||
super.setFlag(flag, set);
|
||||
mFolder.setFlags(Collections.singletonList(this), Collections.singleton(flag), set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String trashFolder) throws MessagingException {
|
||||
// try
|
||||
// {
|
||||
// Poor POP3 users, we can't copy the message to the Trash folder, but they still want a delete
|
||||
setFlag(Flag.DELETED, true);
|
||||
// }
|
||||
// catch (MessagingException me)
|
||||
// {
|
||||
// Log.w(LOG_TAG, "Could not delete non-existent message", me);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package com.fsck.k9.mail.store.pop3;
|
||||
|
||||
|
||||
import com.fsck.k9.mail.Flag;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
|
||||
public class Pop3MessageTest {
|
||||
|
||||
@Test
|
||||
public void delete_setsDeletedFlag() throws MessagingException {
|
||||
Pop3Message message = new Pop3Message("001", mock(Pop3Folder.class));
|
||||
message.delete("Trash");
|
||||
|
||||
assertTrue(message.getFlags().contains(Flag.DELETED));
|
||||
}
|
||||
}
|
|
@ -104,11 +104,6 @@ public class WebDavFolder extends Folder<WebDavMessage> {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<? extends Message> msgs, String trashFolder) throws MessagingException {
|
||||
moveOrCopyMessages(msgs, trashFolder, true);
|
||||
}
|
||||
|
||||
private void moveOrCopyMessages(List<? extends Message> messages, String folderName, boolean isMove)
|
||||
throws MessagingException {
|
||||
String[] uids = new String[messages.size()];
|
||||
|
|
|
@ -95,13 +95,6 @@ public class WebDavMessage extends MimeMessage {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String trashFolder) throws MessagingException {
|
||||
WebDavFolder wdFolder = (WebDavFolder) getFolder();
|
||||
Timber.i("Deleting message by moving to %s", trashFolder);
|
||||
wdFolder.moveMessages(Collections.singletonList(this), wdFolder.getStore().getFolder(trashFolder));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlag(Flag flag, boolean set) throws MessagingException {
|
||||
super.setFlag(flag, set);
|
||||
|
|
|
@ -48,14 +48,6 @@ public class WebDavMessageTest {
|
|||
assertEquals("http://example.org/Inbox/sub%20folder/mes%20sage.eml", message.getUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delete_asks_folder_to_delete_message() throws MessagingException {
|
||||
when(mockFolder.getStore()).thenReturn(mockStore);
|
||||
when(mockStore.getFolder("Trash")).thenReturn(mockTrashFolder);
|
||||
message.delete("Trash");
|
||||
verify(mockFolder).moveMessages(Collections.singletonList(message), mockTrashFolder);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setNewHeaders_updates_size() throws MessagingException {
|
||||
ParsedMessageEnvelope parsedMessageEnvelope = new ParsedMessageEnvelope();
|
||||
|
|
Loading…
Reference in a new issue