IMAP: implement SEARCH TEXT on from, to, cc, subject and body

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1909 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-02-09 23:34:38 +00:00
parent f70ba39fe1
commit f6f95a9300
2 changed files with 20 additions and 0 deletions

View File

@ -1225,6 +1225,13 @@ public class ImapConnection extends AbstractConnection {
return session.contains("subject", tokens.nextToken());
} else if ("BODY".equals(token)) {
return session.contains("body", tokens.nextToken());
} else if ("TEXT".equals(token)) {
String value = tokens.nextToken();
return session.or(session.contains("body", value),
session.contains("subject", value),
session.contains("from", value),
session.contains("to", value),
session.contains("cc", value));
} else if ("FROM".equals(token)) {
return session.contains("from", tokens.nextToken());
} else if ("TO".equals(token)) {

View File

@ -350,5 +350,18 @@ public class TestImap extends AbstractImapTestCase {
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
public void testSearchSince() throws IOException {
testSelectInbox();
writeLine(". UID SEARCH SINCE 1-Jan-2012 UNDELETED");
assertEquals(". OK SEARCH completed", readFullAnswer("."));
}
public void testSearchText() throws IOException {
testSelectInbox();
writeLine(". UID SEARCH TEXT test");
assertEquals(". OK SEARCH completed", readFullAnswer("."));
}
}