dovecot-2.0: doveadm fetch: mailbox field value is printed as UT...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 28 14:25:07 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/93eaae8617c8
changeset: 11409:93eaae8617c8
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 28 12:22:46 2010 +0100
description:
doveadm fetch: mailbox field value is printed as UTF-8, not mUTF-7.

diffstat:

 src/doveadm/doveadm-mail-fetch.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 15cda53f4e79 -r 93eaae8617c8 src/doveadm/doveadm-mail-fetch.c
--- a/src/doveadm/doveadm-mail-fetch.c	Fri May 28 12:21:58 2010 +0100
+++ b/src/doveadm/doveadm-mail-fetch.c	Fri May 28 12:22:46 2010 +0100
@@ -8,6 +8,7 @@
 #include "randgen.h"
 #include "str.h"
 #include "message-size.h"
+#include "imap-utf7.h"
 #include "imap-util.h"
 #include "mail-storage.h"
 #include "mail-search.h"
@@ -43,10 +44,17 @@
 static int fetch_mailbox(struct fetch_cmd_context *ctx)
 {
 	const char *value;
+	unsigned int len;
 
 	if (mail_get_special(ctx->mail, MAIL_FETCH_MAILBOX_NAME, &value) < 0)
 		return -1;
-	str_append(ctx->hdr, value);
+
+	len = str_len(ctx->hdr);
+	if (imap_utf7_to_utf8(value, ctx->hdr) < 0) {
+		/* not a valid mUTF-7 name, fallback to showing it as-is */
+		str_truncate(ctx->hdr, len);
+		str_append(ctx->hdr, value);
+	}
 	return 0;
 }
 


More information about the dovecot-cvs mailing list