From: Timo Sirainen Date: Fri, 16 Jan 2015 22:32:10 +0000 (+0200) Subject: doveadm fetch: Added body.snippet field. X-Git-Tag: 2.2.16.rc1~146 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed897f9e09ae8ad86a88955420bd275b46ee8231;p=thirdparty%2Fdovecot%2Fcore.git doveadm fetch: Added body.snippet field. --- diff --git a/src/doveadm/doveadm-mail-fetch.c b/src/doveadm/doveadm-mail-fetch.c index b456511ddb..5a4828a124 100644 --- a/src/doveadm/doveadm-mail-fetch.c +++ b/src/doveadm/doveadm-mail-fetch.c @@ -199,6 +199,18 @@ static int fetch_body(struct fetch_cmd_context *ctx) return doveadm_print_istream(input); } +static int fetch_body_snippet(struct fetch_cmd_context *ctx) +{ + const char *value; + + if (mail_get_special(ctx->mail, MAIL_FETCH_BODY_SNIPPET, &value) < 0) + return -1; + /* [0] contains the snippet algorithm, skip over it */ + i_assert(value[0] != '\0'); + doveadm_print(value + 1); + return 0; +} + static int fetch_text(struct fetch_cmd_context *ctx) { struct istream *input; @@ -376,6 +388,7 @@ static const struct fetch_field fetch_fields[] = { { "modseq", 0, fetch_modseq }, { "hdr", MAIL_FETCH_STREAM_HEADER, fetch_hdr }, { "body", MAIL_FETCH_STREAM_BODY, fetch_body }, + { "body.snippet", MAIL_FETCH_BODY_SNIPPET, fetch_body_snippet }, { "text", MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY, fetch_text }, { "text.utf8", MAIL_FETCH_STREAM_HEADER |