NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c
Go to the documentation of this file.
1
29#include "config.h"
30#ifdef _MAKEDOC
31#include "docs/makedoc_defs.h"
32#else
33#include <stdbool.h>
34#include <stdio.h>
35#include "mutt/lib.h"
36#include "config/lib.h"
37#include "email/lib.h"
38#include "core/lib.h"
39#include "gui/lib.h"
40#include "key/lib.h"
41#include "menu/lib.h"
42#include "ncrypt/lib.h"
43#include "question/lib.h"
44#include "send/lib.h"
45#include "attach.h"
46#include "functions.h"
47#include "globals.h" // IWYU pragma: keep
48#include "mutt_attach.h"
49#include "private_data.h"
50#include "recvattach.h"
51#include "recvcmd.h"
52#endif
53
55static const char *Not_available_in_this_menu = N_("Not available in this menu");
58 "Function not permitted in attach-message mode");
59
60// clang-format off
64const struct MenuFuncOp OpAttachment[] = { /* map: attachment */
65 { "bounce-message", OP_BOUNCE_MESSAGE },
66 { "check-traditional-pgp", OP_CHECK_TRADITIONAL },
67 { "collapse-parts", OP_ATTACHMENT_COLLAPSE },
68 { "compose-to-sender", OP_COMPOSE_TO_SENDER },
69 { "delete-entry", OP_ATTACHMENT_DELETE },
70 { "display-toggle-weed", OP_DISPLAY_HEADERS },
71 { "edit-type", OP_ATTACHMENT_EDIT_TYPE },
72 { "exit", OP_EXIT },
73 { "extract-keys", OP_EXTRACT_KEYS },
74#ifdef USE_NNTP
75 { "followup-message", OP_FOLLOWUP },
76#endif
77 { "forget-passphrase", OP_FORGET_PASSPHRASE },
78 { "forward-message", OP_FORWARD_MESSAGE },
79#ifdef USE_NNTP
80 { "forward-to-group", OP_FORWARD_TO_GROUP },
81#endif
82 { "group-chat-reply", OP_GROUP_CHAT_REPLY },
83 { "group-reply", OP_GROUP_REPLY },
84 { "list-reply", OP_LIST_REPLY },
85 { "list-subscribe", OP_LIST_SUBSCRIBE },
86 { "list-unsubscribe", OP_LIST_UNSUBSCRIBE },
87 { "pipe-entry", OP_PIPE },
88 { "pipe-message", OP_PIPE },
89 { "print-entry", OP_ATTACHMENT_PRINT },
90 { "reply", OP_REPLY },
91 { "resend-message", OP_RESEND },
92 { "save-entry", OP_ATTACHMENT_SAVE },
93 { "undelete-entry", OP_ATTACHMENT_UNDELETE },
94 { "view-attach", OP_ATTACHMENT_VIEW },
95 { "view-mailcap", OP_ATTACHMENT_VIEW_MAILCAP },
96 { "view-pager", OP_ATTACHMENT_VIEW_PAGER },
97 { "view-text", OP_ATTACHMENT_VIEW_TEXT },
98 { NULL, 0 },
99};
100
104const struct MenuOpSeq AttachmentDefaultBindings[] = { /* map: attachment */
105 { OP_ATTACHMENT_COLLAPSE, "v" },
106 { OP_ATTACHMENT_DELETE, "d" },
107 { OP_ATTACHMENT_EDIT_TYPE, "\005" }, // <Ctrl-E>
108 { OP_EXIT, "q" },
109 { OP_PIPE, "|" },
110 { OP_ATTACHMENT_PRINT, "p" },
111 { OP_ATTACHMENT_SAVE, "s" },
112 { OP_ATTACHMENT_UNDELETE, "u" },
113 { OP_ATTACHMENT_VIEW, "<keypadenter>" },
114 { OP_ATTACHMENT_VIEW, "\n" }, // <Enter>
115 { OP_ATTACHMENT_VIEW, "\r" }, // <Return>
116 { OP_ATTACHMENT_VIEW_MAILCAP, "m" },
117 { OP_ATTACHMENT_VIEW_TEXT, "T" },
118 { OP_BOUNCE_MESSAGE, "b" },
119 { OP_CHECK_TRADITIONAL, "\033P" }, // <Alt-P>
120 { OP_DISPLAY_HEADERS, "h" },
121 { OP_EXTRACT_KEYS, "\013" }, // <Ctrl-K>
122 { OP_FORGET_PASSPHRASE, "\006" }, // <Ctrl-F>
123 { OP_FORWARD_MESSAGE, "f" },
124 { OP_GROUP_REPLY, "g" },
125 { OP_LIST_REPLY, "L" },
126 { OP_REPLY, "r" },
127 { OP_RESEND, "\033e" }, // <Alt-e>
128 { 0, NULL },
129};
130// clang-format on
131
137static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
138{
139 int rindex, curlevel;
140
141 struct AttachPtr *cur_att = current_attachment(actx, menu);
142 cur_att->collapsed = !cur_att->collapsed;
143 /* When expanding, expand all the children too */
144 if (cur_att->collapsed)
145 return;
146
147 curlevel = cur_att->level;
148 const int index = menu_get_index(menu);
149 rindex = actx->v2r[index] + 1;
150
151 const bool c_digest_collapse = cs_subset_bool(NeoMutt->sub, "digest_collapse");
152 while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel))
153 {
154 if (c_digest_collapse && (actx->idx[rindex]->body->type == TYPE_MULTIPART) &&
155 mutt_istr_equal(actx->idx[rindex]->body->subtype, "digest"))
156 {
157 actx->idx[rindex]->collapsed = true;
158 }
159 else
160 {
161 actx->idx[rindex]->collapsed = false;
162 }
163 rindex++;
164 }
165}
166
172static bool check_attach(struct AttachPrivateData *priv)
173{
174 if (priv->attach_msg)
175 {
178 return true;
179 }
180
181 return false;
182}
183
189static bool check_readonly(struct Mailbox *m)
190{
191 if (!m || m->readonly)
192 {
194 mutt_error(_("Mailbox is read-only"));
195 return true;
196 }
197
198 return false;
199}
200
206static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
207{
208 if (menu->tag_prefix)
209 {
210 for (int i = 0; i < actx->idxlen; i++)
211 {
212 if (actx->idx[i]->body->tagged)
213 {
215 }
216 }
217 }
218 else
219 {
220 struct AttachPtr *cur_att = current_attachment(actx, menu);
222 }
223}
224
233static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
234{
235 int rc = 0;
236
237 if (menu->tag_prefix)
238 {
239 for (int i = 0; i < actx->idxlen; i++)
240 if (actx->idx[i]->body->tagged)
241 rc = rc || crypt_pgp_check_traditional(actx->idx[i]->fp, actx->idx[i]->body, true);
242 }
243 else
244 {
245 struct AttachPtr *cur_att = current_attachment(actx, menu);
246 rc = crypt_pgp_check_traditional(cur_att->fp, cur_att->body, true);
247 }
248
249 return rc;
250}
251
252// -----------------------------------------------------------------------------
253
257static int op_attachment_collapse(struct AttachPrivateData *priv, int op)
258{
259 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
260 if (!cur_att->body->parts)
261 {
262 mutt_error(_("There are no subparts to show"));
263 return FR_NO_ACTION;
264 }
265 attach_collapse(priv->actx, priv->menu);
266 mutt_update_recvattach_menu(priv->actx, priv->menu, false);
267 return FR_SUCCESS;
268}
269
273static int op_attachment_delete(struct AttachPrivateData *priv, int op)
274{
275 if (check_readonly(priv->mailbox))
276 return FR_ERROR;
277
278#ifdef USE_POP
279 if (priv->mailbox->type == MUTT_POP)
280 {
282 mutt_error(_("Can't delete attachment from POP server"));
283 return FR_ERROR;
284 }
285#endif
286
287#ifdef USE_NNTP
288 if (priv->mailbox->type == MUTT_NNTP)
289 {
291 mutt_error(_("Can't delete attachment from news server"));
292 return FR_ERROR;
293 }
294#endif
295
296 if ((WithCrypto != 0) && (priv->actx->email->security & SEC_ENCRYPT))
297 {
298 mutt_message(_("Deletion of attachments from encrypted messages is unsupported"));
299 return FR_ERROR;
300 }
301 if ((WithCrypto != 0) && (priv->actx->email->security & (SEC_SIGN | SEC_PARTSIGN)))
302 {
303 mutt_message(_("Deletion of attachments from signed messages may invalidate the signature"));
304 }
305
306 if (priv->menu->tag_prefix)
307 {
308 for (int i = 0; i < priv->menu->max; i++)
309 {
310 if (priv->actx->idx[i]->body->tagged)
311 {
312 if (priv->actx->idx[i]->parent_type == TYPE_MULTIPART)
313 {
314 priv->actx->idx[i]->body->deleted = true;
316 }
317 else
318 {
319 mutt_message(_("Only deletion of multipart attachments is supported"));
320 }
321 }
322 }
323 }
324 else
325 {
326 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
327 if (cur_att->parent_type == TYPE_MULTIPART)
328 {
329 cur_att->body->deleted = true;
330 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
331 const int index = menu_get_index(priv->menu) + 1;
332 if (c_resolve && (index < priv->menu->max))
333 {
334 menu_set_index(priv->menu, index);
335 }
336 else
337 {
339 }
340 }
341 else
342 {
343 mutt_message(_("Only deletion of multipart attachments is supported"));
344 }
345 }
346
347 return FR_SUCCESS;
348}
349
353static int op_attachment_edit_type(struct AttachPrivateData *priv, int op)
354{
355 recvattach_edit_content_type(priv->actx, priv->menu, priv->actx->email);
357 return FR_SUCCESS;
358}
359
363static int op_attachment_pipe(struct AttachPrivateData *priv, int op)
364{
365 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
366 mutt_pipe_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
367 cur_att->body, false);
368 return FR_SUCCESS;
369}
370
374static int op_attachment_print(struct AttachPrivateData *priv, int op)
375{
376 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
377 mutt_print_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
378 cur_att->body);
379 return FR_SUCCESS;
380}
381
385static int op_attachment_save(struct AttachPrivateData *priv, int op)
386{
387 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
388 mutt_save_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
389 cur_att->body, priv->actx->email, priv->menu);
390
391 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
392 const int index = menu_get_index(priv->menu) + 1;
393 if (!priv->menu->tag_prefix && c_resolve && (index < priv->menu->max))
394 menu_set_index(priv->menu, index);
395 return FR_SUCCESS;
396}
397
401static int op_attachment_undelete(struct AttachPrivateData *priv, int op)
402{
403 if (check_readonly(priv->mailbox))
404 return FR_ERROR;
405
406 if (priv->menu->tag_prefix)
407 {
408 for (int i = 0; i < priv->menu->max; i++)
409 {
410 if (priv->actx->idx[i]->body->tagged)
411 {
412 priv->actx->idx[i]->body->deleted = false;
414 }
415 }
416 }
417 else
418 {
419 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
420 cur_att->body->deleted = false;
421 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
422 const int index = menu_get_index(priv->menu) + 1;
423 if (c_resolve && (index < priv->menu->max))
424 {
425 menu_set_index(priv->menu, index);
426 }
427 else
428 {
430 }
431 }
432
433 return FR_SUCCESS;
434}
435
439static int op_attachment_view(struct AttachPrivateData *priv, int op)
440{
441 priv->op = mutt_attach_display_loop(priv->sub, priv->menu, op,
442 priv->actx->email, priv->actx, true);
444
445 return FR_CONTINUE;
446}
447
451static int op_attachment_view_mailcap(struct AttachPrivateData *priv, int op)
452{
453 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
454 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_MAILCAP,
455 priv->actx->email, priv->actx, priv->menu->win);
457 return FR_SUCCESS;
458}
459
463static int op_attachment_view_pager(struct AttachPrivateData *priv, int op)
464{
465 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
466 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_PAGER,
467 priv->actx->email, priv->actx, priv->menu->win);
469 return FR_SUCCESS;
470}
471
475static int op_attachment_view_text(struct AttachPrivateData *priv, int op)
476{
477 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
478 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_AS_TEXT,
479 priv->actx->email, priv->actx, priv->menu->win);
481 return FR_SUCCESS;
482}
483
487static int op_bounce_message(struct AttachPrivateData *priv, int op)
488{
489 if (check_attach(priv))
490 return FR_ERROR;
491 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
492 attach_bounce_message(priv->mailbox, cur_att->fp, priv->actx,
493 priv->menu->tag_prefix ? NULL : cur_att->body);
495 return FR_SUCCESS;
496}
497
501static int op_check_traditional(struct AttachPrivateData *priv, int op)
502{
503 if (((WithCrypto & APPLICATION_PGP) != 0) &&
505 {
506 priv->actx->email->security = crypt_query(NULL);
508 }
509 return FR_SUCCESS;
510}
511
515static int op_compose_to_sender(struct AttachPrivateData *priv, int op)
516{
517 if (check_attach(priv))
518 return FR_ERROR;
519 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
520 mutt_attach_mail_sender(priv->actx, priv->menu->tag_prefix ? NULL : cur_att->body);
522 return FR_SUCCESS;
523}
524
528static int op_exit(struct AttachPrivateData *priv, int op)
529{
530 priv->actx->email->attach_del = false;
531 for (int i = 0; i < priv->actx->idxlen; i++)
532 {
533 if (priv->actx->idx[i]->body && priv->actx->idx[i]->body->deleted)
534 {
535 priv->actx->email->attach_del = true;
536 break;
537 }
538 }
539 if (priv->actx->email->attach_del)
540 priv->actx->email->changed = true;
541
542 mutt_actx_free(&priv->actx);
543 return FR_DONE;
544}
545
549static int op_extract_keys(struct AttachPrivateData *priv, int op)
550{
552 return FR_NO_ACTION;
553
556
557 return FR_SUCCESS;
558}
559
563static int op_forget_passphrase(struct AttachPrivateData *priv, int op)
564{
566 return FR_SUCCESS;
567}
568
572static int op_forward_message(struct AttachPrivateData *priv, int op)
573{
574 if (check_attach(priv))
575 return FR_ERROR;
576 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
577 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
578 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NO_FLAGS);
580 return FR_SUCCESS;
581}
582
586static int op_list_subscribe(struct AttachPrivateData *priv, int op)
587{
588 if (!check_attach(priv))
590 return FR_SUCCESS;
591}
592
596static int op_list_unsubscribe(struct AttachPrivateData *priv, int op)
597{
598 if (!check_attach(priv))
600 return FR_SUCCESS;
601}
602
606static int op_reply(struct AttachPrivateData *priv, int op)
607{
608 if (check_attach(priv))
609 return FR_ERROR;
610
611 SendFlags flags = SEND_REPLY;
612 if (op == OP_GROUP_REPLY)
613 flags |= SEND_GROUP_REPLY;
614 else if (op == OP_GROUP_CHAT_REPLY)
615 flags |= SEND_GROUP_CHAT_REPLY;
616 else if (op == OP_LIST_REPLY)
617 flags |= SEND_LIST_REPLY;
618
619 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
620 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
621 priv->menu->tag_prefix ? NULL : cur_att->body, flags);
623 return FR_SUCCESS;
624}
625
629static int op_resend(struct AttachPrivateData *priv, int op)
630{
631 if (check_attach(priv))
632 return FR_ERROR;
633 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
634 mutt_attach_resend(cur_att->fp, priv->mailbox, priv->actx,
635 priv->menu->tag_prefix ? NULL : cur_att->body);
637 return FR_SUCCESS;
638}
639
640// -----------------------------------------------------------------------------
641
642#ifdef USE_NNTP
646static int op_followup(struct AttachPrivateData *priv, int op)
647{
648 if (check_attach(priv))
649 return FR_ERROR;
650
651 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
652 if (!cur_att->body->email->env->followup_to ||
653 !mutt_istr_equal(cur_att->body->email->env->followup_to, "poster") ||
654 (query_quadoption(_("Reply by mail as poster prefers?"), NeoMutt->sub,
655 "followup_to_poster") != MUTT_YES))
656 {
657 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
658 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS | SEND_REPLY);
660 return FR_SUCCESS;
661 }
662
663 return op_reply(priv, op);
664}
665
669static int op_forward_to_group(struct AttachPrivateData *priv, int op)
670{
671 if (check_attach(priv))
672 return FR_ERROR;
673 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
674 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
675 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS);
677 return FR_SUCCESS;
678}
679#endif
680
681// -----------------------------------------------------------------------------
682
686static const struct AttachFunction AttachFunctions[] = {
687 // clang-format off
688 { OP_ATTACHMENT_COLLAPSE, op_attachment_collapse },
689 { OP_ATTACHMENT_DELETE, op_attachment_delete },
690 { OP_ATTACHMENT_EDIT_TYPE, op_attachment_edit_type },
691 { OP_PIPE, op_attachment_pipe },
692 { OP_ATTACHMENT_PRINT, op_attachment_print },
693 { OP_ATTACHMENT_SAVE, op_attachment_save },
694 { OP_ATTACHMENT_UNDELETE, op_attachment_undelete },
695 { OP_ATTACHMENT_VIEW, op_attachment_view },
696 { OP_ATTACHMENT_VIEW_MAILCAP, op_attachment_view_mailcap },
697 { OP_ATTACHMENT_VIEW_PAGER, op_attachment_view_pager },
698 { OP_ATTACHMENT_VIEW_TEXT, op_attachment_view_text },
699 { OP_BOUNCE_MESSAGE, op_bounce_message },
700 { OP_CHECK_TRADITIONAL, op_check_traditional },
701 { OP_COMPOSE_TO_SENDER, op_compose_to_sender },
702 { OP_DISPLAY_HEADERS, op_attachment_view },
703 { OP_EXIT, op_exit },
704 { OP_EXTRACT_KEYS, op_extract_keys },
705#ifdef USE_NNTP
706 { OP_FOLLOWUP, op_followup },
707#endif
708 { OP_FORGET_PASSPHRASE, op_forget_passphrase },
709 { OP_FORWARD_MESSAGE, op_forward_message },
710#ifdef USE_NNTP
711 { OP_FORWARD_TO_GROUP, op_forward_to_group },
712#endif
713 { OP_GROUP_CHAT_REPLY, op_reply },
714 { OP_GROUP_REPLY, op_reply },
715 { OP_LIST_REPLY, op_reply },
716 { OP_LIST_SUBSCRIBE, op_list_subscribe },
717 { OP_LIST_UNSUBSCRIBE, op_list_unsubscribe },
718 { OP_REPLY, op_reply },
719 { OP_RESEND, op_resend },
720 { 0, NULL },
721 // clang-format on
722};
723
728{
729 if (!win)
730 {
732 return FR_ERROR;
733 }
734
735 struct Menu *menu = win->wdata;
736 struct AttachPrivateData *priv = menu->mdata;
737 if (!priv)
738 return FR_ERROR;
739
740 int rc = FR_UNKNOWN;
741 for (size_t i = 0; AttachFunctions[i].op != OP_NULL; i++)
742 {
743 const struct AttachFunction *fn = &AttachFunctions[i];
744 if (fn->op == op)
745 {
746 rc = fn->function(priv, op);
747 break;
748 }
749 }
750
751 return rc;
752}
void mutt_actx_free(struct AttachCtx **ptr)
Free an Attachment Context.
Definition: attach.c:198
const struct MenuOpSeq AttachmentDefaultBindings[]
Key bindings for the Attachment Menu.
Definition: functions.c:104
static bool check_attach(struct AttachPrivateData *priv)
Check if in attach-message mode.
Definition: functions.c:172
static const char * Not_available_in_this_menu
Error message for unavailable functions.
Definition: functions.c:55
static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
Close the tree of the current attachment.
Definition: functions.c:137
static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
Is the Attachment inline PGP?
Definition: functions.c:233
const struct MenuFuncOp OpAttachment[]
Functions for the Attachment Menu.
Definition: functions.c:64
static const char * Function_not_permitted_in_attach_message_mode
Error message for unavailable functions in attach mode.
Definition: functions.c:57
static const struct AttachFunction AttachFunctions[]
All the NeoMutt functions that the Attach supports.
Definition: functions.c:686
static bool check_readonly(struct Mailbox *m)
Check if the Mailbox is readonly.
Definition: functions.c:189
static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
Extract PGP keys from attachments.
Definition: functions.c:206
Handling of email attachments.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition: crypt.c:93
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition: crypt.c:676
bool crypt_pgp_check_traditional(FILE *fp, struct Body *b, bool just_one)
Wrapper for CryptModuleSpecs::pgp_check_traditional()
Definition: cryptglue.c:283
void crypt_pgp_extract_key_from_attachment(FILE *fp, struct Body *top)
Wrapper for CryptModuleSpecs::pgp_extract_key_from_attachment()
Definition: cryptglue.c:395
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: get.c:57
@ FR_SUCCESS
Valid function - successfully performed.
Definition: dispatcher.h:39
@ FR_DONE
Exit the Dialog.
Definition: dispatcher.h:35
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
@ FR_ERROR
Valid function - error occurred.
Definition: dispatcher.h:38
@ FR_CONTINUE
Remain in the Dialog.
Definition: dispatcher.h:34
@ FR_NO_ACTION
Valid function - no action performed.
Definition: dispatcher.h:37
Structs that make up an email.
static int op_exit(struct AliasMenuData *mdata, int op)
exit this menu - Implements alias_function_t -
Definition: functions.c:190
static int op_attachment_print(struct AttachPrivateData *priv, int op)
print the current entry - Implements attach_function_t -
Definition: functions.c:374
static int op_followup(struct AttachPrivateData *priv, int op)
followup to newsgroup - Implements attach_function_t -
Definition: functions.c:646
static int op_forward_message(struct AttachPrivateData *priv, int op)
forward a message with comments - Implements attach_function_t -
Definition: functions.c:572
static int op_attachment_collapse(struct AttachPrivateData *priv, int op)
toggle display of subparts - Implements attach_function_t -
Definition: functions.c:257
static int op_bounce_message(struct AttachPrivateData *priv, int op)
remail a message to another user - Implements attach_function_t -
Definition: functions.c:487
static int op_attachment_edit_type(struct AttachPrivateData *priv, int op)
edit attachment content type - Implements attach_function_t -
Definition: functions.c:353
static int op_extract_keys(struct AttachPrivateData *priv, int op)
extract supported public keys - Implements attach_function_t -
Definition: functions.c:549
static int op_reply(struct AttachPrivateData *priv, int op)
reply to a message - Implements attach_function_t -
Definition: functions.c:606
static int op_attachment_view(struct AttachPrivateData *priv, int op)
view attachment using mailcap entry if necessary - Implements attach_function_t -
Definition: functions.c:439
static int op_forward_to_group(struct AttachPrivateData *priv, int op)
forward to newsgroup - Implements attach_function_t -
Definition: functions.c:669
static int op_attachment_view_mailcap(struct AttachPrivateData *priv, int op)
force viewing of attachment using mailcap - Implements attach_function_t -
Definition: functions.c:451
static int op_compose_to_sender(struct AttachPrivateData *priv, int op)
compose new message to the current message sender - Implements attach_function_t -
Definition: functions.c:515
static int op_attachment_pipe(struct AttachPrivateData *priv, int op)
pipe message/attachment to a shell command - Implements attach_function_t -
Definition: functions.c:363
static int op_attachment_view_pager(struct AttachPrivateData *priv, int op)
view attachment in pager using copiousoutput mailcap - Implements attach_function_t -
Definition: functions.c:463
static int op_forget_passphrase(struct AttachPrivateData *priv, int op)
wipe passphrases from memory - Implements attach_function_t -
Definition: functions.c:563
static int op_attachment_undelete(struct AttachPrivateData *priv, int op)
undelete the current entry - Implements attach_function_t -
Definition: functions.c:401
static int op_list_subscribe(struct AttachPrivateData *priv, int op)
subscribe to a mailing list - Implements attach_function_t -
Definition: functions.c:586
static int op_attachment_delete(struct AttachPrivateData *priv, int op)
delete the current entry - Implements attach_function_t -
Definition: functions.c:273
static int op_attachment_save(struct AttachPrivateData *priv, int op)
save message/attachment to a mailbox/file - Implements attach_function_t -
Definition: functions.c:385
static int op_attachment_view_text(struct AttachPrivateData *priv, int op)
view attachment as text - Implements attach_function_t -
Definition: functions.c:475
static int op_list_unsubscribe(struct AttachPrivateData *priv, int op)
unsubscribe from a mailing list - Implements attach_function_t -
Definition: functions.c:596
static int op_check_traditional(struct AttachPrivateData *priv, int op)
check for classic PGP - Implements attach_function_t -
Definition: functions.c:501
static int op_resend(struct AttachPrivateData *priv, int op)
use the current message as a template for a new one - Implements attach_function_t -
Definition: functions.c:629
int attach_function_dispatcher(struct MuttWindow *win, int op)
Perform a Attach function - Implements function_dispatcher_t -.
Definition: functions.c:727
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_message(...)
Definition: logging2.h:91
Convenience wrapper for the gui headers.
Manage keymappings.
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:52
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
GUI present the user with a selectable list.
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:60
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:57
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:180
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:156
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:59
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:170
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition: mime.h:37
Convenience wrapper for the library headers.
#define N_(a)
Definition: message.h:32
#define _(a)
Definition: message.h:28
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:810
int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx, struct MuttWindow *win)
View an attachment.
Definition: mutt_attach.c:423
Handling of email attachments.
void mutt_save_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, struct Email *e, struct Menu *menu)
Save a list of attachments.
Definition: recvattach.c:429
@ MUTT_VA_MAILCAP
Force viewing using mailcap entry.
Definition: mutt_attach.h:45
@ MUTT_VA_PAGER
View attachment in pager using copiousoutput mailcap.
Definition: mutt_attach.h:47
@ MUTT_VA_AS_TEXT
Force viewing as text.
Definition: mutt_attach.h:46
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:958
void mutt_pipe_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, bool filter)
Pipe a list of attachments to a command.
Definition: recvattach.c:721
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top)
Print a list of Attachments.
Definition: recvattach.c:884
API for encryption/signing of emails.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:91
#define SEC_PARTSIGN
Not all parts of the email is signed.
Definition: lib.h:83
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:79
#define WithCrypto
Definition: lib.h:117
#define SEC_SIGN
Email is signed.
Definition: lib.h:80
Private state data for the Pager.
@ 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:369
void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
Definition: recvattach.c:1208
struct AttachPtr * current_attachment(struct AttachCtx *actx, struct Menu *menu)
Get the current attachment.
Definition: recvattach.c:71
void recvattach_edit_content_type(struct AttachCtx *actx, struct Menu *menu, struct Email *e)
Edit the content type of an attachment.
Definition: recvattach.c:928
Routines for managing attachments.
void mutt_attach_forward(FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *cur, SendFlags flags)
Forward an Attachment.
Definition: recvcmd.c:788
void mutt_attach_mail_sender(struct AttachCtx *actx, struct Body *cur)
Compose an email to the sender in the email attachment.
Definition: recvcmd.c:1125
void mutt_attach_resend(FILE *fp, struct Mailbox *m, struct AttachCtx *actx, struct Body *cur)
Resend-message, from the attachment menu.
Definition: recvcmd.c:287
void mutt_attach_reply(FILE *fp, struct Mailbox *m, struct Email *e, struct AttachCtx *actx, struct Body *e_cur, SendFlags flags)
Attach a reply.
Definition: recvcmd.c:946
void attach_bounce_message(struct Mailbox *m, FILE *fp, struct AttachCtx *actx, struct Body *cur)
Bounce function, from the attachment menu.
Definition: recvcmd.c:163
Send/reply with an attachment.
Convenience wrapper for the send headers.
bool mutt_send_list_unsubscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list unsubscription email.
Definition: send.c:3069
bool mutt_send_list_subscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list subscription email.
Definition: send.c:3040
#define SEND_GROUP_CHAT_REPLY
Reply to all recipients preserving To/Cc.
Definition: send.h:52
#define SEND_GROUP_REPLY
Reply to all.
Definition: send.h:41
#define SEND_LIST_REPLY
Reply to mailing list.
Definition: send.h:42
#define SEND_NO_FLAGS
No flags are set.
Definition: send.h:39
#define SEND_REPLY
Reply to sender.
Definition: send.h:40
#define SEND_NEWS
Reply to a news article.
Definition: send.h:53
uint16_t SendFlags
Flags for mutt_send_message(), e.g. SEND_REPLY.
Definition: send.h:38
Sidebar functions.
A set of attachments.
Definition: attach.h:51
struct Email * email
Used by recvattach for updating.
Definition: attach.h:52
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:55
short idxlen
Number of attachmentes.
Definition: attach.h:56
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:59
A NeoMutt function.
Definition: functions.h:45
attach_function_t function
Function to call.
Definition: functions.h:47
int op
Op code, e.g. OP_ATTACHMENT_COLLAPSE.
Definition: functions.h:46
Private state data for Attachments.
Definition: private_data.h:35
int op
Op returned from the Pager, e.g. OP_NEXT_ENTRY.
Definition: private_data.h:40
struct Menu * menu
Current Menu.
Definition: private_data.h:36
struct ConfigSubset * sub
Config subset.
Definition: private_data.h:38
struct AttachCtx * actx
List of all Attachments.
Definition: private_data.h:37
bool attach_msg
Are we in "attach message" mode?
Definition: private_data.h:41
struct Mailbox * mailbox
Current Mailbox.
Definition: private_data.h:39
An email to which things will be attached.
Definition: attach.h:35
struct Body * body
Attachment.
Definition: attach.h:36
bool collapsed
Group is collapsed.
Definition: attach.h:44
int level
Nesting depth of attachment.
Definition: attach.h:40
FILE * fp
Used in the recvattach menu.
Definition: attach.h:37
int parent_type
Type of parent attachment, e.g. TYPE_MULTIPART.
Definition: attach.h:38
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:72
bool deleted
Attachment marked for deletion.
Definition: body.h:87
struct Email * email
header information for message/rfc822
Definition: body.h:73
bool tagged
This attachment is tagged.
Definition: body.h:89
char * subtype
content-type subtype
Definition: body.h:60
unsigned int type
content-type primary type, ContentType
Definition: body.h:40
struct Envelope * env
Envelope information.
Definition: email.h:66
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:41
bool changed
Email has been edited.
Definition: email.h:75
bool attach_del
Has an attachment marked for deletion.
Definition: email.h:98
char * followup_to
List of 'followup-to' fields.
Definition: envelope.h:81
A mailbox.
Definition: mailbox.h:79
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
bool readonly
Don't allow changes to the mailbox.
Definition: mailbox.h:115
Mapping between a function and an operation.
Definition: lib.h:102
Mapping between an operation and a key sequence.
Definition: lib.h:111
Definition: lib.h:70
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:77
void * mdata
Private data.
Definition: lib.h:137
bool tag_prefix
User has pressed <tag-prefix>
Definition: lib.h:76
int max
Number of entries in the menu.
Definition: lib.h:72
void * wdata
Private data.
Definition: mutt_window.h:145
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45