[dovecot-cvs] dovecot/src/imap Makefile.am,1.4,1.5 cmd-search.c,1.4,1.5

cras at procontrol.fi cras at procontrol.fi
Sun Nov 3 10:39:45 EET 2002


Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv3305/src/imap

Modified Files:
	Makefile.am cmd-search.c 
Log Message:
SEARCH CHARSET support. Currently we do it through iconv() and only ASCII   
characters are compared case-insensitively.



Index: Makefile.am
===================================================================
RCS file: /home/cvs/dovecot/src/imap/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am	29 Oct 2002 06:29:17 -0000	1.4
+++ Makefile.am	3 Nov 2002 08:39:43 -0000	1.5
@@ -17,6 +17,7 @@
 	../lib-storage/subscription-file/libstorage_subscription_file.a \
 	../lib-imap/libimap.a \
 	../lib-mail/libmail.a \
+	../lib-charset/libcharset.a \
 	../lib/liblib.a
 
 cmds = \

Index: cmd-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-search.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmd-search.c	19 Oct 2002 14:51:59 -0000	1.4
+++ cmd-search.c	3 Nov 2002 08:39:43 -0000	1.5
@@ -10,7 +10,7 @@
 	ImapArg *args;
 	int args_count;
 	Pool pool;
-	const char *error;
+	const char *error, *charset;
 
 	args_count = imap_parser_read_args(client->parser, 0, 0, &args);
 	if (args_count == -2)
@@ -25,6 +25,23 @@
 	if (!client_verify_open_mailbox(client))
 		return TRUE;
 
+	if (args->type == IMAP_ARG_ATOM &&
+	    strcasecmp(args->data.str, "CHARSET") == 0) {
+		/* CHARSET specified */
+		args++;
+		if (args->type != IMAP_ARG_ATOM &&
+		    args->type != IMAP_ARG_STRING) {
+			client_send_command_error(client,
+						  "Invalid charset argument.");
+			return TRUE;
+		}
+
+		charset = args->data.str;
+		args++;
+	} else {
+		charset = NULL;
+	}
+
 	pool = pool_create("MailSearchArgs", 2048, FALSE);
 
 	sargs = mail_search_args_build(pool, args, &error);
@@ -32,7 +49,7 @@
 		/* error in search arguments */
 		client_send_tagline(client, t_strconcat("NO ", error, NULL));
 	} else {
-		if (client->mailbox->search(client->mailbox, sargs,
+		if (client->mailbox->search(client->mailbox, charset, sargs,
 					    client->outbuf, client->cmd_uid)) {
 			/* NOTE: syncing isn't allowed here */
 			client_sync_without_expunges(client);




More information about the dovecot-cvs mailing list