]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm fetch hdr.*: Show the hdr.name prefix even if the header doestn't exist.
authorTimo Sirainen <tss@iki.fi>
Mon, 21 Jun 2010 16:23:25 +0000 (17:23 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 21 Jun 2010 16:23:25 +0000 (17:23 +0100)
--HG--
branch : HEAD

src/doveadm/doveadm-mail-fetch.c

index d1660b3115a9d01c79ce6c6bd9d1b20c9c41f234..5e54ec076551bce1a41f3fea12349cdfc20bb363 100644 (file)
@@ -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');