From 200144b6213bfdd12ecfbe74183c07cc850ae09f Mon Sep 17 00:00:00 2001 From: Derek Schrock Date: Sun, 20 Sep 2015 20:37:47 -0400 Subject: [PATCH] Add new optional index_format expandos %r and %R. These generate a comma separated list of all the To and Cc recipients. Also, increase the attribution buffer size to accommodate these new expandos. --- UPDATING | 4 ++++ hdrline.c | 18 ++++++++++++++++++ init.h | 2 ++ send.c | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 44a36efc..f05478ea 100644 --- a/UPDATING +++ b/UPDATING @@ -4,6 +4,10 @@ mutt. Please read this file carefully when upgrading your installation. The keys used are: !: modified feature, -: deleted feature, +: new feature +default (unreleased): + + New expandos %r and %R for comma separated list of To: and Cc: + recipients respectively + 1.5.24 (2015-08-31): + terminal status-line (TS) support, a.k.a. xterm title. see the diff --git a/hdrline.c b/hdrline.c index 21adc282..b844411e 100644 --- a/hdrline.c +++ b/hdrline.c @@ -219,6 +219,8 @@ int mutt_user_is_recipient (HEADER *h) * %N = score * %O = like %L, except using address instead of name * %P = progress indicator for builtin pager + * %r = comma separated list of To: recipients + * %R = comma separated list of Cc: recipients * %s = subject * %S = short message status (e.g., N/O/D/!/r/-) * %t = `to:' field (recipients) @@ -548,6 +550,22 @@ hdr_format_str (char *dest, strfcpy(dest, NONULL(hfi->pager_progress), destlen); break; + case 'r': + buf2[0] = 0; + rfc822_write_address(buf2, sizeof(buf2), hdr->env->to, 1); + if (optional && buf2[0] == '\0') + optional = 0; + mutt_format_s (dest, destlen, prefix, buf2); + break; + + case 'R': + buf2[0] = 0; + rfc822_write_address(buf2, sizeof(buf2), hdr->env->cc, 1); + if (optional && buf2[0] == '\0') + optional = 0; + mutt_format_s (dest, destlen, prefix, buf2); + break; + case 's': if (flags & M_FORMAT_TREE && !hdr->collapsed) diff --git a/init.h b/init.h index 569f91e6..60686033 100644 --- a/init.h +++ b/init.h @@ -1311,6 +1311,8 @@ struct option_t MuttVars[] = { ** stashed the message: list name or recipient name ** if not sent to a list ** .dt %P .dd progress indicator for the built-in pager (how much of the file has been displayed) + ** .dt %r .dd comma separated list of ``To:'' recipients + ** .dt %R .dd comma separated list of ``Cc:'' recipients ** .dt %s .dd subject of the message ** .dt %S .dd status of the message (``N''/``D''/``d''/``!''/``r''/\(as) ** .dt %t .dd ``To:'' field (recipients) diff --git a/send.c b/send.c index 0c8714d9..d5a61fb0 100644 --- a/send.c +++ b/send.c @@ -398,7 +398,7 @@ static int include_forward (CONTEXT *ctx, HEADER *cur, FILE *out) void mutt_make_attribution (CONTEXT *ctx, HEADER *cur, FILE *out) { - char buffer[STRING]; + char buffer[LONG_STRING]; if (Attribution) { mutt_make_string (buffer, sizeof (buffer), Attribution, ctx, cur); -- 2.40.0