1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-11-15 13:55:09 -05:00

Prepare batch move implementation

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2316 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-09-04 06:46:57 +00:00
parent 0791376946
commit e394d79518
2 changed files with 20 additions and 7 deletions

View File

@ -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.
*

View File

@ -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");
}