--- mutt-1.5.6/PATCHES~ never +++ mutt-1.5.6/PATCHES Fri Jun 18 00:32:20 CDT 2004 @@ -1,0 +1 @@ +patch-1.5.6.dgc.attachprompt.1 diff -ur mutt-1.5.6-base/headers.c mutt-1.5.6-attachprompt/headers.c --- mutt-1.5.6-base/headers.c Tue Mar 4 01:49:45 2003 +++ mutt-1.5.6-attachprompt/headers.c Fri Jun 18 00:28:49 2004 @@ -49,6 +49,12 @@ mutt_env_to_local (msg->env); mutt_write_rfc822_header (ofp, msg->env, NULL, 1, 0); + + if (option(OPTATTACHASK) == M_YES) + fprintf(ofp, "Attach: ask\n"); + else if (option(OPTATTACHEDIT) == M_YES) + fprintf(ofp, "Attach: \n"); + fputc ('\n', ofp); /* tie off the header. */ /* now copy the body of the message. */ @@ -151,7 +157,44 @@ p = cur->data + 7; SKIPWS (p); - if (*p) + + if (!ascii_strcasecmp(p, _("ask")) || !ascii_strcasecmp(p, _("yes"))) + { + char **files; + int error, nfiles, redraw; + + path[0] = '\0'; + nfiles = 0; + error = 0; + if (_mutt_enter_fname (_("Attach file"), path, sizeof(path), &redraw, 0, 1, &files, &nfiles) == -1 || + *path == '\0') + break; + + if (nfiles > 1) + mutt_message _("Attaching selected files..."); + + for (i = 0; i < nfiles; ++i) + { + strfcpy (path, files[i], sizeof (path)); + mutt_expand_path (path, sizeof (path)); + body = mutt_make_file_attach(files[i]); + if (body == NULL) + { + error = 1; + mutt_error (_("Unable to attach %s!"), files[i]); + } + + body->description = safe_strdup (files[i]); + for (parts = msg->content; parts->next; parts = parts->next); + parts->next = body; + } + + FREE(&files); + if (!error) + mutt_clear_error(); + } + + else if (*p) { if ((q = strpbrk (p, " \t"))) { diff -ur mutt-1.5.6-base/init.h mutt-1.5.6-attachprompt/init.h --- mutt-1.5.6-base/init.h Sun Feb 1 11:15:17 2004 +++ mutt-1.5.6-attachprompt/init.h Fri Jun 18 00:30:07 2004 @@ -184,6 +184,25 @@ ** If set, Mutt will prompt you for carbon-copy (Cc) recipients before ** editing the body of an outgoing message. */ + { "attach_ask", DT_BOOL, R_NONE, OPTATTACHASK, 0 }, + /* + ** .pp + ** If ``$$attach_ask'' is set, the default value for the Attach: + ** header (see ``$$attach_edit'') is ``ask''. If it is unset, the + ** Attach: header is left blank by default. + */ + { "attach_edit", DT_BOOL, R_NONE, OPTATTACHEDIT, 0 }, + /* + ** .pp + ** When ``$$edit_headers'' and ``$$attach_edit'' are both set, an + ** Attach: header will be included among editable headers. Here you + ** can specify a filename to be attached when you're done editing. + ** If the value of the Attach: header is a filename, that file will + ** be attached. If it is blank, no file will be attached. If the + ** header is set to ``ask'' or ``yes'', you will be prompted for an + ** attachment after saving your draft, and before proceeding to the + ** compose menu. See also ``$$attach_ask''. + */ { "attach_format", DT_STR, R_NONE, UL &AttachFormat, UL "%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " }, /* ** .pp diff -ur mutt-1.5.6-base/mutt.h mutt-1.5.6-attachprompt/mutt.h --- mutt-1.5.6-base/mutt.h Sun Feb 1 11:15:17 2004 +++ mutt-1.5.6-attachprompt/mutt.h Fri Jun 18 00:30:24 2004 @@ -322,6 +322,8 @@ OPTASCIICHARS, OPTASKBCC, OPTASKCC, + OPTATTACHASK, + OPTATTACHEDIT, OPTATTACHSPLIT, OPTAUTOEDIT, OPTAUTOTAG,