1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

IMAP: send error on idle command without selected folder (Outlook)

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1482 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-28 20:57:00 +00:00
parent d12bf7c8d7
commit 15e49fe372

View File

@ -467,33 +467,37 @@ public class ImapConnection extends AbstractConnection {
sendClient(commandId + " NO " + e.getMessage());
}
} else if ("idle".equalsIgnoreCase(command) && imapIdleDelay > 0) {
sendClient("+ idling ");
// clear cache before going to idle mode
currentFolder.clearCache();
DavGatewayTray.resetIcon();
try {
int count = 0;
while (in.available() == 0) {
if (++count >= imapIdleDelay) {
count = 0;
List<Long> previousImapUidList = currentFolder.getImapUidList();
if (session.refreshFolder(currentFolder)) {
handleRefresh(previousImapUidList, currentFolder.getImapUidList());
if (currentFolder != null) {
sendClient("+ idling ");
// clear cache before going to idle mode
currentFolder.clearCache();
DavGatewayTray.resetIcon();
try {
int count = 0;
while (in.available() == 0) {
if (++count >= imapIdleDelay) {
count = 0;
List<Long> previousImapUidList = currentFolder.getImapUidList();
if (session.refreshFolder(currentFolder)) {
handleRefresh(previousImapUidList, currentFolder.getImapUidList());
}
}
// sleep 1 second
Thread.sleep(1000);
}
// sleep 1 second
Thread.sleep(1000);
// read DONE line
line = readClient();
if ("DONE".equals(line)) {
sendClient(commandId + " OK " + command + " terminated");
} else {
sendClient(commandId + " BAD command unrecognized");
}
} catch (IOException e) {
// client connection closed
throw new SocketException(e.getMessage());
}
// read DONE line
line = readClient();
if ("DONE".equals(line)) {
sendClient(commandId + " OK " + command + " terminated");
} else {
sendClient(commandId + " BAD command unrecognized");
}
} catch (IOException e) {
// client connection closed
throw new SocketException(e.getMessage());
} else {
sendClient(commandId + " NO no folder selected");
}
} else if ("noop".equalsIgnoreCase(command) || "check".equalsIgnoreCase(command)) {
if (currentFolder != null) {