summaryrefslogtreecommitdiffstats
path: root/compose.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-02-07 10:15:22 -0800
committerKevin McCarthy <kevin@8t8.us>2016-02-07 10:15:22 -0800
commitbca31736a8bd296e747c10f812eabc8950c7e1e3 (patch)
treefa3b2c55d75f16b22dcb713459deefba06b239c3 /compose.c
parent346907218a3b945dc08ec4cf1a158d923fd33234 (diff)
Add new flag -E to modify draft/include file. (closes #3799)
Specifying -E with -i will cause mutt to directly edit the include file. Specifying -E with -H will cause the draft file to be regenerated from the latest version of the email on exit. Improve -H so that it will read (and write) multipart messages.
Diffstat (limited to 'compose.c')
-rw-r--r--compose.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/compose.c b/compose.c
index a0f9c4ac..6af817f2 100644
--- a/compose.c
+++ b/compose.c
@@ -483,9 +483,10 @@ static void compose_status_line (char *buf, size_t buflen, size_t col, MUTTMENU
* -1 abort message
*/
int mutt_compose_menu (HEADER *msg, /* structure for new message */
- char *fcc, /* where to save a copy of the message */
- size_t fcclen,
- HEADER *cur) /* current message */
+ char *fcc, /* where to save a copy of the message */
+ size_t fcclen,
+ HEADER *cur, /* current message */
+ int flags)
{
char helpstr[LONG_STRING];
char buf[LONG_STRING];
@@ -1159,20 +1160,25 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
case OP_EXIT:
if ((i = query_quadoption (OPT_POSTPONE, _("Postpone this message?"))) == M_NO)
{
- while (idxlen-- > 0)
- {
- /* avoid freeing other attachments */
- idx[idxlen]->content->next = NULL;
- idx[idxlen]->content->parts = NULL;
- if (idx[idxlen]->unowned)
- idx[idxlen]->content->unlink = 0;
- mutt_free_body (&idx[idxlen]->content);
- FREE (&idx[idxlen]->tree);
- FREE (&idx[idxlen]);
- }
- FREE (&idx);
- idxlen = 0;
- idxmax = 0;
+ for (i = 0; i < idxlen; i++)
+ if (idx[i]->unowned)
+ idx[i]->content->unlink = 0;
+
+ if (!(flags & M_COMPOSE_NOFREEHEADER))
+ {
+ while (idxlen-- > 0)
+ {
+ /* avoid freeing other attachments */
+ idx[idxlen]->content->next = NULL;
+ idx[idxlen]->content->parts = NULL;
+ mutt_free_body (&idx[idxlen]->content);
+ FREE (&idx[idxlen]->tree);
+ FREE (&idx[idxlen]);
+ }
+ FREE (&idx);
+ idxlen = 0;
+ idxmax = 0;
+ }
r = -1;
loop = 0;
break;