mirror of
https://github.com/moparisthebest/davmail
synced 2024-11-10 11:25:00 -05:00
IMAP: implement DRAFT and UNDRAFT search conditions, fix 3396248
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1779 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
3ea83a69a3
commit
af5bf09828
@ -905,7 +905,8 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
ExchangeSession.Message message = iterator.next();
|
ExchangeSession.Message message = iterator.next();
|
||||||
if ((conditions.flagged == null || message.flagged == conditions.flagged)
|
if ((conditions.flagged == null || message.flagged == conditions.flagged)
|
||||||
&& (conditions.answered == null || message.answered == conditions.answered)) {
|
&& (conditions.answered == null || message.answered == conditions.answered)
|
||||||
|
&& (conditions.draft == null || message.draft == conditions.draft)) {
|
||||||
uidList.add(message.getImapUid());
|
uidList.add(message.getImapUid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1169,6 +1170,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
static final class SearchConditions {
|
static final class SearchConditions {
|
||||||
Boolean flagged;
|
Boolean flagged;
|
||||||
Boolean answered;
|
Boolean answered;
|
||||||
|
Boolean draft;
|
||||||
String indexRange;
|
String indexRange;
|
||||||
String uidRange;
|
String uidRange;
|
||||||
}
|
}
|
||||||
@ -1215,6 +1217,10 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
return session.isTrue("read");
|
return session.isTrue("read");
|
||||||
} else if ("UNSEEN".equals(token) || "NEW".equals(token)) {
|
} else if ("UNSEEN".equals(token) || "NEW".equals(token)) {
|
||||||
return session.isFalse("read");
|
return session.isFalse("read");
|
||||||
|
} else if ("DRAFT".equals(token)) {
|
||||||
|
conditions.draft = Boolean.TRUE;
|
||||||
|
} else if ("UNDRAFT".equals(token)) {
|
||||||
|
conditions.draft = Boolean.FALSE;
|
||||||
} else if ("DELETED".equals(token)) {
|
} else if ("DELETED".equals(token)) {
|
||||||
// conditions.deleted = Boolean.TRUE;
|
// conditions.deleted = Boolean.TRUE;
|
||||||
return session.isEqualTo("deleted", "1");
|
return session.isEqualTo("deleted", "1");
|
||||||
|
@ -316,6 +316,14 @@ public class TestImap extends AbstractImapTestCase {
|
|||||||
assertEquals(". OK SEARCH completed", readFullAnswer("."));
|
assertEquals(". OK SEARCH completed", readFullAnswer("."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSearchUndraft() throws IOException {
|
||||||
|
testSelectInbox();
|
||||||
|
writeLine(". UID SEARCH UNDRAFT");
|
||||||
|
assertEquals(". OK SEARCH completed", readFullAnswer("."));
|
||||||
|
writeLine(". UID SEARCH DRAFT");
|
||||||
|
assertEquals(". OK SEARCH completed", readFullAnswer("."));
|
||||||
|
}
|
||||||
|
|
||||||
public void testBrokenPipe() throws IOException, InterruptedException {
|
public void testBrokenPipe() throws IOException, InterruptedException {
|
||||||
testSelectInbox();
|
testSelectInbox();
|
||||||
writeLine(". UID FETCH 1:* (RFC822.SIZE BODY.TEXT)");
|
writeLine(". UID FETCH 1:* (RFC822.SIZE BODY.TEXT)");
|
||||||
|
Loading…
Reference in New Issue
Block a user