mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-05 18:58:02 -05:00
IMAP: send error on COPY/MOVE when message iterator is empty
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1908 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
4d6e87b346
commit
f70ba39fe1
@ -331,16 +331,20 @@ public class ImapConnection extends AbstractConnection {
|
||||
try {
|
||||
UIDRangeIterator uidRangeIterator = new UIDRangeIterator(currentFolder.messages, tokens.nextToken());
|
||||
String targetName = BASE64MailboxDecoder.decode(tokens.nextToken());
|
||||
while (uidRangeIterator.hasNext()) {
|
||||
DavGatewayTray.switchIcon();
|
||||
ExchangeSession.Message message = uidRangeIterator.next();
|
||||
if ("copy".equalsIgnoreCase(subcommand)) {
|
||||
session.copyMessage(message, targetName);
|
||||
} else {
|
||||
session.moveMessage(message, targetName);
|
||||
if (!uidRangeIterator.hasNext()) {
|
||||
sendClient(commandId + " NO " + "No message found");
|
||||
} else {
|
||||
while (uidRangeIterator.hasNext()) {
|
||||
DavGatewayTray.switchIcon();
|
||||
ExchangeSession.Message message = uidRangeIterator.next();
|
||||
if ("copy".equalsIgnoreCase(subcommand)) {
|
||||
session.copyMessage(message, targetName);
|
||||
} else {
|
||||
session.moveMessage(message, targetName);
|
||||
}
|
||||
}
|
||||
sendClient(commandId + " OK " + subcommand + " completed");
|
||||
}
|
||||
sendClient(commandId + " OK "+subcommand+" completed");
|
||||
} catch (HttpException e) {
|
||||
sendClient(commandId + " NO " + e.getMessage());
|
||||
}
|
||||
@ -402,16 +406,20 @@ public class ImapConnection extends AbstractConnection {
|
||||
try {
|
||||
RangeIterator rangeIterator = new RangeIterator(currentFolder.messages, tokens.nextToken());
|
||||
String targetName = BASE64MailboxDecoder.decode(tokens.nextToken());
|
||||
while (rangeIterator.hasNext()) {
|
||||
DavGatewayTray.switchIcon();
|
||||
ExchangeSession.Message message = rangeIterator.next();
|
||||
if ("copy".equalsIgnoreCase(command)) {
|
||||
session.copyMessage(message, targetName);
|
||||
} else {
|
||||
session.moveMessage(message, targetName);
|
||||
if (!rangeIterator.hasNext()) {
|
||||
sendClient(commandId + " NO " + "No message found");
|
||||
} else {
|
||||
while (rangeIterator.hasNext()) {
|
||||
DavGatewayTray.switchIcon();
|
||||
ExchangeSession.Message message = rangeIterator.next();
|
||||
if ("copy".equalsIgnoreCase(command)) {
|
||||
session.copyMessage(message, targetName);
|
||||
} else {
|
||||
session.moveMessage(message, targetName);
|
||||
}
|
||||
}
|
||||
sendClient(commandId + " OK "+command+" completed");
|
||||
}
|
||||
sendClient(commandId + " OK "+command+" completed");
|
||||
} catch (HttpException e) {
|
||||
sendClient(commandId + " NO " + e.getMessage());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user