[dovecot-cvs] dovecot/src/imap cmd-search.c, 1.34, 1.35 imap-search.c, 1.16, 1.17

tss at dovecot.org tss at dovecot.org
Sun May 13 16:23:04 EEST 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv12374/imap

Modified Files:
	cmd-search.c imap-search.c 
Log Message:
Parse search dates already in IMAP code.



Index: cmd-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-search.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cmd-search.c	25 Mar 2007 23:51:12 -0000	1.34
+++ cmd-search.c	13 May 2007 13:23:02 -0000	1.35
@@ -164,7 +164,7 @@
 				       args, &error);
 	if (sargs == NULL) {
 		/* error in search arguments */
-		client_send_tagline(cmd, t_strconcat("NO ", error, NULL));
+		client_send_tagline(cmd, t_strconcat("BAD ", error, NULL));
 		return TRUE;
 	}
 

Index: imap-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-search.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- imap-search.c	20 Dec 2006 21:26:36 -0000	1.16
+++ imap-search.c	13 May 2007 13:23:02 -0000	1.17
@@ -3,6 +3,7 @@
 #include "common.h"
 #include "mail-storage.h"
 #include "mail-search.h"
+#include "imap-date.h"
 #include "imap-search.h"
 #include "imap-parser.h"
 #include "imap-messageset.h"
@@ -100,7 +101,21 @@
 		return FALSE;
 	}
 
-	sarg->value.str = p_strdup(data->pool, IMAP_ARG_STR(*args));
+	switch (type) {
+	case SEARCH_BEFORE:
+	case SEARCH_ON:
+	case SEARCH_SINCE:
+	case SEARCH_SENTBEFORE:
+	case SEARCH_SENTON:
+	case SEARCH_SENTSINCE:
+		if (!imap_parse_date(IMAP_ARG_STR(*args), &sarg->value.time)) {
+			data->error = "Invalid search date parameter";
+			return FALSE;
+		}
+	default:
+		sarg->value.str = p_strdup(data->pool, IMAP_ARG_STR(*args));
+		break;
+	}
 	*args += 1;
 
 	if (hdr_name != NULL)



More information about the dovecot-cvs mailing list