1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-21 23:18:49 -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 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 * Move message to target folder
* *
@ -1472,6 +1479,12 @@ public abstract class ExchangeSession {
*/ */
public abstract void moveMessage(Message message, String targetFolder) throws IOException; 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. * Move folder to target name.
* *

View File

@ -343,14 +343,14 @@ public class ImapConnection extends AbstractConnection {
if (!uidRangeIterator.hasNext()) { if (!uidRangeIterator.hasNext()) {
sendClient(commandId + " NO " + "No message found"); sendClient(commandId + " NO " + "No message found");
} else { } else {
ArrayList<ExchangeSession.Message> messages = new ArrayList<ExchangeSession.Message>();
while (uidRangeIterator.hasNext()) { while (uidRangeIterator.hasNext()) {
DavGatewayTray.switchIcon(); messages.add(uidRangeIterator.next());
ExchangeSession.Message message = uidRangeIterator.next(); }
if ("copy".equalsIgnoreCase(subcommand)) { if ("copy".equalsIgnoreCase(subcommand)) {
session.copyMessage(message, targetName); session.copyMessages(messages, targetName);
} else { } else {
session.moveMessage(message, targetName); session.moveMessages(messages, targetName);
}
} }
sendClient(commandId + " OK " + subcommand + " completed"); sendClient(commandId + " OK " + subcommand + " completed");
} }