Mercurial > dovecot > core-2.2
changeset 11409:93eaae8617c8 HEAD
doveadm fetch: mailbox field value is printed as UTF-8, not mUTF-7.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 28 May 2010 12:22:46 +0100 |
parents | 15cda53f4e79 |
children | 2127b6e9096d |
files | src/doveadm/doveadm-mail-fetch.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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; }