1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-17 21:32:26 -05:00

Create non-existent IMAP folders when copying/moving messages

This commit is contained in:
cketti 2012-12-10 21:42:57 +01:00
parent edd2a44201
commit 44348e08a4

View File

@ -1145,6 +1145,20 @@ public class ImapStore extends Store {
try {
String remoteDestName = encodeString(encodeFolderName(iFolder.getPrefixedName()));
//TODO: Try to copy/move the messages first and only create the folder if the
// operation fails. This will save a roundtrip if the folder already exists.
if (!exists(remoteDestName)) {
/*
* If the remote folder doesn't exist we try to create it.
*/
if (K9.DEBUG) {
Log.i(K9.LOG_TAG, "ImapFolder.copyMessages: attempting to create remote " +
"folder '" + remoteDestName + "' for " + getLogId());
}
iFolder.create(FolderType.HOLDS_MESSAGES);
}
//TODO: Split this into multiple commands if the command exceeds a certain length.
List<ImapResponse> responses = executeSimpleCommand(String.format("UID COPY %s %s",
Utility.combine(uids, ','),