dovecot-2.2: doveadm mail fetch: Use mail_get_headers_utf8() whe...
dovecot at dovecot.org
dovecot at dovecot.org
Mon May 5 13:03:33 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/63361f087d1f
changeset: 17320:63361f087d1f
user: Timo Sirainen <tss at iki.fi>
date: Mon May 05 16:00:52 2014 +0300
description:
doveadm mail fetch: Use mail_get_headers_utf8() when fetching hdr.*.utf8
This doesn't really matter but may allow minor optimizations later.
diffstat:
src/doveadm/doveadm-mail-fetch.c | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diffs (41 lines):
diff -r cc622a9a2f3c -r 63361f087d1f src/doveadm/doveadm-mail-fetch.c
--- a/src/doveadm/doveadm-mail-fetch.c Mon May 05 15:39:58 2014 +0300
+++ b/src/doveadm/doveadm-mail-fetch.c Mon May 05 16:00:52 2014 +0300
@@ -140,15 +140,19 @@
{
const char *const *value, *filter, *name = ctx->cur_field->name;
string_t *str = t_str_new(256);
- unsigned int pos;
bool add_lf = FALSE;
filter = strchr(name, '.');
if (filter != NULL)
name = t_strdup_until(name, filter++);
- if (mail_get_headers(ctx->mail, name, &value) < 0)
- return -1;
+ if (filter != NULL && strcmp(filter, "utf8") == 0) {
+ if (mail_get_headers_utf8(ctx->mail, name, &value) < 0)
+ return -1;
+ } else {
+ if (mail_get_headers(ctx->mail, name, &value) < 0)
+ return -1;
+ }
for (; *value != NULL; value++) {
if (add_lf)
@@ -157,13 +161,8 @@
add_lf = TRUE;
}
- if (filter == NULL) {
+ if (filter == NULL || strcmp(filter, "utf8") == 0) {
/* print the header as-is */
- } else if (strcmp(filter, "utf8") == 0) {
- pos = str_len(str);
- message_header_decode_utf8(str_data(str), str_len(str),
- str, FALSE);
- str_delete(str, 0, pos);
} else if (strcmp(filter, "address") == 0 ||
strcmp(filter, "address_name") == 0 ||
strcmp(filter, "address_name.utf8") == 0) {
More information about the dovecot-cvs
mailing list