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:
parent
0791376946
commit
e394d79518
@ -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.
|
||||||
*
|
*
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user