changeset 8713:0118c6040468 HEAD

SEARCH RETURN (PARTIAL): Allow higher:lower numbers in partial seq range.
author Timo Sirainen <tss@iki.fi>
date Wed, 04 Feb 2009 14:18:24 -0500
parents 69cdbfd4c1ed
children bbdbab5354d6
files src/imap/cmd-search.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-search.c	Wed Feb 04 13:54:49 2009 -0500
+++ b/src/imap/cmd-search.c	Wed Feb 04 14:18:24 2009 -0500
@@ -57,11 +57,20 @@
 	ctx->partial2 = 0;
 	for (; *str >= '0' && *str <= '9'; str++)
 		ctx->partial1 = ctx->partial1 * 10 + *str-'0';
-	if (*str != ':')
+	if (*str != ':' || ctx->partial1 == 0)
 		return -1;
 	for (str++; *str >= '0' && *str <= '9'; str++)
 		ctx->partial2 = ctx->partial2 * 10 + *str-'0';
-	return *str == '\0' ? 0 : -1;
+	if (*str != '\0' || ctx->partial2 == 0)
+		return -1;
+
+	if (ctx->partial1 > ctx->partial2) {
+		uint32_t temp = ctx->partial2;
+		ctx->partial2 = ctx->partial1;
+		ctx->partial1 = temp;
+	}
+
+	return 0;
 }
 
 static bool