1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-02-28 09:21:49 -05:00

IMAP: Detect fetch of a missing (probably deleted) message to avoid infinite loop with Thunderbird

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@565 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-05-15 12:39:15 +00:00
parent 023736018c
commit dc82440cc0

View File

@ -36,7 +36,8 @@ public class ImapConnection extends AbstractConnection {
super(ImapConnection.class.getSimpleName(), clientSocket, null);
}
@Override public void run() {
@Override
public void run() {
String line;
String commandId = null;
IMAPTokenizer tokens;
@ -192,17 +193,27 @@ public class ImapConnection extends AbstractConnection {
sendClient(commandId + " NO no folder selected");
} else {
currentFolder = session.refreshFolder(currentFolder);
UIDRangeIterator uidRangeIterator = new UIDRangeIterator(tokens.nextToken());
String ranges = tokens.nextToken();
if (ranges == null) {
sendClient(commandId + " BAD missing range parameter");
} else {
UIDRangeIterator uidRangeIterator = new UIDRangeIterator(ranges);
String parameters = null;
if (tokens.hasMoreTokens()) {
parameters = tokens.nextToken();
}
if (!uidRangeIterator.hasNext() && ranges.indexOf(':') < 0) {
// message not found in current list, maybe deleted in another thread
sendClient(commandId + " NO No message found");
} else {
while (uidRangeIterator.hasNext()) {
ExchangeSession.Message message = uidRangeIterator.next();
handleFetch(message, uidRangeIterator.currentIndex, parameters);
}
sendClient(commandId + " OK UID FETCH completed");
}
}
}
} else if ("search".equalsIgnoreCase(subcommand)) {
SearchConditions conditions = new SearchConditions();