IMAP: return all search results uids on a single line for Wanderlust

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1858 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-11-11 11:00:02 +00:00
parent 724fbc86e8
commit 0b786e0501
2 changed files with 24 additions and 6 deletions

View File

@ -314,13 +314,12 @@ public class ImapConnection extends AbstractConnection {
} else if ("search".equalsIgnoreCase(subcommand)) {
List<Long> uidList = handleSearch(tokens);
if (uidList.isEmpty()) {
sendClient("* SEARCH");
} else {
for (long uid : uidList) {
sendClient("* SEARCH " + uid);
}
StringBuilder buffer = new StringBuilder("* SEARCH");
for (long uid : uidList) {
buffer.append(' ');
buffer.append(uid);
}
sendClient(buffer.toString());
sendClient(commandId + " OK SEARCH completed");
} else if ("store".equalsIgnoreCase(subcommand)) {

View File

@ -48,6 +48,11 @@ public class TestImap extends AbstractImapTestCase {
assertEquals(". OK [READ-WRITE] SELECT completed", readFullAnswer("."));
}
public void testSelectRoot() throws IOException {
writeLine(". SELECT \"\"");
assertEquals(". OK [READ-WRITE] SELECT completed", readFullAnswer("."));
}
public void testFetchFlags() throws IOException {
writeLine(". UID FETCH 1:* (FLAGS)");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
@ -332,4 +337,18 @@ public class TestImap extends AbstractImapTestCase {
clientSocket.close();
Thread.sleep(5000);
}
public void testSearchCharset() throws IOException {
testSelectInbox();
writeLine("UID SEARCH CHARSET UTF-8 (HEADER SUBJECT testé)");
assertEquals(". OK SEARCH completed", readFullAnswer("."));
}
public void testWanderLust() throws IOException {
testSelectInbox();
writeLine(". uid fetch 1:* (body.peek[header.fields (Subject From To Cc Date Message-Id References In-Reply-To Delivered-To)] rfc822.size flags)");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
}