IMAP: send required "* SEARCH" on empty search response

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1070 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-06-02 22:18:21 +00:00
parent 3bdd897673
commit a4716cf936
1 changed files with 15 additions and 7 deletions

View File

@ -287,8 +287,12 @@ public class ImapConnection extends AbstractConnection {
} else if ("search".equalsIgnoreCase(subcommand)) {
List<Long> uidList = handleSearch(tokens);
for (long uid : uidList) {
sendClient("* SEARCH " + uid);
if (uidList.isEmpty()) {
sendClient("* SEARCH");
} else {
for (long uid : uidList) {
sendClient("* SEARCH " + uid);
}
}
sendClient(commandId + " OK SEARCH completed");
@ -319,11 +323,15 @@ public class ImapConnection extends AbstractConnection {
sendClient(commandId + " NO no folder selected");
} else {
List<Long> uidList = handleSearch(tokens);
int currentIndex = 0;
for (ExchangeSession.Message message : currentFolder.messages) {
currentIndex++;
if (uidList.contains(message.getImapUid())) {
sendClient("* SEARCH " + currentIndex);
if (uidList.isEmpty()) {
sendClient("* SEARCH");
} else {
int currentIndex = 0;
for (ExchangeSession.Message message : currentFolder.messages) {
currentIndex++;
if (uidList.contains(message.getImapUid())) {
sendClient("* SEARCH " + currentIndex);
}
}
}
sendClient(commandId + " OK SEARCH completed");