changeset 6135:bc0f8a8397a3 HEAD

Use i;unicode-casemap for sorting also.
author Timo Sirainen <tss@iki.fi>
date Fri, 20 Jul 2007 20:28:39 +0300
parents 9a847fc14abe
children 9b0588ca3c10
files src/lib-storage/index/index-sort.c
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-sort.c	Fri Jul 20 18:15:49 2007 +0300
+++ b/src/lib-storage/index/index-sort.c	Fri Jul 20 20:28:39 2007 +0300
@@ -31,6 +31,7 @@
 #include "array.h"
 #include "bsearch-insert-pos.h"
 #include "str.h"
+#include "unichar.h"
 #include "message-address.h"
 #include "imap-base-subject.h"
 #include "index-storage.h"
@@ -171,6 +172,7 @@
 sort_header_get(enum mail_sort_type sort_type, struct mail *mail, uint32_t seq)
 {
 	const char *str;
+	string_t *buf;
 
 	mail_set_seq(mail, seq);
 	switch (sort_type & MAIL_SORT_MASK) {
@@ -180,14 +182,21 @@
 			imap_get_base_subject_cased(pool_datastack_create(),
 						    str, NULL);
 	case MAIL_SORT_CC:
-		return get_first_mailbox(mail, "Cc");
+		str = get_first_mailbox(mail, "Cc");
+		break;
 	case MAIL_SORT_FROM:
-		return get_first_mailbox(mail, "From");
+		str = get_first_mailbox(mail, "From");
+		break;
 	case MAIL_SORT_TO:
-		return get_first_mailbox(mail, "To");
+		str = get_first_mailbox(mail, "To");
+		break;
 	default:
 		i_unreached();
 	}
+
+	buf = t_str_new(128);
+	(void)uni_utf8_to_decomposed_titlecase(str, (size_t)-1, buf);
+	return str_c(buf);
 }
 
 static int sort_node_cmp_type(struct sort_cmp_context *ctx,
@@ -213,7 +222,7 @@
 			sort_header_get(sort_type, ctx->mail, n1->seq);
 		str2 = sort_header_get(sort_type, ctx->mail, n2->seq);
 
-		ret = strcasecmp(str1, str2);
+		ret = strcmp(str1, str2);
 		t_pop();
 		break;
 	case MAIL_SORT_ARRIVAL:
@@ -358,9 +367,9 @@
 		str = sort_header_get(program->sort_program[0], mail,
 				      nodes[i].seq);
 
-		if (i == idx2 && strcasecmp(str, last_str) == 0)
+		if (i == idx2 && strcmp(str, last_str) == 0)
 			nodes[i].sort_id = last_id;
-		else if (strcasecmp(str, str_c(prev_str)) == 0 && prev_id != 0)
+		else if (strcmp(str, str_c(prev_str)) == 0 && prev_id != 0)
 			nodes[i].sort_id = prev_id;
 		else {
 			/* divide the available space so that each message gets