2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4 * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
6 * This file is part of mutt-ng, see http://www.muttng.org/.
7 * It's licensed under the GNU General Public License,
8 * please see the file GPL in the top level source directory.
11 #include <lib-lib/lib-lib.h>
13 #include <lib-mime/mime.h>
14 #include <lib-sys/unix.h>
16 #include <lib-ui/lib-ui.h>
17 #include <lib-ui/menu.h>
18 #include <lib-mx/mx.h>
23 #include "recvattach.h"
27 void mutt_update_tree (ATTACHPTR ** idx, short idxlen)
33 for (x = 0; x < idxlen; x++) {
35 if (2 * (idx[x]->level + 2) < ssizeof (buf)) {
37 s = buf + 2 * (idx[x]->level - 1);
38 *s++ = (idx[x]->content->next) ? M_TREE_LTEE : M_TREE_LLCORNER;
48 if (m_strcmp(idx[x]->tree, buf) != 0)
49 m_strreplace(&idx[x]->tree, buf);
52 idx[x]->tree = m_strdup(buf);
54 if (2 * (idx[x]->level + 2) < ssizeof (buf) && idx[x]->level) {
55 s = buf + 2 * (idx[x]->level - 1);
56 *s++ = (idx[x]->content->next) ? '\005' : '\006';
62 ATTACHPTR **mutt_gen_attach_list (BODY * m,
66 short *idxmax, int level, int compose)
71 for (; m; m = m->next) {
72 if (*idxlen == *idxmax) {
73 p_realloc(&idx, (*idxmax) += 5);
74 for (i = *idxlen; i < *idxmax; i++)
78 if (m->type == TYPEMULTIPART && m->parts
81 && ascii_strcasecmp ("alternative", m->subtype)))
82 && (!mutt_is_multipart_encrypted (m))
85 mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax, level,
90 idx[*idxlen] = p_new(ATTACHPTR, 1);
92 new = idx[(*idxlen)++];
95 new->parent_type = parent_type;
98 /* We don't support multipart messages in the compose menu yet */
99 if (!compose && !m->collapsed
100 && ((m->type == TYPEMULTIPART && !mutt_is_multipart_encrypted(m))
101 || mutt_is_message_type(m)))
103 idx = mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax,
110 mutt_update_tree (idx, *idxlen);
115 /* %c = character set: convert?
119 * %e = MIME content-transfer-encoding
121 * %I = content-disposition, either I (inline) or A (attachment)
124 * %m = major MIME type
126 * %n = attachment number
131 mutt_attach_fmt(char *dest, ssize_t destlen, char op, const char *src,
132 const char *prefix, const char *ifstr, const char *elstr,
133 anytype data, format_flag flags)
137 char charset[STRING];
138 ATTACHPTR *aptr = data.ptr;
139 int optional = (flags & M_FORMAT_OPTIONAL);
145 if (mutt_is_text_part (aptr->content) &&
146 mutt_get_body_charset (charset, sizeof (charset), aptr->content))
147 mutt_format_s (dest, destlen, prefix, charset);
149 mutt_format_s (dest, destlen, prefix, "");
151 else if (!mutt_is_text_part (aptr->content) ||
152 !mutt_get_body_charset (charset, sizeof (charset),
159 snprintf (fmt, sizeof (fmt), "%%%sc", prefix);
160 snprintf (dest, destlen, fmt, aptr->content->type != TYPETEXT ||
161 aptr->content->noconv ? 'n' : 'c');
163 else if (aptr->content->type != TYPETEXT || aptr->content->noconv)
168 if (aptr->content->description) {
169 mutt_format_s (dest, destlen, prefix, aptr->content->description);
172 if (mutt_is_message_type(aptr->content) && MsgFmt && aptr->content->hdr)
176 _mutt_make_string (s, sizeof (s), MsgFmt, NULL, aptr->content->hdr,
177 M_FORMAT_FORCESUBJ | M_FORMAT_MAKEPRINT);
179 mutt_format_s (dest, destlen, prefix, s);
183 if (!aptr->content->filename) {
184 mutt_format_s (dest, destlen, prefix, "<no description>");
188 else if (aptr->content->description ||
189 (mutt_is_message_type(aptr->content)
190 && MsgFmt && aptr->content->hdr))
192 /* FALLS THROUGH TO 'f' */
195 if (aptr->content->filename && *aptr->content->filename == '/') {
196 char path[_POSIX_PATH_MAX];
198 m_strcpy(path, sizeof(path), aptr->content->filename);
199 mutt_pretty_mailbox (path);
200 mutt_format_s (dest, destlen, prefix, path);
203 mutt_format_s (dest, destlen, prefix,
204 NONULL (aptr->content->filename));
206 else if (!aptr->content->filename)
211 snprintf (dest, destlen, "%c", aptr->content->deleted ? 'D' : ' ');
212 else if (!aptr->content->deleted)
217 mutt_format_s (dest, destlen, prefix,
218 ENCODING (aptr->content->encoding));
222 snprintf (dest, destlen, "%c",
223 (aptr->content->disposition == DISPINLINE) ? 'I' : 'A');
228 mutt_format_s (dest, destlen, prefix, TYPE (aptr->content));
232 mutt_format_s (dest, destlen, prefix, aptr->content->subtype);
233 else if (!aptr->content->subtype)
238 snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
239 snprintf (dest, destlen, fmt, aptr->num + 1);
244 optional = aptr->content->attach_qualifies;
246 snprintf (fmt, sizeof (fmt), "%%%sc", prefix);
247 mutt_format_s (dest, destlen, fmt, "Q");
251 if (flags & M_FORMAT_STAT_FILE) {
254 stat (aptr->content->filename, &st);
258 l = aptr->content->length;
261 mutt_pretty_size (tmp, sizeof (tmp), l);
262 mutt_format_s (dest, destlen, prefix, tmp);
270 snprintf (dest, destlen, "%c", aptr->content->tagged ? '*' : ' ');
271 else if (!aptr->content->tagged)
276 mutt_format_s_tree (dest, destlen, prefix, NONULL (aptr->tree));
277 else if (!aptr->tree)
282 snprintf (dest, destlen, "%c", aptr->content->unlink ? '-' : ' ');
283 else if (!aptr->content->unlink)
288 optional = (aptr->content->attach_count + aptr->content->attach_qualifies) != 0;
290 snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
291 snprintf (dest, destlen, fmt, aptr->content->attach_count + aptr->content->attach_qualifies);
298 if (flags & M_FORMAT_OPTIONAL)
299 m_strformat(dest, destlen, 0, optional ? ifstr : elstr,
300 mutt_attach_fmt, data, 0);
304 static void attach_entry(char *b, ssize_t blen, MUTTMENU * menu, int num)
306 m_strformat(b, blen, getmaxx(main_w), AttachFormat, mutt_attach_fmt,
307 ((ATTACHPTR **) menu->data)[num], 0);
310 int mutt_tag_attach (MUTTMENU * menu, int n, int m)
312 BODY *cur = ((ATTACHPTR **) menu->data)[n]->content;
313 int ot = cur->tagged;
315 cur->tagged = (m >= 0 ? m : !cur->tagged);
316 return cur->tagged - ot;
319 static int mutt_query_save_attachment (FILE * fp, BODY * body, HEADER * hdr,
323 char buf[_POSIX_PATH_MAX], tfile[_POSIX_PATH_MAX];
329 if (body->filename) {
330 if (directory && *directory)
331 mutt_concat_path(buf, sizeof(buf), *directory,
332 mutt_basename(body->filename));
334 m_strcpy(buf, sizeof(buf), body->filename);
336 else if (body->hdr &&
337 body->encoding != ENCBASE64 &&
338 body->encoding != ENCQUOTEDPRINTABLE &&
339 mutt_is_message_type(body))
340 mutt_default_save (buf, sizeof (buf), body->hdr);
344 prompt = _("Save to file ('#' for last used folder): ");
346 static char LastSaveFolder[_POSIX_PATH_MAX] = ".";
348 ret = mutt_get_field(prompt, buf, sizeof (buf),
349 M_FILE | M_CLEAR | M_LASTFOLDER);
350 if (((ret != 0) && (ret != 2)) || (!buf[0] && ret != 2))
354 char tmpbuf[_POSIX_PATH_MAX];
356 snprintf (tmpbuf, sizeof (tmpbuf), "%s/%s", LastSaveFolder, buf);
357 m_strcpy(buf, sizeof(buf), tmpbuf);
358 ret = mutt_get_field(_("Save to file: "), buf, sizeof (buf), M_FILE);
359 if ((ret != 0) || (!buf[0]))
362 m_dirname(LastSaveFolder, sizeof(LastSaveFolder), buf);
365 mutt_expand_path(buf, sizeof(buf));
367 is_message = (fp && body->hdr &&
368 body->encoding != ENCBASE64 &&
369 body->encoding != ENCQUOTEDPRINTABLE &&
370 mutt_is_message_type(body));
375 /* check to make sure that this file is really the one the user wants */
376 rc = mutt_save_confirm(buf, &st);
377 m_strcpy(tfile, sizeof(tfile), buf);
379 rc = mutt_check_overwrite(body->filename, buf, tfile, sizeof(tfile),
385 prompt = _("Save to file: ");
389 mutt_message _("Saving...");
391 if (mutt_save_attachment(fp, body, tfile, append,
392 (hdr || !is_message) ? hdr : body->hdr) == 0)
394 mutt_message _("Attachment saved.");
397 prompt = _("Save to file: ");
404 void mutt_save_attachment_list (FILE * fp, int tag, BODY * top, HEADER * hdr,
407 char buf[_POSIX_PATH_MAX], tfile[_POSIX_PATH_MAX];
408 char *directory = NULL;
410 int last = menu ? menu->current : -1;
415 for (; top; top = top->next) {
416 if (!tag || top->tagged) {
417 if (!option (OPTATTACHSPLIT)) {
421 m_strcpy(buf, sizeof(buf), NONULL(top->filename));
422 if (mutt_get_field (_("Save to file: "), buf, sizeof (buf),
423 M_FILE | M_CLEAR) != 0 || !buf[0])
425 mutt_expand_path (buf, sizeof (buf));
426 if (mutt_check_overwrite (top->filename, buf, tfile,
427 sizeof (tfile), &append, NULL))
429 rc = mutt_save_attachment (fp, top, tfile, append, hdr);
430 if (rc == 0 && AttachSep && (fpout = fopen (tfile, "a")) != NULL) {
431 fprintf (fpout, "%s", AttachSep);
436 rc = mutt_save_attachment (fp, top, tfile, M_SAVE_APPEND, hdr);
437 if (rc == 0 && AttachSep && (fpout = fopen (tfile, "a")) != NULL) {
438 fprintf (fpout, "%s", AttachSep);
443 if (tag && menu && top->aptr) {
444 menu->oldcurrent = menu->current;
445 menu->current = top->aptr->num;
446 menu_check_recenter (menu);
447 menu->redraw |= REDRAW_MOTION;
451 if (mutt_query_save_attachment (fp, top, hdr, &directory) == -1)
456 mutt_save_attachment_list (fp, 1, top->parts, hdr, menu);
461 p_delete(&directory);
464 menu->oldcurrent = menu->current;
465 menu->current = last;
466 menu_check_recenter (menu);
467 menu->redraw |= REDRAW_MOTION;
470 if (!option (OPTATTACHSPLIT) && (rc == 0))
471 mutt_message _("Attachment saved.");
475 mutt_query_pipe_attachment(char *command, FILE * fp, BODY * body, int afilter)
477 char tfile[_POSIX_PATH_MAX];
478 char warning[STRING + _POSIX_PATH_MAX];
482 snprintf(warning, sizeof (warning),
483 _("WARNING! You are about to overwrite %s, continue?"),
485 if (mutt_yesorno (warning, M_NO) != M_YES)
487 tempfd = m_tempfd(tfile, sizeof(tfile), NONULL(mod_core.tmpdir), NULL);
490 if (mutt_pipe_attachment(fp, body, command, tempfd)) {
492 mutt_unlink (body->filename);
493 mutt_rename_file (tfile, body->filename);
494 mutt_update_encoding (body);
495 mutt_message _("Attachment filtered.");
497 } else if (afilter) {
503 static void pipe_attachment (FILE * fp, BODY * b, STATE * state)
509 mutt_decode_attachment (b, state);
511 state_puts (AttachSep, state);
513 if ((ifp = fopen (b->filename, "r")) == NULL) {
514 mutt_perror ("fopen");
517 mutt_copy_stream (ifp, state->fpout);
520 state_puts (AttachSep, state);
525 pipe_attachment_list (char *command, FILE * fp, int tag, BODY * top,
526 int afilter, STATE * state)
528 for (; top; top = top->next) {
529 if (!tag || top->tagged) {
530 if (!afilter && !option (OPTATTACHSPLIT))
531 pipe_attachment (fp, top, state);
533 mutt_query_pipe_attachment (command, fp, top, afilter);
536 pipe_attachment_list (command, fp, tag, top->parts, afilter, state);
542 void mutt_pipe_attachment_list (FILE * fp, int tag, BODY * top, int afilter)
549 afilter = 0; /* sanity check: we can't filter in the recv case yet */
554 if (mutt_get_field ((afilter ? _("Filter through: ") : _("Pipe to: ")),
555 buf, sizeof (buf), M_CMD) != 0 || !buf[0])
558 mutt_expand_path (buf, sizeof (buf));
560 if (!afilter && !option (OPTATTACHSPLIT)) {
562 thepid = mutt_create_filter (buf, &state.fpout, NULL, NULL);
563 pipe_attachment_list (buf, fp, tag, top, afilter, &state);
564 m_fclose(&state.fpout);
565 if (mutt_wait_filter (thepid) != 0 || option (OPTWAITKEY))
566 mutt_any_key_to_continue (NULL);
568 pipe_attachment_list (buf, fp, tag, top, afilter, &state);
572 static int can_print(BODY * top, int tag)
574 for (; top; top = top->next) {
576 int tok = mime_which_token(top->subtype, -1);
578 snprintf(type, sizeof(type), "%s/%s", TYPE(top), top->subtype);
580 if (!tag || top->tagged) {
581 if (!rfc1524_mailcap_lookup(top, type, NULL, M_PRINT)
582 && !(top->type == TYPETEXT && tok == MIME_PLAIN)
583 && !(top->type == TYPEAPPLICATION && tok == MIME_POSTSCRIPT)
584 && !mutt_can_decode(top))
586 mutt_error(_("I dont know how to print %s attachments!"), type);
591 return (can_print(top->parts, tag));
598 static void print_attachment_list (FILE * fp, int tag, BODY * top,
603 for (; top; top = top->next) {
604 if (!tag || top->tagged) {
605 int tok = mime_which_token(top->subtype, -1);
607 snprintf (type, sizeof (type), "%s/%s", TYPE (top), top->subtype);
608 if (!option (OPTATTACHSPLIT)
609 && !rfc1524_mailcap_lookup (top, type, NULL, M_PRINT)) {
610 if ((top->type == TYPETEXT && tok == MIME_PLAIN)
611 || (top->type == TYPEAPPLICATION && tok == MIME_POSTSCRIPT)) {
612 pipe_attachment (fp, top, state);
614 if (mutt_can_decode (top)) {
615 /* decode and print */
617 char newfile[_POSIX_PATH_MAX] = "";
621 newfile_fd = m_tempfd(newfile, sizeof(newfile), NONULL(mod_core.tmpdir), NULL);
622 if (mutt_decode_save_attachment (fp, top, newfile_fd, M_PRINTING) == 0) {
623 if ((ifp = fopen (newfile, "r")) != NULL) {
624 mutt_copy_stream (ifp, state->fpout);
627 state_puts (AttachSep, state);
630 mutt_unlink (newfile);
633 mutt_print_attachment(fp, top);
637 print_attachment_list (fp, tag, top->parts, state);
643 void mutt_print_attachment_list (FILE * fp, int tag, BODY * top)
649 if (query_quadoption(OPT_PRINT,
650 tag ? _("Print tagged attachment(s)?") : _("Print attachment?")) !=
654 if (!option (OPTATTACHSPLIT)) {
655 if (!can_print (top, tag))
659 thepid = mutt_create_filter (NONULL (PrintCmd), &state.fpout, NULL, NULL);
660 print_attachment_list (fp, tag, top, &state);
661 m_fclose(&state.fpout);
662 if (mutt_wait_filter (thepid) != 0 || option (OPTWAITKEY))
663 mutt_any_key_to_continue (NULL);
666 print_attachment_list (fp, tag, top, &state);
670 mutt_update_attach_index (BODY * cur, ATTACHPTR *** idxp,
671 short *idxlen, short *idxmax, MUTTMENU * menu)
673 ATTACHPTR **idx = *idxp;
675 while (--(*idxlen) >= 0)
676 idx[(*idxlen)]->content = NULL;
679 idx = *idxp = mutt_gen_attach_list (cur, -1, idx, idxlen, idxmax, 0, 0);
684 if (menu->current >= menu->max)
685 menu->current = menu->max - 1;
686 menu_check_recenter (menu);
687 menu->redraw |= REDRAW_INDEX;
691 mutt_attach_display_loop (MUTTMENU * menu, int op, FILE * fp, HEADER * hdr,
692 BODY * cur, ATTACHPTR *** idxp, short *idxlen,
693 short *idxmax, int recv)
695 ATTACHPTR **idx = *idxp;
699 case OP_DISPLAY_HEADERS:
700 toggle_option (OPTWEED);
704 op = mutt_view_attachment (fp, idx[menu->current]->content, M_REGULAR,
709 case OP_MAIN_NEXT_UNDELETED: /* hack */
710 if (menu->current < menu->max - 1) {
718 case OP_MAIN_PREV_UNDELETED: /* hack */
719 if (menu->current > 0) {
727 /* when we edit the content-type, we should redisplay the attachment
729 mutt_edit_content_type (hdr, idx[menu->current]->content, fp);
731 mutt_update_attach_index (cur, idxp, idxlen, idxmax, menu);
736 /* functions which are passed through from the pager */
737 case OP_CHECK_TRADITIONAL:
738 if (hdr && hdr->security & PGP_TRADITIONAL_CHECKED) {
743 case OP_ATTACH_COLLAPSE:
750 while (op != OP_NULL);
755 static void attach_collapse (BODY * b, short collapse, short init,
760 for (; b; b = b->next) {
761 i = init || b->collapsed;
762 if (i && option (OPTDIGESTCOLLAPSE) && b->type == TYPEMULTIPART
763 && mime_which_token(b->subtype, -1) == MIME_DIGEST)
764 attach_collapse (b->parts, 1, 1, 0);
765 else if (b->type == TYPEMULTIPART || mutt_is_message_type(b))
766 attach_collapse (b->parts, collapse, i, 0);
767 b->collapsed = collapse;
773 void mutt_attach_init (BODY * b)
775 for (; b; b = b->next) {
779 mutt_attach_init (b->parts);
783 void mutt_view_attachments (HEADER * hdr)
786 int need_secured = 0;
792 ATTACHPTR **idx = NULL;
798 /* make sure we have parsed this message */
799 mutt_parse_mime_message (Context, hdr);
801 mutt_message_hook (Context, hdr, M_MESSAGEHOOK);
803 if ((msg = mx_open_message (Context, hdr->msgno)) == NULL)
806 if ((hdr->security & ENCRYPT) ||
807 (mutt_is_application_smime (hdr->content) & SMIMEOPAQUE))
811 if (hdr->security & APPLICATION_SMIME) {
812 if (mutt_is_application_smime (hdr->content)) {
813 secured = !crypt_smime_decrypt_mime (msg->fp, &fp,
817 if ((mutt_is_application_smime (cur) & SMIMEOPAQUE)) {
823 secured = !crypt_smime_decrypt_mime (_fp, &fp, _cur, &cur);
825 body_list_wipe(&_cur);
832 if (hdr->security & APPLICATION_PGP) {
833 if (mutt_is_multipart_encrypted (hdr->content))
834 secured = !crypt_pgp_decrypt_mime (msg->fp, &fp, hdr->content, &cur);
839 if (need_secured && !secured) {
840 mx_close_message (&msg);
841 mutt_error _("Can't decrypt encrypted message!");
851 menu = mutt_new_menu ();
852 menu->menu = MENU_ATTACH;
853 menu->title = _("Attachments");
854 menu->make_entry = attach_entry;
855 menu->tag = mutt_tag_attach;
857 mutt_attach_init (cur);
858 attach_collapse (cur, 0, 1, 0);
859 mutt_update_attach_index (cur, &idx, &idxlen, &idxmax, menu);
861 #define CHECK_READONLY \
862 if (Context->readonly) { \
864 mutt_error _("Mailbox is read-only."); \
868 #define CHECK_ATTACH \
869 if (option(OPTATTACHMSG)) { \
871 mutt_error _("Function not permitted in attach-message mode."); \
877 op = mutt_menuLoop(menu);
879 case OP_ATTACH_VIEW_MAILCAP:
880 mutt_view_attachment (fp, idx[menu->current]->content, M_MAILCAP,
882 menu->redraw = REDRAW_FULL;
885 case OP_ATTACH_VIEW_TEXT:
886 mutt_view_attachment (fp, idx[menu->current]->content, M_AS_TEXT,
888 menu->redraw = REDRAW_FULL;
891 case OP_DISPLAY_HEADERS:
894 mutt_attach_display_loop (menu, op, fp, hdr, cur, &idx, &idxlen,
896 menu->redraw = REDRAW_FULL;
899 case OP_ATTACH_COLLAPSE:
900 if (!idx[menu->current]->content->parts) {
901 mutt_error _("There are no subparts to show!");
905 if (!idx[menu->current]->content->collapsed)
906 attach_collapse (idx[menu->current]->content, 1, 0, 1);
908 attach_collapse (idx[menu->current]->content, 0, 1, 1);
909 mutt_update_attach_index (cur, &idx, &idxlen, &idxmax, menu);
912 case OP_EXTRACT_KEYS:
913 crypt_pgp_extract_keys_from_attachment_list (fp, menu->tagprefix,
918 menu->redraw = REDRAW_FULL;
921 case OP_CHECK_TRADITIONAL:
922 if (crypt_pgp_check_traditional (fp, menu->tagprefix ? cur
923 : idx[menu->current]->content,
926 hdr->security = crypt_query (cur);
927 menu->redraw = REDRAW_FULL;
932 mutt_print_attachment_list (fp, menu->tagprefix,
933 menu->tagprefix ? cur : idx[menu->current]->
938 mutt_pipe_attachment_list (fp, menu->tagprefix,
939 menu->tagprefix ? cur : idx[menu->current]->
944 mutt_save_attachment_list (fp, menu->tagprefix,
945 menu->tagprefix ? cur : idx[menu->current]->
948 if (!menu->tagprefix && option (OPTRESOLVE)
949 && menu->current < menu->max - 1)
952 menu->redraw = REDRAW_MOTION_RESYNCH | REDRAW_FULL;
958 if (Context->magic == M_POP) {
960 mutt_error _("Can't delete attachment from POP server.");
965 if (hdr->security & (~PGP_TRADITIONAL_CHECKED)) {
967 _("Deletion of attachments from encrypted messages is unsupported.");
970 if (!menu->tagprefix) {
971 if (idx[menu->current]->parent_type == TYPEMULTIPART) {
972 idx[menu->current]->content->deleted = 1;
973 if (option (OPTRESOLVE) && menu->current < menu->max - 1) {
975 menu->redraw = REDRAW_MOTION_RESYNCH;
978 menu->redraw = REDRAW_CURRENT;
982 _("Only deletion of multipart attachments is supported.");
987 for (x = 0; x < menu->max; x++) {
988 if (idx[x]->content->tagged) {
989 if (idx[x]->parent_type == TYPEMULTIPART) {
990 idx[x]->content->deleted = 1;
991 menu->redraw = REDRAW_INDEX;
995 _("Only deletion of multipart attachments is supported.");
1004 if (!menu->tagprefix) {
1005 idx[menu->current]->content->deleted = 0;
1006 if (option (OPTRESOLVE) && menu->current < menu->max - 1) {
1008 menu->redraw = REDRAW_MOTION_RESYNCH;
1011 menu->redraw = REDRAW_CURRENT;
1016 for (x = 0; x < menu->max; x++) {
1017 if (idx[x]->content->tagged) {
1018 idx[x]->content->deleted = 0;
1019 menu->redraw = REDRAW_INDEX;
1027 mutt_attach_resend (fp, hdr, idx, idxlen,
1028 menu->tagprefix ? NULL : idx[menu->current]->
1030 menu->redraw = REDRAW_FULL;
1033 case OP_BOUNCE_MESSAGE:
1035 mutt_attach_bounce (fp, hdr, idx, idxlen,
1036 menu->tagprefix ? NULL : idx[menu->current]->
1038 menu->redraw = REDRAW_FULL;
1041 case OP_FORWARD_MESSAGE:
1043 mutt_attach_forward (fp, hdr, idx, idxlen,
1044 menu->tagprefix ? NULL : idx[menu->current]->
1046 menu->redraw = REDRAW_FULL;
1050 case OP_GROUP_REPLY:
1056 (op == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) |
1057 (op == OP_LIST_REPLY ? SENDLISTREPLY : 0);
1058 mutt_attach_reply (fp, hdr, idx, idxlen,
1059 menu->tagprefix ? NULL : idx[menu->current]->content,
1061 menu->redraw = REDRAW_FULL;
1065 mutt_edit_content_type (hdr, idx[menu->current]->content, fp);
1066 mutt_update_attach_index (cur, &idx, &idxlen, &idxmax, menu);
1070 mx_close_message (&msg);
1071 hdr->attach_del = 0;
1072 while (idxmax-- > 0) {
1075 if (idx[idxmax]->content && idx[idxmax]->content->deleted)
1076 hdr->attach_del = 1;
1077 if (idx[idxmax]->content)
1078 idx[idxmax]->content->aptr = NULL;
1079 p_delete(&idx[idxmax]->tree);
1080 p_delete(&idx[idxmax]);
1082 if (hdr->attach_del)
1087 if (need_secured && secured) {
1089 body_list_wipe(&cur);
1092 mutt_menuDestroy (&menu);
1098 #undef CHECK_READONLY