From: Timo Sirainen Date: Mon, 21 Jun 2010 16:23:25 +0000 (+0100) Subject: doveadm fetch hdr.*: Show the hdr.name prefix even if the header doestn't exist. X-Git-Tag: 2.0.rc1~116 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a0db7ab8abd184559a3c2864e9f18d8e154cedcb;p=thirdparty%2Fdovecot%2Fcore.git doveadm fetch hdr.*: Show the hdr.name prefix even if the header doestn't exist. --HG-- branch : HEAD --- diff --git a/src/doveadm/doveadm-mail-fetch.c b/src/doveadm/doveadm-mail-fetch.c index d1660b3115..5e54ec0765 100644 --- a/src/doveadm/doveadm-mail-fetch.c +++ b/src/doveadm/doveadm-mail-fetch.c @@ -145,6 +145,13 @@ static int fetch_hdr_field(struct fetch_cmd_context *ctx) if (mail_get_headers(ctx->mail, ctx->cur_field->name, &value) < 0) return -1; + if (*value == NULL) { + /* no value */ + if (ctx->print_field_prefix) + str_printfa(ctx->hdr, "hdr.%s: ", ctx->cur_field->name); + return 0; + } + for (; *value != NULL; value++) { if (add_lf) str_append_c(ctx->hdr, '\n');