Commit e172cc15 authored by Mickaël Guessant's avatar Mickaël Guessant

Prepare batch move implementation

git-svn-id: https://svn.code.sf.net/p/davmail/code/trunk@2316 3d1905a2-6b24-0410-a738-b14d5a86fcbd
parent d0794f09
......@@ -1463,6 +1463,13 @@ public abstract class ExchangeSession {
*/
public abstract void copyMessage(Message message, String targetFolder) throws IOException;
public void copyMessages(List<Message> messages, String targetFolder) throws IOException {
for (Message message: messages) {
copyMessage(message, targetFolder);
}
}
/**
* Move message to target folder
*
......@@ -1472,6 +1479,12 @@ public abstract class ExchangeSession {
*/
public abstract void moveMessage(Message message, String targetFolder) throws IOException;
public void moveMessages(List<Message> messages, String targetFolder) throws IOException {
for (Message message: messages) {
moveMessage(message, targetFolder);
}
}
/**
* Move folder to target name.
*
......
......@@ -343,14 +343,14 @@ public class ImapConnection extends AbstractConnection {
if (!uidRangeIterator.hasNext()) {
sendClient(commandId + " NO " + "No message found");
} else {
ArrayList<ExchangeSession.Message> messages = new ArrayList<ExchangeSession.Message>();
while (uidRangeIterator.hasNext()) {
DavGatewayTray.switchIcon();
ExchangeSession.Message message = uidRangeIterator.next();
if ("copy".equalsIgnoreCase(subcommand)) {
session.copyMessage(message, targetName);
} else {
session.moveMessage(message, targetName);
}
messages.add(uidRangeIterator.next());
}
if ("copy".equalsIgnoreCase(subcommand)) {
session.copyMessages(messages, targetName);
} else {
session.moveMessages(messages, targetName);
}
sendClient(commandId + " OK " + subcommand + " completed");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment