NeoMutt  2025-12-11-1061-g88ae84
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
recvattach.c
Go to the documentation of this file.
1
29
35
36#include "config.h"
37#include <limits.h>
38#include <stdbool.h>
39#include <stdio.h>
40#include <string.h>
41#include <sys/stat.h>
42#include <sys/types.h>
43#include "mutt/lib.h"
44#include "config/lib.h"
45#include "email/lib.h"
46#include "core/lib.h"
47#include "gui/lib.h"
48#include "recvattach.h"
49#include "browser/lib.h"
50#include "editor/lib.h"
51#include "history/lib.h"
52#include "hooks/lib.h"
53#include "menu/lib.h"
54#include "ncrypt/lib.h"
55#include "question/lib.h"
56#include "send/lib.h"
57#include "attach.h"
58#include "external.h"
59#include "mutt_attach.h"
60#include "muttlib.h"
61#ifdef ENABLE_NLS
62#include <libintl.h>
63#endif
64
71struct AttachPtr *current_attachment(struct AttachCtx *actx, struct Menu *menu)
72{
73 const int virt = menu_get_index(menu);
74 const int index = actx->v2r[virt];
75
76 return actx->idx[index];
77}
78
85static void mutt_update_v2r(struct AttachCtx *actx)
86{
87 int vindex;
88 int rindex;
89 int curlevel;
90
91 vindex = 0;
92 rindex = 0;
93
94 while (rindex < actx->idxlen)
95 {
96 actx->v2r[vindex++] = rindex;
97 if (actx->idx[rindex]->collapsed)
98 {
99 curlevel = actx->idx[rindex]->level;
100 do
101 {
102 rindex++;
103 } while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel));
104 }
105 else
106 {
107 rindex++;
108 }
109 }
110
111 actx->vcount = vindex;
112}
113
118void mutt_update_tree(struct AttachCtx *actx)
119{
120 char buf[256] = { 0 };
121 char *s = NULL;
122
123 mutt_update_v2r(actx);
124
125 for (int vindex = 0; vindex < actx->vcount; vindex++)
126 {
127 const int rindex = actx->v2r[vindex];
128 actx->idx[rindex]->num = vindex;
129 if ((2 * (actx->idx[rindex]->level + 2)) < sizeof(buf))
130 {
131 if (actx->idx[rindex]->level)
132 {
133 s = buf + 2 * (actx->idx[rindex]->level - 1);
134 *s++ = (actx->idx[rindex]->body->next) ? MUTT_TREE_LTEE : MUTT_TREE_LLCORNER;
135 *s++ = MUTT_TREE_HLINE;
136 *s++ = MUTT_TREE_RARROW;
137 }
138 else
139 {
140 s = buf;
141 }
142 *s = '\0';
143 }
144
145 if (actx->idx[rindex]->tree)
146 {
147 if (!mutt_str_equal(actx->idx[rindex]->tree, buf))
148 mutt_str_replace(&actx->idx[rindex]->tree, buf);
149 }
150 else
151 {
152 actx->idx[rindex]->tree = mutt_str_dup(buf);
153 }
154
155 if (((2 * (actx->idx[rindex]->level + 2)) < sizeof(buf)) &&
156 actx->idx[rindex]->level)
157 {
158 s = buf + 2 * (actx->idx[rindex]->level - 1);
159 *s++ = (actx->idx[rindex]->body->next) ? MUTT_TREE_VLINE : MUTT_TREE_SPACE;
160 *s++ = MUTT_TREE_SPACE;
161 }
162 }
163}
164
169static void prepend_savedir(struct Buffer *buf)
170{
171 if (buf_is_empty(buf) || (buf_at(buf, 0) == '/'))
172 return;
173
174 struct Buffer *tmp = buf_pool_get();
175 const char *const c_attach_save_dir = cs_subset_path(NeoMutt->sub, "attach_save_dir");
176 if (c_attach_save_dir)
177 {
178 buf_addstr(tmp, c_attach_save_dir);
179 if (tmp->dptr[-1] != '/')
180 buf_addch(tmp, '/');
181 }
182 else
183 {
184 buf_addstr(tmp, "./");
185 }
186
187 buf_addstr(tmp, buf_string(buf));
188 buf_copy(buf, tmp);
189 buf_pool_release(&tmp);
190}
191
197static bool has_a_message(struct Body *b)
198{
199 return (b->email && (b->encoding != ENC_BASE64) && (b->encoding != ENC_QUOTED_PRINTABLE) &&
201}
202
214void mutt_attach_save_path(struct Buffer *buf, struct Body *b, const char *dir)
215{
216 buf_reset(buf);
217
218 const char *name = mutt_path_basename(b->filename);
219 if (name && ((name[0] == '\0') || strchr(name, '/') ||
220 mutt_str_equal(name, ".") || mutt_str_equal(name, "..")))
221 {
222 name = NULL;
223 }
224
225 if (name)
226 {
227 if (dir && *dir)
228 buf_concat_path(buf, dir, name);
229 else
230 buf_strcpy(buf, name);
231 }
232 else if (has_a_message(b))
233 {
234 mutt_default_save(buf, b->email);
235 }
236
237 prepend_savedir(buf);
238}
239
265static int save_attachment_flowed_helper(FILE *fp, struct Body *b, const char *path,
266 enum SaveAttach flags, struct Email *e)
267{
268 int rc = -1;
269
271 {
272 struct Body b_fake = { 0 };
273
274 struct Buffer *tempfile = buf_pool_get();
275 buf_mktemp(tempfile);
276
277 rc = mutt_save_attachment(fp, b, buf_string(tempfile), MUTT_SAVE_NONE, e);
278 if (rc != 0)
279 goto cleanup;
280
282
283 /* Now "really" save it. Send mode does this without touching anything,
284 * so force send-mode. */
285 memset(&b_fake, 0, sizeof(struct Body));
286 b_fake.filename = tempfile->data;
287 rc = mutt_save_attachment(NULL, &b_fake, path, flags, e);
288
289 mutt_file_unlink(buf_string(tempfile));
290
291 cleanup:
292 buf_pool_release(&tempfile);
293 }
294 else
295 {
296 rc = mutt_save_attachment(fp, b, path, flags, e);
297 }
298
299 return rc;
300}
301
311static int query_save_attachment(FILE *fp, struct Body *b, struct Email *e, char **directory)
312{
313 char *prompt = NULL;
314 enum SaveAttach opt = MUTT_SAVE_NONE;
315 int rc = -1;
316
317 struct Buffer *buf = buf_pool_get();
318 struct Buffer *tfile = buf_pool_get();
319
320 mutt_attach_save_path(buf, b, directory ? *directory : NULL);
321
322 prompt = _("Save to file: ");
323 while (prompt)
324 {
325 struct FileCompletionData cdata = { false, NULL, NULL, NULL, NULL };
326 if ((mw_get_field(prompt, buf, MUTT_COMP_CLEAR, HC_FILE, &CompleteFileOps, &cdata) != 0) ||
327 buf_is_empty(buf))
328 {
329 goto cleanup;
330 }
331
332 prompt = NULL;
333 expand_path(buf, false);
334
335 bool is_message = (fp && has_a_message(b));
336
337 if (is_message)
338 {
339 struct stat st = { 0 };
340
341 /* check to make sure that this file is really the one the user wants */
342 rc = mutt_save_confirm(buf_string(buf), &st);
343 if (rc == 1)
344 {
345 prompt = _("Save to file: ");
346 continue;
347 }
348 else if (rc == -1)
349 {
350 goto cleanup;
351 }
352 buf_copy(tfile, buf);
353 }
354 else
355 {
356 rc = mutt_check_overwrite(b->filename, buf_string(buf), tfile, &opt, directory);
357 if (rc == -1)
358 {
359 goto cleanup;
360 }
361 else if (rc == 1)
362 {
363 prompt = _("Save to file: ");
364 continue;
365 }
366 }
367
368 mutt_message(_("Saving..."));
369 if (save_attachment_flowed_helper(fp, b, buf_string(tfile), opt,
370 (e || !is_message) ? e : b->email) == 0)
371 {
372 // This uses ngettext to avoid duplication of messages
373 int num = 1;
374 mutt_message(ngettext("Attachment saved", "%d attachments saved", num), num);
375 rc = 0;
376 goto cleanup;
377 }
378 else
379 {
380 prompt = _("Save to file: ");
381 continue;
382 }
383 }
384
385cleanup:
386 buf_pool_release(&buf);
387 buf_pool_release(&tfile);
388 return rc;
389}
390
399static int save_without_prompting(FILE *fp, struct Body *b, struct Email *e)
400{
401 enum SaveAttach opt = MUTT_SAVE_NONE;
402 int rc = -1;
403 struct Buffer *buf = buf_pool_get();
404 struct Buffer *tfile = buf_pool_get();
405
406 mutt_attach_save_path(buf, b, NULL);
407 if (buf_is_empty(buf))
408 goto cleanup;
409 expand_path(buf, false);
410
411 bool is_message = (fp && has_a_message(b));
412
413 if (is_message)
414 {
415 buf_copy(tfile, buf);
416 }
417 else
418 {
419 rc = mutt_check_overwrite(b->filename, buf_string(buf), tfile, &opt, NULL);
420 if (rc != 0) // abort or cancel
421 {
422 rc = -1;
423 goto cleanup;
424 }
425 }
426
427 rc = save_attachment_flowed_helper(fp, b, buf_string(tfile), opt,
428 (e || !is_message) ? e : b->email);
429
430cleanup:
431 buf_pool_release(&buf);
432 buf_pool_release(&tfile);
433 return rc;
434}
435
442void mutt_save_attachment_list(struct AttachPtrArray *aa, struct Email *e, struct Menu *menu)
443{
444 char *directory = NULL;
445 int rc = 1;
446 int last = menu ? menu_get_index(menu) : 0;
447 FILE *fp_out = NULL;
448 int saved_attachments = 0;
449
450 struct Buffer *buf = buf_pool_get();
451 struct Buffer *tfile = buf_pool_get();
452
453 const bool c_attach_split = cs_subset_bool(NeoMutt->sub, "attach_split");
454 const char *const c_attach_sep = cs_subset_string(NeoMutt->sub, "attach_sep");
455 const bool c_attach_save_without_prompting = cs_subset_bool(NeoMutt->sub, "attach_save_without_prompting");
456
457 struct AttachPtr **app = NULL;
458 ARRAY_FOREACH(app, aa)
459 {
460 FILE *fp = (*app)->fp;
461 struct Body *b = (*app)->body;
462
463 /* Iterate through attachments.
464 * Behavior depends on attach_split: if true, save each to its own file;
465 * if false, concatenate all into one file with optional separator. */
466 if (c_attach_split)
467 {
468 if (menu)
469 {
470 menu_set_index(menu, (*app)->num);
472 menu_redraw(menu);
473 }
474 if (c_attach_save_without_prompting)
475 {
476 // Save each file, with no prompting, using the configured 'AttachSaveDir'
477 rc = save_without_prompting(fp, b, e);
478 if (rc == 0)
479 saved_attachments++;
480 }
481 else
482 {
483 // Save each file, prompting the user for the location each time.
484 if (query_save_attachment(fp, b, e, &directory) == -1)
485 break;
486 }
487 }
488 else
489 {
490 enum SaveAttach opt = MUTT_SAVE_NONE;
491
492 if (buf_is_empty(buf))
493 {
494 mutt_attach_save_path(buf, b, NULL);
495
496 struct FileCompletionData cdata = { false, NULL, NULL, NULL, NULL };
497 if ((mw_get_field(_("Save to file: "), buf, MUTT_COMP_CLEAR, HC_FILE,
498 &CompleteFileOps, &cdata) != 0) ||
499 buf_is_empty(buf))
500 {
501 goto cleanup;
502 }
503 expand_path(buf, false);
504 if (mutt_check_overwrite(b->filename, buf_string(buf), tfile, &opt, NULL))
505 goto cleanup;
506 }
507 else
508 {
509 opt = MUTT_SAVE_APPEND;
510 }
511
512 rc = save_attachment_flowed_helper(fp, b, buf_string(tfile), opt, e);
513 if ((rc == 0) && c_attach_sep && (fp_out = mutt_file_fopen(buf_string(tfile), "a")))
514 {
515 fprintf(fp_out, "%s", c_attach_sep);
516 mutt_file_fclose(&fp_out);
517 }
518 }
519 }
520
521 FREE(&directory);
522
523 if ((ARRAY_SIZE(aa) > 1) && menu)
524 {
525 menu_set_index(menu, last);
527 }
528
529 if (rc == 0)
530 {
531 if (!c_attach_split)
532 saved_attachments = 1;
533
534 if (!c_attach_split || c_attach_save_without_prompting)
535 {
536 mutt_message(ngettext("Attachment saved", "%d attachments saved", saved_attachments),
537 saved_attachments);
538 }
539 }
540
541cleanup:
542 buf_pool_release(&buf);
543 buf_pool_release(&tfile);
544}
545
553static void query_pipe_attachment(const char *command, FILE *fp, struct Body *b, bool filter)
554{
555 struct Buffer *tfile = buf_pool_get();
556
557 if (filter)
558 {
559 char warning[PATH_MAX + 256] = { 0 };
560 snprintf(warning, sizeof(warning),
561 _("WARNING! You are about to overwrite %s, continue?"), b->filename);
562 if (query_yesorno(warning, MUTT_NO) != MUTT_YES)
563 {
564 msgwin_clear_text(NULL);
565 buf_pool_release(&tfile);
566 return;
567 }
568 buf_mktemp(tfile);
569 }
570
571 if (mutt_pipe_attachment(fp, b, command, buf_string(tfile)))
572 {
573 if (filter)
574 {
578 mutt_message(_("Attachment filtered"));
579 }
580 }
581 else
582 {
583 if (filter && !buf_is_empty(tfile))
585 }
586 buf_pool_release(&tfile);
587}
588
595static void pipe_attachment(FILE *fp, struct Body *b, struct State *state)
596{
597 if (!state || !state->fp_out)
598 return;
599
600 FILE *fp_in = NULL;
601 FILE *fp_unstuff = NULL;
602 bool is_flowed = false, unlink_unstuff = false;
603 struct Buffer *unstuff_tempfile = NULL;
604
606 {
607 is_flowed = true;
608 unstuff_tempfile = buf_pool_get();
609 buf_mktemp(unstuff_tempfile);
610 }
611
612 if (fp)
613 {
614 state->fp_in = fp;
615
616 if (is_flowed)
617 {
618 fp_unstuff = mutt_file_fopen(buf_string(unstuff_tempfile), "w");
619 if (!fp_unstuff)
620 {
621 mutt_perror("mutt_file_fopen");
622 goto bail;
623 }
624 unlink_unstuff = true;
625
626 FILE *filter_fp = state->fp_out;
627 state->fp_out = fp_unstuff;
628 mutt_decode_attachment(b, state);
629 mutt_file_fclose(&fp_unstuff);
630 state->fp_out = filter_fp;
631
632 fp_unstuff = mutt_file_fopen(buf_string(unstuff_tempfile), "r");
633 if (!fp_unstuff)
634 {
635 mutt_perror("mutt_file_fopen");
636 goto bail;
637 }
638 mutt_file_copy_stream(fp_unstuff, filter_fp);
639 mutt_file_fclose(&fp_unstuff);
640 }
641 else
642 {
643 mutt_decode_attachment(b, state);
644 }
645 }
646 else
647 {
648 const char *infile = NULL;
649
650 if (is_flowed)
651 {
652 if (mutt_save_attachment(fp, b, buf_string(unstuff_tempfile), 0, NULL) == -1)
653 goto bail;
654 unlink_unstuff = true;
656 infile = buf_string(unstuff_tempfile);
657 }
658 else
659 {
660 infile = b->filename;
661 }
662
663 fp_in = mutt_file_fopen(infile, "r");
664 if (!fp_in)
665 {
666 mutt_perror("fopen");
667 goto bail;
668 }
669 mutt_file_copy_stream(fp_in, state->fp_out);
670 mutt_file_fclose(&fp_in);
671 }
672
673 const char *const c_attach_sep = cs_subset_string(NeoMutt->sub, "attach_sep");
674 if (c_attach_sep)
675 state_puts(state, c_attach_sep);
676
677bail:
678 mutt_file_fclose(&fp_unstuff);
679 mutt_file_fclose(&fp_in);
680
681 if (unlink_unstuff)
682 mutt_file_unlink(buf_string(unstuff_tempfile));
683 buf_pool_release(&unstuff_tempfile);
684}
685
693static void pipe_attachment_list(const char *command, struct AttachPtrArray *aa,
694 bool filter, struct State *state)
695{
696 const bool c_attach_split = cs_subset_bool(NeoMutt->sub, "attach_split");
697 struct AttachPtr **app = NULL;
698 ARRAY_FOREACH(app, aa)
699 {
700 FILE *fp = (*app)->fp;
701 struct Body *b = (*app)->body;
702
703 if (!filter && !c_attach_split)
704 pipe_attachment(fp, b, state);
705 else
706 query_pipe_attachment(command, fp, b, filter);
707 }
708}
709
715void mutt_pipe_attachment_list(struct AttachPtrArray *aa, bool filter)
716{
717 struct State state = { 0 };
718 struct Buffer *buf = NULL;
719
720 if (ARRAY_EMPTY(aa))
721 return;
722
723 struct AttachPtr **first = ARRAY_GET(aa, 0);
724 if (first && (*first)->fp)
725 filter = false; /* sanity check: we can't filter in the recv case yet */
726
727 buf = buf_pool_get();
728 /* perform charset conversion on text attachments when piping */
729 state.flags = STATE_CHARCONV;
730
731 if (mw_get_field((filter ? _("Filter through: ") : _("Pipe to: ")), buf,
733 {
734 goto cleanup;
735 }
736
737 if (buf_is_empty(buf))
738 goto cleanup;
739
740 expand_path(buf, false);
741
742 const bool c_attach_split = cs_subset_bool(NeoMutt->sub, "attach_split");
743 if (!filter && !c_attach_split)
744 {
745 mutt_endwin();
746 pid_t pid = filter_create(buf_string(buf), &state.fp_out, NULL, NULL,
747 NeoMutt->env);
748 pipe_attachment_list(buf_string(buf), aa, filter, &state);
749 mutt_file_fclose(&state.fp_out);
750 const bool c_wait_key = cs_subset_bool(NeoMutt->sub, "wait_key");
751 if ((filter_wait(pid) != 0) || c_wait_key)
753 }
754 else
755 {
756 pipe_attachment_list(buf_string(buf), aa, filter, &state);
757 }
758
759cleanup:
760 buf_pool_release(&buf);
761}
762
768static bool can_print(struct AttachPtrArray *aa)
769{
770 char type[256] = { 0 };
771
772 struct AttachPtr **app = NULL;
773 ARRAY_FOREACH(app, aa)
774 {
775 struct Body *b = (*app)->body;
776 snprintf(type, sizeof(type), "%s/%s", BODY_TYPE(b), b->subtype);
777 if (!mailcap_lookup(b, type, sizeof(type), NULL, MUTT_MC_PRINT))
778 {
779 if (!mutt_istr_equal("text/plain", b->subtype) &&
780 !mutt_istr_equal("application/postscript", b->subtype))
781 {
782 if (!mutt_can_decode(b))
783 {
784 /* L10N: s gets replaced by a MIME type, e.g. "text/plain" or
785 application/octet-stream. */
786 mutt_error(_("I don't know how to print %s attachments"), type);
787 return false;
788 }
789 }
790 }
791 }
792 return true;
793}
794
800static void print_attachment_list(struct AttachPtrArray *aa, struct State *state)
801{
802 char type[256] = { 0 };
803
804 const bool c_attach_split = cs_subset_bool(NeoMutt->sub, "attach_split");
805 const char *const c_attach_sep = cs_subset_string(NeoMutt->sub, "attach_sep");
806
807 struct AttachPtr **app = NULL;
808 ARRAY_FOREACH(app, aa)
809 {
810 FILE *fp = (*app)->fp;
811 struct Body *b = (*app)->body;
812
813 snprintf(type, sizeof(type), "%s/%s", BODY_TYPE(b), b->subtype);
814 if (!c_attach_split && !mailcap_lookup(b, type, sizeof(type), NULL, MUTT_MC_PRINT))
815 {
816 if (mutt_istr_equal("text/plain", b->subtype) ||
817 mutt_istr_equal("application/postscript", b->subtype))
818 {
819 pipe_attachment(fp, b, state);
820 }
821 else if (mutt_can_decode(b))
822 {
823 /* decode and print */
824
825 FILE *fp_in = NULL;
826 struct Buffer *newfile = buf_pool_get();
827
828 buf_mktemp(newfile);
829 if (mutt_decode_save_attachment(fp, b, buf_string(newfile),
831 {
832 if (!state->fp_out)
833 {
834 mutt_error("BUG in print_attachment_list(). Please report this. ");
836 buf_pool_release(&newfile);
837 return;
838 }
839
840 fp_in = mutt_file_fopen(buf_string(newfile), "r");
841 if (fp_in)
842 {
843 mutt_file_copy_stream(fp_in, state->fp_out);
844 mutt_file_fclose(&fp_in);
845 if (c_attach_sep)
846 state_puts(state, c_attach_sep);
847 }
848 }
850 buf_pool_release(&newfile);
851 }
852 }
853 else
854 {
856 }
857 }
858}
859
864void mutt_print_attachment_list(struct AttachPtrArray *aa)
865{
866 char prompt[128] = { 0 };
867 struct State state = { 0 };
868 const int count = ARRAY_SIZE(aa);
869
870 if (count == 0)
871 return;
872
873 snprintf(prompt, sizeof(prompt),
874 ngettext("Print attachment?", "Print %d attachments?", count), count);
875 if (query_quadoption(prompt, NeoMutt->sub, "print") != MUTT_YES)
876 return;
877
878 const bool c_attach_split = cs_subset_bool(NeoMutt->sub, "attach_split");
879 if (c_attach_split)
880 {
881 print_attachment_list(aa, &state);
882 }
883 else
884 {
885 if (!can_print(aa))
886 return;
887 mutt_endwin();
888 const char *const c_print_command = cs_subset_string(NeoMutt->sub, "print_command");
889 pid_t pid = filter_create(NONULL(c_print_command), &state.fp_out, NULL,
890 NULL, NeoMutt->env);
891 print_attachment_list(aa, &state);
892 mutt_file_fclose(&state.fp_out);
893 const bool c_wait_key = cs_subset_bool(NeoMutt->sub, "wait_key");
894 if ((filter_wait(pid) != 0) || c_wait_key)
896 }
897}
898
905void recvattach_edit_content_type(struct AttachCtx *actx, struct Menu *menu, struct Email *e)
906{
907 struct AttachPtr *cur_att = current_attachment(actx, menu);
908 if (!mutt_edit_content_type(e, cur_att->body, cur_att->fp))
909 return;
910
911 /* The mutt_update_recvattach_menu() will overwrite any changes
912 * made to a decrypted cur_att->body, so warn the user. */
913 if (cur_att->decrypted)
914 {
915 mutt_message(_("Structural changes to decrypted attachments are not supported"));
916 mutt_sleep(1);
917 }
918 /* Editing the content type can rewrite the body structure. */
919 for (int i = 0; i < actx->idxlen; i++)
920 actx->idx[i]->body = NULL;
922 mutt_update_recvattach_menu(actx, menu, true);
923}
924
935int mutt_attach_display_loop(struct ConfigSubset *sub, struct Menu *menu, int op,
936 struct Email *e, struct AttachCtx *actx, bool recv)
937{
938 do
939 {
940 switch (op)
941 {
942 case OP_DISPLAY_HEADERS:
943 bool_str_toggle(NeoMutt->sub, "weed", NULL);
945
946 case OP_ATTACH_VIEW:
947 {
948 struct AttachPtr *cur_att = current_attachment(actx, menu);
949 if (!cur_att->fp)
950 {
951 if (cur_att->body->type == TYPE_MULTIPART)
952 {
953 struct Body *b = cur_att->body->parts;
954 while (b && b->parts)
955 b = b->parts;
956 if (b)
957 cur_att = b->aptr;
958 }
959 }
960 op = mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_REGULAR,
961 e, actx, menu->win);
962 break;
963 }
964
965 case OP_NEXT_ENTRY:
966 case OP_MAIN_NEXT_UNDELETED: /* hack */
967 {
968 const int index = menu_get_index(menu) + 1;
969 if (index < menu->max)
970 {
971 menu_set_index(menu, index);
972 op = OP_ATTACH_VIEW;
973 }
974 else
975 {
976 op = OP_NULL;
977 }
978 break;
979 }
980
981 case OP_PREV_ENTRY:
982 case OP_MAIN_PREV_UNDELETED: /* hack */
983 {
984 const int index = menu_get_index(menu) - 1;
985 if (index >= 0)
986 {
987 menu_set_index(menu, index);
988 op = OP_ATTACH_VIEW;
989 }
990 else
991 {
992 op = OP_NULL;
993 }
994 break;
995 }
996
997 case OP_ATTACH_EDIT_TYPE:
998 {
999 struct AttachPtr *cur_att = current_attachment(actx, menu);
1000 /* when we edit the content-type, we should redisplay the attachment
1001 * immediately */
1002 mutt_edit_content_type(e, cur_att->body, cur_att->fp);
1003 if (recv)
1004 recvattach_edit_content_type(actx, menu, e);
1005 else
1006 mutt_edit_content_type(e, cur_att->body, cur_att->fp);
1007
1009 op = OP_ATTACH_VIEW;
1010 break;
1011 }
1012 /* functions which are passed through from the pager */
1013 case OP_PIPE:
1014 {
1015 struct AttachPtr *cur_att = current_attachment(actx, menu);
1016 struct AttachPtrArray aa = ARRAY_HEAD_INITIALIZER;
1017 ARRAY_ADD(&aa, cur_att);
1018 mutt_pipe_attachment_list(&aa, false);
1019 ARRAY_FREE(&aa);
1020 op = OP_ATTACH_VIEW;
1021 break;
1022 }
1023 case OP_ATTACH_PRINT:
1024 {
1025 struct AttachPtr *cur_att = current_attachment(actx, menu);
1026 struct AttachPtrArray aa = ARRAY_HEAD_INITIALIZER;
1027 ARRAY_ADD(&aa, cur_att);
1029 ARRAY_FREE(&aa);
1030 op = OP_ATTACH_VIEW;
1031 break;
1032 }
1033 case OP_ATTACH_SAVE:
1034 {
1035 struct AttachPtr *cur_att = current_attachment(actx, menu);
1036 struct AttachPtrArray aa = ARRAY_HEAD_INITIALIZER;
1037 ARRAY_ADD(&aa, cur_att);
1038 mutt_save_attachment_list(&aa, e, NULL);
1039 ARRAY_FREE(&aa);
1040 op = OP_ATTACH_VIEW;
1041 break;
1042 }
1043 case OP_CHECK_TRADITIONAL:
1045 {
1046 op = OP_NULL;
1047 break;
1048 }
1050
1051 case OP_ATTACH_COLLAPSE:
1052 if (recv)
1053 return op;
1055
1056 default:
1057 op = OP_NULL;
1058 }
1059 } while (op != OP_NULL);
1060
1061 return op;
1062}
1063
1074void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Email *e,
1075 struct Body *b, FILE *fp, int parent_type,
1076 int level, bool decrypted)
1077{
1078 struct Body *bp = NULL;
1079 struct Body *new_body = NULL;
1080 FILE *fp_new = NULL;
1082
1083 for (bp = b; bp; bp = bp->next)
1084 {
1085 bool need_secured = false;
1086 bool secured = false;
1087
1089 {
1090 need_secured = true;
1091
1092 if (type & SEC_ENCRYPT)
1093 {
1095 goto decrypt_failed;
1096
1097 if (e->env)
1099 }
1100
1101 secured = (crypt_smime_decrypt_mime(fp, &fp_new, bp, &new_body) == 0);
1102 /* If the decrypt/verify-opaque doesn't generate mime output, an empty
1103 * text/plain type will still be returned by mutt_read_mime_header().
1104 * We can't distinguish an actual part from a failure, so only use a
1105 * text/plain that results from a single top-level part. */
1106 if (secured && (new_body->type == TYPE_TEXT) &&
1107 mutt_istr_equal("plain", new_body->subtype) && ((b != bp) || bp->next))
1108 {
1109 mutt_body_free(&new_body);
1110 mutt_file_fclose(&fp_new);
1111 goto decrypt_failed;
1112 }
1113
1114 if (secured && (type & SEC_ENCRYPT))
1115 e->security |= SMIME_ENCRYPT;
1116 }
1117
1118 if (((WithCrypto & APPLICATION_PGP) != 0) &&
1120 {
1121 need_secured = true;
1122
1124 goto decrypt_failed;
1125
1126 secured = (crypt_pgp_decrypt_mime(fp, &fp_new, bp, &new_body) == 0);
1127
1128 if (secured)
1129 e->security |= PGP_ENCRYPT;
1130 }
1131
1132 if (need_secured && secured)
1133 {
1134 mutt_actx_add_fp(actx, fp_new);
1135 mutt_actx_add_body(actx, new_body);
1136 mutt_generate_recvattach_list(actx, e, new_body, fp_new, parent_type, level, 1);
1137 continue;
1138 }
1139
1140 decrypt_failed:
1141 /* Fall through and show the original parts if decryption fails */
1142 if (need_secured && !secured)
1143 mutt_error(_("Can't decrypt encrypted message"));
1144
1145 struct AttachPtr *ap = mutt_aptr_new();
1146 mutt_actx_add_attach(actx, ap);
1147
1148 ap->body = bp;
1149 ap->fp = fp;
1150 bp->aptr = ap;
1152 ap->level = level;
1153 ap->decrypted = decrypted;
1154
1155 if (mutt_is_message_type(bp->type, bp->subtype))
1156 {
1157 mutt_generate_recvattach_list(actx, bp->email, bp->parts, fp, bp->type,
1158 level + 1, decrypted);
1159 e->security |= bp->email->security;
1160 }
1161 else
1162 {
1163 mutt_generate_recvattach_list(actx, e, bp->parts, fp, bp->type, level + 1, decrypted);
1164 }
1165 }
1166}
1167
1172void mutt_attach_init(struct AttachCtx *actx)
1173{
1174 /* Collapse the attachments if '$digest_collapse' is set AND if...
1175 * the outer container is of type 'multipart/digest' */
1176 bool digest = mutt_istr_equal(actx->email->body->subtype, "digest");
1177
1178 const bool c_digest_collapse = cs_subset_bool(NeoMutt->sub, "digest_collapse");
1179 for (int i = 0; i < actx->idxlen; i++)
1180 {
1181 actx->idx[i]->body->tagged = false;
1182
1183 /* OR an inner container is of type 'multipart/digest' */
1184 actx->idx[i]->collapsed = (c_digest_collapse &&
1185 (digest ||
1186 ((actx->idx[i]->body->type == TYPE_MULTIPART) &&
1187 mutt_istr_equal(actx->idx[i]->body->subtype, "digest"))));
1188 }
1189}
1190
1197void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
1198{
1199 if (init)
1200 {
1201 mutt_generate_recvattach_list(actx, actx->email, actx->email->body,
1202 actx->fp_root, -1, 0, 0);
1203 mutt_attach_init(actx);
1204 }
1205
1206 mutt_update_tree(actx);
1207
1208 menu->max = actx->vcount;
1209
1210 const int index = menu_get_index(menu);
1211 if (index >= menu->max)
1212 menu_set_index(menu, menu->max - 1);
1214}
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition array.h:157
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition array.h:74
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition array.h:58
void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach)
Add an Attachment to an Attachment Context.
Definition attach.c:65
void mutt_actx_add_fp(struct AttachCtx *actx, FILE *fp_new)
Save a File handle to the Attachment Context.
Definition attach.c:121
struct AttachPtr * mutt_aptr_new(void)
Create a new Attachment Pointer.
Definition attach.c:40
void mutt_actx_add_body(struct AttachCtx *actx, struct Body *b)
Add an email body to an Attachment Context.
Definition attach.c:142
void mutt_actx_entries_free(struct AttachCtx *actx)
Free entries in an Attachment Context.
Definition attach.c:162
Handling of email attachments.
int bool_str_toggle(struct ConfigSubset *sub, const char *name, struct Buffer *err)
Toggle the value of a bool.
Definition bool.c:231
const struct CompleteOps CompleteFileOps
Auto-Completion of Files.
Definition complete.c:152
Select a Mailbox from a list.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:89
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:298
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
Definition buffer.c:674
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition buffer.c:248
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition buffer.c:233
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:401
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition buffer.c:607
size_t buf_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
Definition buffer.c:515
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:99
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition helpers.c:168
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
SecurityFlags mutt_is_application_smime(struct Body *b)
Does the message use S/MIME?
Definition crypt.c:610
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
Definition crypt.c:131
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
Definition crypt.c:444
SecurityFlags mutt_is_malformed_multipart_pgp_encrypted(struct Body *b)
Check for malformed layout.
Definition crypt.c:505
int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Wrapper for CryptModuleSpecs::decrypt_mime().
Definition cryptglue.c:237
void crypt_smime_getkeys(struct Envelope *env)
Wrapper for CryptModuleSpecs::smime_getkeys().
Definition cryptglue.c:538
int crypt_smime_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Wrapper for CryptModuleSpecs::decrypt_mime().
Definition cryptglue.c:510
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
Definition curs_lib.c:174
void mutt_endwin(void)
Shutdown curses.
Definition curs_lib.c:152
int menu_redraw(struct Menu *menu)
Redraw the parts of the screen that have been flagged to be redrawn.
Definition draw.c:488
Edit a string.
@ MUTT_COMP_CLEAR
Clear input if printable character is pressed.
Definition wdata.h:47
@ MUTT_COMP_NONE
No flags are set.
Definition wdata.h:46
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition body.c:58
Structs that make up an email.
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
Definition parse.c:1653
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
Definition external.c:1077
Manage where the email is piped to external commands.
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
Definition file.c:224
int mutt_file_rename(const char *oldfile, const char *newfile)
Rename a file.
Definition file.c:1258
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition file.c:156
#define mutt_file_fclose(FP)
Definition file.h:144
#define mutt_file_fopen(PATH, MODE)
Definition file.h:143
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
Definition window.c:502
#define mutt_error(...)
Definition logging2.h:94
#define mutt_message(...)
Definition logging2.h:93
#define mutt_perror(...)
Definition logging2.h:95
Convenience wrapper for the gui headers.
@ MUTT_TREE_LLCORNER
Lower left corner.
Definition thread.h:57
@ MUTT_TREE_RARROW
Right arrow.
Definition thread.h:63
@ MUTT_TREE_LTEE
Left T-piece.
Definition thread.h:59
@ MUTT_TREE_VLINE
Vertical line.
Definition thread.h:61
@ MUTT_TREE_HLINE
Horizontal line.
Definition thread.h:60
@ MUTT_TREE_SPACE
Blank space.
Definition thread.h:62
bool mutt_can_decode(struct Body *b)
Will decoding the attachment produce any output.
Definition handler.c:1910
void mutt_decode_attachment(const struct Body *b, struct State *state)
Decode an email's attachment.
Definition handler.c:1950
Read/write command history from/to a file.
@ HC_FILE
Files.
Definition lib.h:59
@ HC_EXT_COMMAND
External commands.
Definition lib.h:56
void mutt_default_save(struct Buffer *path, struct Email *e)
Find the default save path for an email.
Definition exec.c:218
Hook Commands.
bool mailcap_lookup(struct Body *b, char *type, size_t typelen, struct MailcapEntry *entry, enum MailcapLookup opt)
Find given type in the list of mailcap files.
Definition mailcap.c:484
@ MUTT_MC_PRINT
Mailcap print field.
Definition mailcap.h:60
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:92
GUI present the user with a selectable list.
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:177
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:153
@ MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:61
@ MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition lib.h:62
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:167
@ ENC_BASE64
Base-64 encoded text.
Definition mime.h:52
@ ENC_QUOTED_PRINTABLE
Quoted-printable text.
Definition mime.h:51
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition mime.h:37
@ TYPE_TEXT
Type: 'text/*'.
Definition mime.h:38
#define BODY_TYPE(body)
Get the type name of a body part.
Definition mime.h:92
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
Definition msgwin.c:556
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Definition filter.c:231
pid_t filter_create(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err, char **envlist)
Set up filter program.
Definition filter.c:220
Convenience wrapper for the library headers.
#define FALLTHROUGH
Definition lib.h:117
#define _(a)
Definition message.h:28
const char * mutt_path_basename(const char *path)
Find the last component for a pathname.
Definition path.c:282
#define state_puts(STATE, STR)
Definition state.h:64
@ STATE_CHARCONV
Do character set conversions.
Definition state.h:41
@ STATE_PRINTING
Are we printing? - STATE_DISPLAY "light".
Definition state.h:42
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition string.c:678
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition string.c:257
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:666
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
#define PATH_MAX
Definition mutt.h:49
int mutt_pipe_attachment(FILE *fp, struct Body *b, const char *path, const char *outfile)
Pipe an attachment to a command.
int mutt_save_attachment(FILE *fp, struct Body *b, const char *path, enum SaveAttach opt, struct Email *e)
Save an attachment.
int mutt_decode_save_attachment(FILE *fp, struct Body *b, const char *path, StateFlags flags, enum SaveAttach opt)
Decode, then save an attachment.
int mutt_view_attachment(FILE *fp, struct Body *b, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx, struct MuttWindow *win)
View an attachment.
int mutt_print_attachment(FILE *fp, struct Body *b)
Print out an attachment.
Handling of email attachments.
SaveAttach
Options for saving attachments.
Definition mutt_attach.h:58
@ MUTT_SAVE_APPEND
Append to existing file.
Definition mutt_attach.h:60
@ MUTT_SAVE_NONE
Overwrite existing file (the default).
Definition mutt_attach.h:59
@ MUTT_VA_REGULAR
View using default method.
Definition mutt_attach.h:45
void mutt_sleep(short s)
Sleep for a while.
Definition muttlib.c:795
void expand_path(struct Buffer *buf, bool regex)
Create the canonical path.
Definition muttlib.c:122
int mutt_check_overwrite(const char *attname, const char *path, struct Buffer *fname, enum SaveAttach *opt, char **directory)
Ask the user if overwriting is necessary.
Definition muttlib.c:527
int mutt_save_confirm(const char *s, struct stat *st)
Ask the user to save.
Definition muttlib.c:698
Some miscellaneous functions.
API for encryption/signing of emails.
uint16_t SecurityFlags
Definition lib.h:104
@ SEC_ENCRYPT
Email is encrypted.
Definition lib.h:92
#define PGP_TRADITIONAL_CHECKED
Email has a traditional (inline) signature.
Definition lib.h:108
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition lib.h:106
#define PGP_ENCRYPT
Email is PGP encrypted.
Definition lib.h:112
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition lib.h:107
#define SMIME_ENCRYPT
Email is S/MIME encrypted.
Definition lib.h:118
#define WithCrypto
Definition lib.h:132
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
@ MUTT_NO
User answered 'No', or assume 'No'.
Definition quad.h:38
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
Ask the user a question.
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
Definition question.c:384
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
Definition question.c:329
void mutt_save_attachment_list(struct AttachPtrArray *aa, struct Email *e, struct Menu *menu)
Save a list of selected attachments.
Definition recvattach.c:442
void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Email *e, struct Body *b, FILE *fp, int parent_type, int level, bool decrypted)
Create a list of attachments.
void mutt_pipe_attachment_list(struct AttachPtrArray *aa, bool filter)
Pipe selected attachments to a command.
Definition recvattach.c:715
void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
static int save_attachment_flowed_helper(FILE *fp, struct Body *b, const char *path, enum SaveAttach flags, struct Email *e)
Helper for unstuffing attachments.
Definition recvattach.c:265
static void print_attachment_list(struct AttachPtrArray *aa, struct State *state)
Print a list of Attachments.
Definition recvattach.c:800
static void query_pipe_attachment(const char *command, FILE *fp, struct Body *b, bool filter)
Ask the user if we should pipe the attachment.
Definition recvattach.c:553
static int save_without_prompting(FILE *fp, struct Body *b, struct Email *e)
Save the attachment, without prompting each time.
Definition recvattach.c:399
void mutt_attach_save_path(struct Buffer *buf, struct Body *b, const char *dir)
Suggest a path to save an attachment to.
Definition recvattach.c:214
static void pipe_attachment_list(const char *command, struct AttachPtrArray *aa, bool filter, struct State *state)
Pipe a list of attachments to a command.
Definition recvattach.c:693
struct AttachPtr * current_attachment(struct AttachCtx *actx, struct Menu *menu)
Get the current attachment.
Definition recvattach.c:71
int mutt_attach_display_loop(struct ConfigSubset *sub, struct Menu *menu, int op, struct Email *e, struct AttachCtx *actx, bool recv)
Event loop for the Attachment menu.
Definition recvattach.c:935
void mutt_print_attachment_list(struct AttachPtrArray *aa)
Print selected attachments.
Definition recvattach.c:864
static void prepend_savedir(struct Buffer *buf)
Add $attach_save_dir to the beginning of a path.
Definition recvattach.c:169
static void pipe_attachment(FILE *fp, struct Body *b, struct State *state)
Pipe the attachment to a command.
Definition recvattach.c:595
void mutt_attach_init(struct AttachCtx *actx)
Create a new Attachment context.
void mutt_update_tree(struct AttachCtx *actx)
Refresh the list of attachments.
Definition recvattach.c:118
static int query_save_attachment(FILE *fp, struct Body *b, struct Email *e, char **directory)
Ask the user if we should save the attachment.
Definition recvattach.c:311
static bool has_a_message(struct Body *b)
Determine if the Body has a message (to save).
Definition recvattach.c:197
static void mutt_update_v2r(struct AttachCtx *actx)
Update the virtual list of attachments.
Definition recvattach.c:85
static bool can_print(struct AttachPtrArray *aa)
Do we know how to print this attachment type?
Definition recvattach.c:768
void recvattach_edit_content_type(struct AttachCtx *actx, struct Menu *menu, struct Email *e)
Edit the content type of an attachment.
Definition recvattach.c:905
Routines for managing attachments.
void mutt_rfc3676_space_unstuff_attachment(struct Body *b, const char *filename)
Unstuff attachments.
Definition rfc3676.c:524
bool mutt_rfc3676_is_format_flowed(struct Body *b)
Is the Email "format-flowed"?
Definition rfc3676.c:400
Convenience wrapper for the send headers.
void mutt_update_encoding(struct Body *b, struct ConfigSubset *sub)
Update the encoding type.
Definition sendlib.c:424
#define NONULL(x)
Definition string2.h:44
A set of attachments.
Definition attach.h:65
short vcount
The number of virtual attachments.
Definition attach.h:74
FILE * fp_root
Used by recvattach for updating.
Definition attach.h:67
struct Email * email
Used by recvattach for updating.
Definition attach.h:66
struct AttachPtr ** idx
Array of attachments.
Definition attach.h:69
short idxlen
Number of attachmentes.
Definition attach.h:70
short * v2r
Mapping from virtual to real attachment.
Definition attach.h:73
An email to which things will be attached.
Definition attach.h:36
struct Body * body
Attachment.
Definition attach.h:37
bool collapsed
Group is collapsed.
Definition attach.h:45
char * tree
Tree characters to display.
Definition attach.h:40
int num
Attachment index number.
Definition attach.h:42
int level
Nesting depth of attachment.
Definition attach.h:41
FILE * fp
Used in the recvattach menu.
Definition attach.h:38
bool decrypted
Not part of message as stored in the email->body.
Definition attach.h:44
int parent_type
Type of parent attachment, e.g. TYPE_MULTIPART.
Definition attach.h:39
The body of an email.
Definition body.h:36
struct Body * parts
parts of a multipart or message/rfc822
Definition body.h:73
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition body.h:75
struct Email * email
header information for message/rfc822
Definition body.h:74
bool tagged
This attachment is tagged.
Definition body.h:90
struct Body * next
next attachment in the list
Definition body.h:72
char * subtype
content-type subtype
Definition body.h:61
unsigned int encoding
content-transfer-encoding, ContentEncoding
Definition body.h:41
unsigned int type
content-type primary type, ContentType
Definition body.h:40
char * filename
When sending a message, this is the file to which this structure refers.
Definition body.h:59
String manipulation buffer.
Definition buffer.h:37
char * dptr
Current read/write position.
Definition buffer.h:39
char * data
Pointer to data.
Definition buffer.h:38
A set of inherited config items.
Definition subset.h:46
The envelope/body of an email.
Definition email.h:39
struct Envelope * env
Envelope information.
Definition email.h:68
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
struct Body * body
List of MIME parts.
Definition email.h:69
Input for the file completion function.
Definition curs_lib.h:39
Definition lib.h:86
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:94
int max
Number of entries in the menu.
Definition lib.h:88
Container for Accounts, Notifications.
Definition neomutt.h:41
char ** env
Private copy of the environment variables.
Definition neomutt.h:57
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Keep track when processing files.
Definition state.h:54
StateFlags flags
Flags, e.g. STATE_DISPLAY.
Definition state.h:58
FILE * fp_out
File to write to.
Definition state.h:56
FILE * fp_in
File to read from.
Definition state.h:55
#define buf_mktemp(buf)
Definition tmp.h:33