dovecot-2.0-sslstream: lib-lda: Log mailbox name using UTF-8, no...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:56:15 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/d57dcba5dd24
changeset: 10294:d57dcba5dd24
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 09 21:03:15 2009 -0500
description:
lib-lda: Log mailbox name using UTF-8, not mUTF-7.

diffstat:

2 files changed, 14 insertions(+), 1 deletion(-)
src/lib-lda/Makefile.am    |    1 +
src/lib-lda/mail-deliver.c |   14 +++++++++++++-

diffs (49 lines):

diff -r 5e92e1ed4e91 -r d57dcba5dd24 src/lib-lda/Makefile.am
--- a/src/lib-lda/Makefile.am	Mon Nov 09 20:57:40 2009 -0500
+++ b/src/lib-lda/Makefile.am	Mon Nov 09 21:03:15 2009 -0500
@@ -4,6 +4,7 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib \
 	-I$(top_srcdir)/src/lib-settings \
 	-I$(top_srcdir)/src/lib-master \
+	-I$(top_srcdir)/src/lib-imap \
 	-I$(top_srcdir)/src/lib-mail \
 	-I$(top_srcdir)/src/lib-storage
 
diff -r 5e92e1ed4e91 -r d57dcba5dd24 src/lib-lda/mail-deliver.c
--- a/src/lib-lda/mail-deliver.c	Mon Nov 09 20:57:40 2009 -0500
+++ b/src/lib-lda/mail-deliver.c	Mon Nov 09 21:03:15 2009 -0500
@@ -7,6 +7,7 @@
 #include "str-sanitize.h"
 #include "var-expand.h"
 #include "message-address.h"
+#include "imap-utf7.h"
 #include "lda-settings.h"
 #include "mail-storage.h"
 #include "mail-namespace.h"
@@ -135,6 +136,17 @@ mailbox_open_or_create_synced(struct mai
 		return NULL;
 	}
 	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 mail_deliver_save(struct mail_deliver_context *ctx, const char *mailbox,
@@ -158,7 +170,7 @@ int mail_deliver_save(struct mail_delive
 	if (default_save)
 		ctx->tried_default_save = TRUE;
 
-	mailbox_name = str_sanitize(mailbox, 80);
+	mailbox_name = mailbox_name_get_printable(mailbox);
 	box = mailbox_open_or_create_synced(ctx, mailbox, &ns, &errstr);
 	if (box == NULL) {
 		if (ns == NULL) {


More information about the dovecot-cvs mailing list