]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: "pager" formatter supports now DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 25 Oct 2016 17:51:36 +0000 (20:51 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 26 Oct 2016 10:10:37 +0000 (13:10 +0300)
src/doveadm/doveadm-print-pager.c

index 3a10997267003d57707a0967aa5161a5cb19aded..7c9e65d4556fa8c30bd55d65e1279e1285aa6941 100644 (file)
@@ -7,6 +7,7 @@
 
 struct doveadm_print_pager_header {
        const char *title;
+       enum doveadm_print_header_flags flags;
 };
 
 struct doveadm_print_pager_context {
@@ -26,6 +27,7 @@ doveadm_print_pager_header(const struct doveadm_print_header *hdr)
        struct doveadm_print_pager_header *fhdr;
 
        fhdr = array_append_space(&ctx->headers);
+       fhdr->flags = hdr->flags;
        fhdr->title = p_strdup(ctx->pool, hdr->title);
 }
 
@@ -45,8 +47,10 @@ static void doveadm_print_pager_print(const char *value)
                o_stream_nsend(doveadm_print_ostream, "\f\n", 2);
        }
        ctx->first_page = FALSE;
-       o_stream_nsend_str(doveadm_print_ostream, hdr->title);
-       o_stream_nsend(doveadm_print_ostream, ": ", 2);
+       if ((hdr->flags & DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE) == 0) {
+               o_stream_nsend_str(doveadm_print_ostream, hdr->title);
+               o_stream_nsend(doveadm_print_ostream, ": ", 2);
+       }
        o_stream_nsend_str(doveadm_print_ostream, value);
        o_stream_nsend(doveadm_print_ostream, "\n", 1);
        pager_next_hdr();
@@ -60,8 +64,10 @@ doveadm_print_pager_print_stream(const unsigned char *value, size_t size)
 
        if (!ctx->streaming) {
                ctx->streaming = TRUE;
-               o_stream_nsend_str(doveadm_print_ostream, hdr->title);
-               o_stream_nsend(doveadm_print_ostream, ":\n", 2);
+               if ((hdr->flags & DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE) == 0) {
+                       o_stream_nsend_str(doveadm_print_ostream, hdr->title);
+                       o_stream_nsend(doveadm_print_ostream, ":\n", 2);
+               }
        }
        o_stream_nsend(doveadm_print_ostream, value, size);
        if (size == 0) {