]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm dump: Show body.snippet in human-readable form
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 19 Feb 2018 13:38:13 +0000 (15:38 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 20 Feb 2018 08:21:02 +0000 (10:21 +0200)
src/doveadm/doveadm-dump-index.c

index fa318e00e174480b20041378a29eae253409f637..05fd58c504aa6748bc0ba2ed39f22214b77779ef 100644 (file)
@@ -511,6 +511,16 @@ dump_cache_mime_parts(string_t *str, const void *data, unsigned int size)
        dump_message_part(str, part);
 }
 
+static void
+dump_cache_snippet(string_t *str, const unsigned char *data, unsigned int size)
+{
+       if (size == 0)
+               return;
+       str_printfa(str, " (version=%u: ", data[0]);
+       str_append_n(str, data+1, size-1);
+       str_append_c(str, ')');
+}
+
 static void dump_cache(struct mail_cache_view *cache_view, unsigned int seq)
 {
        struct mail_cache_lookup_iterate_ctx iter;
@@ -555,6 +565,8 @@ static void dump_cache(struct mail_cache_view *cache_view, unsigned int seq)
                        str_printfa(str, "(%s)", binary_to_hex(data, size));
                        if (strcmp(field->name, "mime.parts") == 0)
                                dump_cache_mime_parts(str, data, size);
+                       else if (strcmp(field->name, "body.snippet") == 0)
+                               dump_cache_snippet(str, data, size);
                        break;
                case MAIL_CACHE_FIELD_STRING:
                        if (size > 0)