Hi, long time ago I wrote a patch set for the following enhancement request:
https://dev.mutt.org/trac/ticket/2976 https://dev.mutt.org/trac/ticket/3244 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532766 and sent it to Michael Elkins for feedback. After one review round, the discussion did not continue and the patch set was never applied. I am sending it now to the list, in case you think that this enhancement is sensible. The patches are against mutt tip. Emanuele
# HG changeset patch # User Emanuele Giaquinta <[email protected]> # Date 1469192123 -10800 # Fri Jul 22 15:55:23 2016 +0300 # Node ID d1517026b936bd5a4edb61fb66ad9b023a818b2b # Parent 81ecc31f819792a2044ccde58d74ce5bd898acc0 On message copy, write Status header only if the format of the destination mailbox is mbox or mmdf. diff -r 81ecc31f8197 -r d1517026b936 copy.c --- a/copy.c Thu Jul 21 14:00:24 2016 -0700 +++ b/copy.c Fri Jul 22 15:55:23 2016 +0300 @@ -722,8 +722,9 @@ if ((msg = mx_open_new_message (dest, hdr, is_from (buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM)) == NULL) return -1; if (dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF) - chflags |= CH_FROM | CH_FORCE_FROM; - chflags |= (dest->magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE); + chflags |= CH_FROM | CH_FORCE_FROM | CH_UPDATE; + else + chflags |= CH_NOSTATUS; r = _mutt_copy_message (msg->fp, fpin, hdr, body, flags, chflags); if (mx_commit_message (msg, dest) != 0) r = -1;
# HG changeset patch # User Emanuele Giaquinta <[email protected]> # Date 1469192183 -10800 # Fri Jul 22 15:56:23 2016 +0300 # Node ID d13a744261943b2987dae8b284efcf5b5bcd8aef # Parent d1517026b936bd5a4edb61fb66ad9b023a818b2b Make _mutt_copy_message work correctly when there are deleted attachments and CH_UPDATE_LEN is not set. diff -r d1517026b936 -r d13a74426194 copy.c --- a/copy.c Fri Jul 22 15:55:23 2016 +0300 +++ b/copy.c Fri Jul 22 15:56:23 2016 +0300 @@ -499,7 +499,7 @@ if (flags & MUTT_CM_PREFIX) chflags |= CH_PREFIX; - else if (hdr->attach_del && (chflags & CH_UPDATE_LEN)) + else if (hdr->attach_del) { int new_lines; LOFF_T new_length = body->length; @@ -517,11 +517,14 @@ if (mutt_copy_header (fpin, hdr, fpout, chflags | CH_NOLEN | CH_NONEWLINE, NULL)) return -1; - fprintf (fpout, "Content-Length: " OFF_T_FMT "\n", new_length); if (new_lines <= 0) new_lines = 0; - else - fprintf (fpout, "Lines: %d\n", new_lines); + if (chflags & CH_UPDATE_LEN) + { + fprintf (fpout, "Content-Length: " OFF_T_FMT "\n", new_length); + if (new_lines > 0) + fprintf (fpout, "Lines: %d\n", new_lines); + } putc ('\n', fpout); if (ferror (fpout) || feof (fpout))
# HG changeset patch # User Emanuele Giaquinta <[email protected]> # Date 1469192268 -10800 # Fri Jul 22 15:57:48 2016 +0300 # Node ID bc404a9ddb16beadc27ba21e2de2a9c457ca66be # Parent d13a744261943b2987dae8b284efcf5b5bcd8aef Add 'write_lines' option to suppress writing of Lines header on message copy. The option is not honored for mbox/mmdf formats. diff -r d13a74426194 -r bc404a9ddb16 commands.c --- a/commands.c Fri Jul 22 15:56:23 2016 +0300 +++ b/commands.c Fri Jul 22 15:57:48 2016 +0300 @@ -662,7 +662,6 @@ static void set_copy_flags (HEADER *hdr, int decode, int decrypt, int *cmflags, int *chflags) { *cmflags = 0; - *chflags = CH_UPDATE_LEN; if (WithCrypto && !decode && decrypt && (hdr->security & ENCRYPT)) { @@ -706,6 +705,10 @@ int cmflags, chflags; int rc; + if (ctx->magic == M_MBOX || ctx->magic == M_MMDF || option(OPTWRITELINES)) + chflags = CH_UPDATE_LEN; + else + chflags = CH_NOLEN; set_copy_flags (h, decode, decrypt, &cmflags, &chflags); if (decode || decrypt) diff -r d13a74426194 -r bc404a9ddb16 init.h --- a/init.h Fri Jul 22 15:56:23 2016 +0300 +++ b/init.h Fri Jul 22 15:57:48 2016 +0300 @@ -3755,6 +3755,12 @@ {"xterm_set_titles", DT_SYN, R_NONE, UL "ts_enabled", 0 }, /* */ + { "write_lines", DT_BOOL, R_NONE, UL OPTWRITELINES, 1 }, + /* + ** .pp + ** Controls whether mutt writes out the ``Lines:'' header when copying + ** a message. + */ /*--*/ { NULL, 0, 0, 0, 0 } }; diff -r d13a74426194 -r bc404a9ddb16 mutt.h --- a/mutt.h Fri Jul 22 15:56:23 2016 +0300 +++ b/mutt.h Fri Jul 22 15:57:48 2016 +0300 @@ -467,6 +467,7 @@ OPTWRAP, OPTWRAPSEARCH, OPTWRITEBCC, /* write out a bcc header? */ + OPTWRITELINES, OPTXMAILER, OPTCRYPTUSEGPGME,
