1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-01-12 22:18:11 -05:00

IMAP: implement UID range search

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@401 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-02-25 17:17:51 +00:00
parent 5910e4a754
commit 33a6bdf5a2

View File

@ -230,6 +230,7 @@ public class ImapConnection extends AbstractConnection {
if (((undeleted && !message.deleted) || !undeleted)
&& (conditions.flagged == null || message.flagged == conditions.flagged)
&& (conditions.answered == null || message.answered == conditions.answered)
&& (conditions.startUid == 0 || message.getUidAsLong() >= conditions.startUid)
) {
sendClient("* SEARCH " + message.getUidAsLong());
}
@ -491,6 +492,7 @@ public class ImapConnection extends AbstractConnection {
static final class SearchConditions {
Boolean flagged = null;
Boolean answered = null;
long startUid = 0;
final StringBuilder query = new StringBuilder();
public StringBuilder append(String value) {
@ -556,6 +558,8 @@ public class ImapConnection extends AbstractConnection {
String range = tokens.nextToken();
if ("1:*".equals(range)) {
// ignore: this is a noop filter
} else if (range.endsWith(":*")) {
conditions.startUid = Long.parseLong(range.substring(0, range.indexOf(':')));
} else {
throw new IOException("Invalid search parameters");
}