1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Bulk delete for WebDAV

This commit is contained in:
Daniel Applebaum 2009-11-29 18:33:42 +00:00
parent 1b3d0eb992
commit 3126298b46

View File

@ -1254,22 +1254,22 @@ public class WebDavStore extends Store
@Override
public void copyMessages(Message[] messages, Folder folder) throws MessagingException
{
moveOrCopyMessages(messages, folder, false);
moveOrCopyMessages(messages, folder.getName(), false);
}
@Override
public void moveMessages(Message[] messages, Folder folder) throws MessagingException
{
moveOrCopyMessages(messages, folder, true);
moveOrCopyMessages(messages, folder.getName(), true);
}
private void moveOrCopyMessages(Message[] messages, Folder folder, boolean isMove) throws MessagingException
@Override
public void delete(Message[] msgs, String trashFolderName) throws MessagingException
{
moveOrCopyMessages(msgs, trashFolderName, true);
}
private void moveOrCopyMessages(Message[] messages, String folderName, boolean isMove) throws MessagingException
{
if (folder instanceof WebDavFolder == false)
{
throw new MessagingException("moveMessages passed non-WebDavFolder");
}
String[] uids = new String[messages.length];
for (int i = 0, count = messages.length; i < count; i++)
@ -1292,15 +1292,13 @@ public class WebDavStore extends Store
}
messageBody = getMoveOrCopyMessagesReadXml(urls, isMove);
WebDavFolder destFolder = (WebDavFolder)store.getFolder(folder.getName());
WebDavFolder destFolder = (WebDavFolder)store.getFolder(folderName);
headers.put("Destination", destFolder.mFolderUrl);
headers.put("Brief", "t");
headers.put("If-Match", "*");
String action = (isMove ? "BMOVE" : "BCOPY");
Log.i(Email.LOG_TAG, "Moving " + messages.length + " messages to " + destFolder.mFolderUrl);
processRequest(mFolderUrl, action, messageBody, headers, false);
}