changeset 15141:99305e4dd403

Backported parts of normalizer_func_t changes from v2.2 tree.
author Timo Sirainen <tss@iki.fi>
date Tue, 18 Sep 2012 20:07:21 +0300
parents be5b1256bf57
children a200fdbc1fa0
files src/lib-storage/mail-storage-private.h src/lib-storage/mail-user.c src/lib-storage/mail-user.h src/lib/unichar.h
diffstat 4 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-storage-private.h	Tue Sep 18 20:06:56 2012 +0300
+++ b/src/lib-storage/mail-storage-private.h	Tue Sep 18 20:07:21 2012 +0300
@@ -2,6 +2,7 @@
 #define MAIL_STORAGE_PRIVATE_H
 
 #include "module-context.h"
+#include "unichar.h"
 #include "file-lock.h"
 #include "mail-storage.h"
 #include "mail-storage-hooks.h"
@@ -416,6 +417,7 @@
 	struct mail_search_sort_program *sort_program;
 	enum mail_fetch_field wanted_fields;
 	struct mailbox_header_lookup_ctx *wanted_headers;
+	normalizer_func_t *normalizer;
 
 	/* if non-NULL, specifies that a search resulting is being updated.
 	   this can be used as a search optimization: if searched message
--- a/src/lib-storage/mail-user.c	Tue Sep 18 20:06:56 2012 +0300
+++ b/src/lib-storage/mail-user.c	Tue Sep 18 20:07:21 2012 +0300
@@ -51,6 +51,7 @@
 	user->unexpanded_set = settings_dup(set_info, set, pool);
 	user->set = settings_dup(set_info, set, pool);
 	user->service = master_service_get_name(master_service);
+	user->default_normalizer = uni_utf8_to_decomposed_titlecase;
 
 	/* check settings so that the duplicated structure will again
 	   contain the parsed fields */
--- a/src/lib-storage/mail-user.h	Tue Sep 18 20:06:56 2012 +0300
+++ b/src/lib-storage/mail-user.h	Tue Sep 18 20:07:21 2012 +0300
@@ -1,6 +1,7 @@
 #ifndef MAIL_USER_H
 #define MAIL_USER_H
 
+#include "unichar.h"
 #include "mail-storage-settings.h"
 
 struct module;
@@ -36,6 +37,7 @@
 	ARRAY_DEFINE(hooks, const struct mail_storage_hooks *);
 
 	struct mountpoint_list *mountpoints;
+	normalizer_func_t *default_normalizer;
 
 	/* Module-specific contexts. See mail_storage_module_id. */
 	ARRAY_DEFINE(module_contexts, union mail_user_module_context *);
--- a/src/lib/unichar.h	Tue Sep 18 20:06:56 2012 +0300
+++ b/src/lib/unichar.h	Tue Sep 18 20:07:21 2012 +0300
@@ -27,6 +27,12 @@
 typedef uint32_t unichar_t;
 ARRAY_DEFINE_TYPE(unichars, unichar_t);
 
+/* Normalize UTF8 input and append it to output buffer.
+   Returns 0 if ok, -1 if input was invalid. Even if input was invalid,
+   as much as possible should be added to output. */
+typedef int normalizer_func_t(const void *input, size_t size,
+			      buffer_t *output);
+
 extern const unsigned char utf8_replacement_char[UTF8_REPLACEMENT_CHAR_LEN];
 extern const uint8_t *const uni_utf8_non1_bytes;