changeset 9469:2a6e47b50ee5 HEAD

lib-lda: Log mailbox name using UTF-8, not mUTF-7.
author Timo Sirainen <tss@iki.fi>
date Mon, 09 Nov 2009 21:04:45 -0500
parents 7ea4e58aa356
children 9c3682683624
files src/deliver/deliver.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/deliver.c	Mon Nov 09 20:52:54 2009 -0500
+++ b/src/deliver/deliver.c	Mon Nov 09 21:04:45 2009 -0500
@@ -205,6 +205,17 @@
 	return box;
 }
 
+static const char *mailbox_name_get_printable(const char *mailbox_mutf7)
+{
+	string_t *str = t_str_new(128);
+
+	if (imap_utf7_to_utf8(mailbox_mutf7, str) < 0) {
+		str_truncate(str, 0);
+		str_append(str, mailbox_mutf7);
+	}
+	return str_sanitize(str_c(str), 80);
+}
+
 int deliver_save(struct mail_namespace *namespaces,
 		 struct mail_storage **storage_r, const char *mailbox,
 		 struct mail *mail, enum mail_flags flags,
@@ -223,7 +234,7 @@
 	if (default_save)
 		tried_default_save = TRUE;
 
-	mailbox_name = str_sanitize(mailbox, 80);
+	mailbox_name = mailbox_name_get_printable(mailbox);
 	box = mailbox_open_or_create_synced(namespaces, storage_r, mailbox);
 	if (box == NULL) {
 		if (*storage_r == NULL) {