NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c
Go to the documentation of this file.
1
23
29
30#include "config.h"
31#include <stdbool.h>
32#include <stdio.h>
33#include "mutt/lib.h"
34#include "config/lib.h"
35#include "email/lib.h"
36#include "core/lib.h"
37#include "gui/lib.h"
38#include "functions.h"
39#include "key/lib.h"
40#include "menu/lib.h"
41#include "ncrypt/lib.h"
42#include "question/lib.h"
43#include "send/lib.h"
44#include "attach.h"
45#include "mutt_attach.h"
46#include "private_data.h"
47#include "recvattach.h"
48#include "recvcmd.h"
49
52 "Function not permitted in attach-message mode");
53
55struct MenuDefinition *MdAttach = NULL;
56
57// clang-format off
61static const struct MenuFuncOp OpAttach[] = { /* map: attach */
62 { "bounce-message", OP_BOUNCE_MESSAGE },
63 { "check-traditional-pgp", OP_CHECK_TRADITIONAL },
64 { "collapse-parts", OP_ATTACH_COLLAPSE },
65 { "compose-to-sender", OP_COMPOSE_TO_SENDER },
66 { "delete-entry", OP_ATTACH_DELETE },
67 { "display-toggle-weed", OP_DISPLAY_HEADERS },
68 { "edit-type", OP_ATTACH_EDIT_TYPE },
69 { "exit", OP_EXIT },
70 { "extract-keys", OP_EXTRACT_KEYS },
71 { "followup-message", OP_FOLLOWUP },
72 { "forget-passphrase", OP_FORGET_PASSPHRASE },
73 { "forward-message", OP_FORWARD_MESSAGE },
74 { "forward-to-group", OP_FORWARD_TO_GROUP },
75 { "group-chat-reply", OP_GROUP_CHAT_REPLY },
76 { "group-reply", OP_GROUP_REPLY },
77 { "list-reply", OP_LIST_REPLY },
78 { "list-subscribe", OP_LIST_SUBSCRIBE },
79 { "list-unsubscribe", OP_LIST_UNSUBSCRIBE },
80 { "pipe-entry", OP_PIPE },
81 { "pipe-message", OP_PIPE },
82 { "print-entry", OP_ATTACH_PRINT },
83 { "reply", OP_REPLY },
84 { "resend-message", OP_RESEND },
85 { "save-entry", OP_ATTACH_SAVE },
86 { "undelete-entry", OP_ATTACH_UNDELETE },
87 { "view-attach", OP_ATTACH_VIEW },
88 { "view-mailcap", OP_ATTACH_VIEW_MAILCAP },
89 { "view-pager", OP_ATTACH_VIEW_PAGER },
90 { "view-text", OP_ATTACH_VIEW_TEXT },
91 { NULL, 0 },
92};
93
97static const struct MenuOpSeq AttachmentDefaultBindings[] = { /* map: attach */
98 { OP_ATTACH_COLLAPSE, "v" },
99 { OP_ATTACH_DELETE, "d" },
100 { OP_ATTACH_EDIT_TYPE, "\005" }, // <Ctrl-E>
101 { OP_EXIT, "q" },
102 { OP_PIPE, "|" },
103 { OP_ATTACH_PRINT, "p" },
104 { OP_ATTACH_SAVE, "s" },
105 { OP_ATTACH_UNDELETE, "u" },
106 { OP_ATTACH_VIEW, "<keypadenter>" },
107 { OP_ATTACH_VIEW, "\n" }, // <Enter>
108 { OP_ATTACH_VIEW, "\r" }, // <Return>
109 { OP_ATTACH_VIEW_MAILCAP, "m" },
110 { OP_ATTACH_VIEW_TEXT, "T" },
111 { OP_BOUNCE_MESSAGE, "b" },
112 { OP_CHECK_TRADITIONAL, "\033P" }, // <Alt-P>
113 { OP_DISPLAY_HEADERS, "h" },
114 { OP_EXTRACT_KEYS, "\013" }, // <Ctrl-K>
115 { OP_FORGET_PASSPHRASE, "\006" }, // <Ctrl-F>
116 { OP_FORWARD_MESSAGE, "f" },
117 { OP_GROUP_REPLY, "g" },
118 { OP_LIST_REPLY, "L" },
119 { OP_REPLY, "r" },
120 { OP_RESEND, "\033e" }, // <Alt-e>
121 { 0, NULL },
122};
123// clang-format on
124
128void attach_init_keys(struct SubMenu *sm_generic)
129{
130 struct MenuDefinition *md = NULL;
131 struct SubMenu *sm = NULL;
132
134 md = km_register_menu(MENU_ATTACH, "attach");
135 km_menu_add_submenu(md, sm);
136 km_menu_add_submenu(md, sm_generic);
138
139 MdAttach = md;
140}
141
147static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
148{
149 int rindex, curlevel;
150
151 struct AttachPtr *cur_att = current_attachment(actx, menu);
152 cur_att->collapsed = !cur_att->collapsed;
153 /* When expanding, expand all the children too */
154 if (cur_att->collapsed)
155 return;
156
157 curlevel = cur_att->level;
158 const int index = menu_get_index(menu);
159 rindex = actx->v2r[index] + 1;
160
161 const bool c_digest_collapse = cs_subset_bool(NeoMutt->sub, "digest_collapse");
162 while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel))
163 {
164 if (c_digest_collapse && (actx->idx[rindex]->body->type == TYPE_MULTIPART) &&
165 mutt_istr_equal(actx->idx[rindex]->body->subtype, "digest"))
166 {
167 actx->idx[rindex]->collapsed = true;
168 }
169 else
170 {
171 actx->idx[rindex]->collapsed = false;
172 }
173 rindex++;
174 }
175}
176
182static bool check_attach(struct AttachPrivateData *priv)
183{
184 if (priv->attach_msg)
185 {
188 return true;
189 }
190
191 return false;
192}
193
199static bool check_readonly(struct Mailbox *m)
200{
201 if (!m || m->readonly)
202 {
204 mutt_error(_("Mailbox is read-only"));
205 return true;
206 }
207
208 return false;
209}
210
216static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
217{
218 if (menu->tag_prefix)
219 {
220 for (int i = 0; i < actx->idxlen; i++)
221 {
222 if (actx->idx[i]->body->tagged)
223 {
225 }
226 }
227 }
228 else
229 {
230 struct AttachPtr *cur_att = current_attachment(actx, menu);
232 }
233}
234
243static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
244{
245 int rc = 0;
246
247 if (menu->tag_prefix)
248 {
249 for (int i = 0; i < actx->idxlen; i++)
250 if (actx->idx[i]->body->tagged)
251 rc = rc || crypt_pgp_check_traditional(actx->idx[i]->fp, actx->idx[i]->body, true);
252 }
253 else
254 {
255 struct AttachPtr *cur_att = current_attachment(actx, menu);
256 rc = crypt_pgp_check_traditional(cur_att->fp, cur_att->body, true);
257 }
258
259 return rc;
260}
261
262// -----------------------------------------------------------------------------
263
267static int op_attach_collapse(struct AttachPrivateData *priv, const struct KeyEvent *event)
268{
269 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
270 if (!cur_att->body->parts)
271 {
272 mutt_error(_("There are no subparts to show"));
273 return FR_NO_ACTION;
274 }
275 attach_collapse(priv->actx, priv->menu);
276 mutt_update_recvattach_menu(priv->actx, priv->menu, false);
277 return FR_SUCCESS;
278}
279
283static int op_attach_delete(struct AttachPrivateData *priv, const struct KeyEvent *event)
284{
285 if (check_readonly(priv->mailbox))
286 return FR_ERROR;
287
288 if (priv->mailbox->type == MUTT_POP)
289 {
291 mutt_error(_("Can't delete attachment from POP server"));
292 return FR_ERROR;
293 }
294
295 if (priv->mailbox->type == MUTT_NNTP)
296 {
298 mutt_error(_("Can't delete attachment from news server"));
299 return FR_ERROR;
300 }
301
302 if ((WithCrypto != 0) && (priv->actx->email->security & SEC_ENCRYPT))
303 {
304 mutt_message(_("Deletion of attachments from encrypted messages is unsupported"));
305 return FR_ERROR;
306 }
307 if ((WithCrypto != 0) && (priv->actx->email->security & (SEC_SIGN | SEC_PARTSIGN)))
308 {
309 mutt_message(_("Deletion of attachments from signed messages may invalidate the signature"));
310 }
311
312 if (priv->menu->tag_prefix)
313 {
314 for (int i = 0; i < priv->menu->max; i++)
315 {
316 if (priv->actx->idx[i]->body->tagged)
317 {
318 if (priv->actx->idx[i]->parent_type == TYPE_MULTIPART)
319 {
320 priv->actx->idx[i]->body->deleted = true;
322 }
323 else
324 {
325 mutt_message(_("Only deletion of multipart attachments is supported"));
326 }
327 }
328 }
329 }
330 else
331 {
332 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
333 if (cur_att->parent_type == TYPE_MULTIPART)
334 {
335 cur_att->body->deleted = true;
336 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
337 const int index = menu_get_index(priv->menu) + 1;
338 if (c_resolve && (index < priv->menu->max))
339 {
340 menu_set_index(priv->menu, index);
341 }
342 else
343 {
345 }
346 }
347 else
348 {
349 mutt_message(_("Only deletion of multipart attachments is supported"));
350 }
351 }
352
353 return FR_SUCCESS;
354}
355
359static int op_attach_edit_type(struct AttachPrivateData *priv, const struct KeyEvent *event)
360{
361 recvattach_edit_content_type(priv->actx, priv->menu, priv->actx->email);
363 return FR_SUCCESS;
364}
365
369static int op_attach_pipe(struct AttachPrivateData *priv, const struct KeyEvent *event)
370{
371 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
372 mutt_pipe_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
373 cur_att->body, false);
374 return FR_SUCCESS;
375}
376
380static int op_attach_print(struct AttachPrivateData *priv, const struct KeyEvent *event)
381{
382 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
383 mutt_print_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
384 cur_att->body);
385 return FR_SUCCESS;
386}
387
391static int op_attach_save(struct AttachPrivateData *priv, const struct KeyEvent *event)
392{
393 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
394 mutt_save_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
395 cur_att->body, priv->actx->email, priv->menu);
396
397 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
398 const int index = menu_get_index(priv->menu) + 1;
399 if (!priv->menu->tag_prefix && c_resolve && (index < priv->menu->max))
400 menu_set_index(priv->menu, index);
401 return FR_SUCCESS;
402}
403
407static int op_attach_undelete(struct AttachPrivateData *priv, const struct KeyEvent *event)
408{
409 if (check_readonly(priv->mailbox))
410 return FR_ERROR;
411
412 if (priv->menu->tag_prefix)
413 {
414 for (int i = 0; i < priv->menu->max; i++)
415 {
416 if (priv->actx->idx[i]->body->tagged)
417 {
418 priv->actx->idx[i]->body->deleted = false;
420 }
421 }
422 }
423 else
424 {
425 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
426 cur_att->body->deleted = false;
427 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
428 const int index = menu_get_index(priv->menu) + 1;
429 if (c_resolve && (index < priv->menu->max))
430 {
431 menu_set_index(priv->menu, index);
432 }
433 else
434 {
436 }
437 }
438
439 return FR_SUCCESS;
440}
441
445static int op_attach_view(struct AttachPrivateData *priv, const struct KeyEvent *event)
446{
447 priv->op = mutt_attach_display_loop(priv->sub, priv->menu, event->op,
448 priv->actx->email, priv->actx, true);
450
451 return FR_CONTINUE;
452}
453
457static int op_attach_view_mailcap(struct AttachPrivateData *priv, const struct KeyEvent *event)
458{
459 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
460 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_MAILCAP,
461 priv->actx->email, priv->actx, priv->menu->win);
463 return FR_SUCCESS;
464}
465
469static int op_attach_view_pager(struct AttachPrivateData *priv, const struct KeyEvent *event)
470{
471 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
472 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_PAGER,
473 priv->actx->email, priv->actx, priv->menu->win);
475 return FR_SUCCESS;
476}
477
481static int op_attach_view_text(struct AttachPrivateData *priv, const struct KeyEvent *event)
482{
483 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
484 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_AS_TEXT,
485 priv->actx->email, priv->actx, priv->menu->win);
487 return FR_SUCCESS;
488}
489
493static int op_bounce_message(struct AttachPrivateData *priv, const struct KeyEvent *event)
494{
495 if (check_attach(priv))
496 return FR_ERROR;
497 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
498 attach_bounce_message(priv->mailbox, cur_att->fp, priv->actx,
499 priv->menu->tag_prefix ? NULL : cur_att->body);
501 return FR_SUCCESS;
502}
503
507static int op_check_traditional(struct AttachPrivateData *priv, const struct KeyEvent *event)
508{
509 if (((WithCrypto & APPLICATION_PGP) != 0) &&
511 {
512 priv->actx->email->security = crypt_query(NULL);
514 }
515 return FR_SUCCESS;
516}
517
521static int op_compose_to_sender(struct AttachPrivateData *priv, const struct KeyEvent *event)
522{
523 if (check_attach(priv))
524 return FR_ERROR;
525 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
526 mutt_attach_mail_sender(priv->actx, priv->menu->tag_prefix ? NULL : cur_att->body);
528 return FR_SUCCESS;
529}
530
534static int op_exit(struct AttachPrivateData *priv, const struct KeyEvent *event)
535{
536 priv->actx->email->attach_del = false;
537 for (int i = 0; i < priv->actx->idxlen; i++)
538 {
539 if (priv->actx->idx[i]->body && priv->actx->idx[i]->body->deleted)
540 {
541 priv->actx->email->attach_del = true;
542 break;
543 }
544 }
545 if (priv->actx->email->attach_del)
546 priv->actx->email->changed = true;
547
548 mutt_actx_free(&priv->actx);
549 return FR_DONE;
550}
551
555static int op_extract_keys(struct AttachPrivateData *priv, const struct KeyEvent *event)
556{
558 return FR_NO_ACTION;
559
562
563 return FR_SUCCESS;
564}
565
569static int op_forget_passphrase(struct AttachPrivateData *priv, const struct KeyEvent *event)
570{
572 return FR_SUCCESS;
573}
574
578static int op_forward_message(struct AttachPrivateData *priv, const struct KeyEvent *event)
579{
580 if (check_attach(priv))
581 return FR_ERROR;
582 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
583 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
584 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NO_FLAGS);
586 return FR_SUCCESS;
587}
588
592static int op_list_subscribe(struct AttachPrivateData *priv, const struct KeyEvent *event)
593{
594 if (!check_attach(priv))
596 return FR_SUCCESS;
597}
598
602static int op_list_unsubscribe(struct AttachPrivateData *priv, const struct KeyEvent *event)
603{
604 if (!check_attach(priv))
606 return FR_SUCCESS;
607}
608
612static int op_reply(struct AttachPrivateData *priv, const struct KeyEvent *event)
613{
614 if (check_attach(priv))
615 return FR_ERROR;
616
617 const int op = event->op;
618 SendFlags flags = SEND_REPLY;
619 if (op == OP_GROUP_REPLY)
620 flags |= SEND_GROUP_REPLY;
621 else if (op == OP_GROUP_CHAT_REPLY)
622 flags |= SEND_GROUP_CHAT_REPLY;
623 else if (op == OP_LIST_REPLY)
624 flags |= SEND_LIST_REPLY;
625
626 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
627 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
628 priv->menu->tag_prefix ? NULL : cur_att->body, flags);
630 return FR_SUCCESS;
631}
632
636static int op_resend(struct AttachPrivateData *priv, const struct KeyEvent *event)
637{
638 if (check_attach(priv))
639 return FR_ERROR;
640 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
641 mutt_attach_resend(cur_att->fp, priv->mailbox, priv->actx,
642 priv->menu->tag_prefix ? NULL : cur_att->body);
644 return FR_SUCCESS;
645}
646
647// -----------------------------------------------------------------------------
648
652static int op_followup(struct AttachPrivateData *priv, const struct KeyEvent *event)
653{
654 if (check_attach(priv))
655 return FR_ERROR;
656
657 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
658 if (!cur_att->body->email || !cur_att->body->email->env)
659 {
660 mutt_error(_("You may only followup to message/rfc822 parts"));
661 return FR_ERROR;
662 }
663 if (!cur_att->body->email->env->followup_to ||
664 !mutt_istr_equal(cur_att->body->email->env->followup_to, "poster") ||
665 (query_quadoption(_("Reply by mail as poster prefers?"), NeoMutt->sub,
666 "followup_to_poster") != MUTT_YES))
667 {
668 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
669 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS | SEND_REPLY);
671 return FR_SUCCESS;
672 }
673
674 return op_reply(priv, event);
675}
676
680static int op_forward_to_group(struct AttachPrivateData *priv, const struct KeyEvent *event)
681{
682 if (check_attach(priv))
683 return FR_ERROR;
684 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
685 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
686 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS);
688 return FR_SUCCESS;
689}
690
691// -----------------------------------------------------------------------------
692
696static const struct AttachFunction AttachFunctions[] = {
697 // clang-format off
698 { OP_ATTACH_COLLAPSE, op_attach_collapse },
699 { OP_ATTACH_DELETE, op_attach_delete },
700 { OP_ATTACH_EDIT_TYPE, op_attach_edit_type },
701 { OP_ATTACH_PRINT, op_attach_print },
702 { OP_ATTACH_SAVE, op_attach_save },
703 { OP_ATTACH_UNDELETE, op_attach_undelete },
704 { OP_ATTACH_VIEW, op_attach_view },
705 { OP_ATTACH_VIEW_MAILCAP, op_attach_view_mailcap },
706 { OP_ATTACH_VIEW_PAGER, op_attach_view_pager },
707 { OP_ATTACH_VIEW_TEXT, op_attach_view_text },
708 { OP_BOUNCE_MESSAGE, op_bounce_message },
709 { OP_CHECK_TRADITIONAL, op_check_traditional },
710 { OP_COMPOSE_TO_SENDER, op_compose_to_sender },
711 { OP_DISPLAY_HEADERS, op_attach_view },
712 { OP_EXIT, op_exit },
713 { OP_EXTRACT_KEYS, op_extract_keys },
714 { OP_FOLLOWUP, op_followup },
715 { OP_FORGET_PASSPHRASE, op_forget_passphrase },
716 { OP_FORWARD_MESSAGE, op_forward_message },
717 { OP_FORWARD_TO_GROUP, op_forward_to_group },
718 { OP_GROUP_CHAT_REPLY, op_reply },
719 { OP_GROUP_REPLY, op_reply },
720 { OP_LIST_REPLY, op_reply },
721 { OP_LIST_SUBSCRIBE, op_list_subscribe },
722 { OP_LIST_UNSUBSCRIBE, op_list_unsubscribe },
723 { OP_PIPE, op_attach_pipe },
724 { OP_REPLY, op_reply },
725 { OP_RESEND, op_resend },
726 { 0, NULL },
727 // clang-format on
728};
729
733int attach_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
734{
735 // The Dispatcher may be called on any Window in the Dialog
736 struct MuttWindow *dlg = dialog_find(win);
737 if (!event || !dlg || !dlg->wdata)
738 return FR_ERROR;
739
740 struct Menu *menu = dlg->wdata;
741 struct AttachPrivateData *priv = menu->mdata;
742 if (!priv)
743 return FR_ERROR;
744
745 const int op = event->op;
746 int rc = FR_UNKNOWN;
747 for (size_t i = 0; AttachFunctions[i].op != OP_NULL; i++)
748 {
749 const struct AttachFunction *fn = &AttachFunctions[i];
750 if (fn->op == op)
751 {
752 rc = fn->function(priv, event);
753 break;
754 }
755 }
756
757 return rc;
758}
void mutt_actx_free(struct AttachCtx **ptr)
Free an Attachment Context.
Definition attach.c:198
static const struct MenuFuncOp OpAttach[]
Functions for the Attach Menu.
Definition functions.c:61
static const struct MenuOpSeq AttachmentDefaultBindings[]
Key bindings for the Attachment Menu.
Definition functions.c:97
static bool check_attach(struct AttachPrivateData *priv)
Check if in attach-message mode.
Definition functions.c:182
struct MenuDefinition * MdAttach
Attach Menu Definition.
Definition functions.c:55
void attach_init_keys(struct SubMenu *sm_generic)
Initialise the Attach Keybindings - Implements ::init_keys_api.
Definition functions.c:128
static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
Close the tree of the current attachment.
Definition functions.c:147
static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
Is the Attachment inline PGP?
Definition functions.c:243
static const char * Function_not_permitted_in_attach_message_mode
Error message for unavailable functions in attach mode.
Definition functions.c:51
static const struct AttachFunction AttachFunctions[]
All the NeoMutt functions that the Attach supports.
Definition functions.c:696
static bool check_readonly(struct Mailbox *m)
Check if the Mailbox is readonly.
Definition functions.c:199
static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
Extract PGP keys from attachments.
Definition functions.c:216
Attachment functions.
Private state data for Attachments.
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:47
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
@ MUTT_POP
'POP3' Mailbox type
Definition mailbox.h:51
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition mailbox.h:48
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition crypt.c:89
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition crypt.c:687
bool crypt_pgp_check_traditional(FILE *fp, struct Body *b, bool just_one)
Wrapper for CryptModuleSpecs::pgp_check_traditional()
Definition cryptglue.c:282
void crypt_pgp_extract_key_from_attachment(FILE *fp, struct Body *b)
Wrapper for CryptModuleSpecs::pgp_extract_key_from_attachment()
Definition cryptglue.c:394
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c:89
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
@ FR_DONE
Exit the Dialog.
Definition dispatcher.h:36
@ FR_UNKNOWN
Unknown function.
Definition dispatcher.h:34
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:39
@ FR_CONTINUE
Remain in the Dialog.
Definition dispatcher.h:35
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
Structs that make up an email.
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition get.c:65
static int op_exit(struct AliasMenuData *mdata, const struct KeyEvent *event)
exit this menu - Implements alias_function_t -
Definition functions.c:234
static int op_forward_message(struct AttachPrivateData *priv, const struct KeyEvent *event)
forward a message with comments - Implements attach_function_t -
Definition functions.c:578
static int op_attach_delete(struct AttachPrivateData *priv, const struct KeyEvent *event)
delete the current entry - Implements attach_function_t -
Definition functions.c:283
static int op_reply(struct AttachPrivateData *priv, const struct KeyEvent *event)
reply to a message - Implements attach_function_t -
Definition functions.c:612
static int op_attach_view(struct AttachPrivateData *priv, const struct KeyEvent *event)
view attachment using mailcap entry if necessary - Implements attach_function_t -
Definition functions.c:445
static int op_attach_print(struct AttachPrivateData *priv, const struct KeyEvent *event)
print the current entry - Implements attach_function_t -
Definition functions.c:380
static int op_forget_passphrase(struct AttachPrivateData *priv, const struct KeyEvent *event)
wipe passphrases from memory - Implements attach_function_t -
Definition functions.c:569
static int op_attach_undelete(struct AttachPrivateData *priv, const struct KeyEvent *event)
undelete the current entry - Implements attach_function_t -
Definition functions.c:407
static int op_compose_to_sender(struct AttachPrivateData *priv, const struct KeyEvent *event)
compose new message to the current message sender - Implements attach_function_t -
Definition functions.c:521
static int op_attach_collapse(struct AttachPrivateData *priv, const struct KeyEvent *event)
toggle display of subparts - Implements attach_function_t -
Definition functions.c:267
static int op_attach_view_text(struct AttachPrivateData *priv, const struct KeyEvent *event)
view attachment as text - Implements attach_function_t -
Definition functions.c:481
static int op_list_subscribe(struct AttachPrivateData *priv, const struct KeyEvent *event)
subscribe to a mailing list - Implements attach_function_t -
Definition functions.c:592
static int op_attach_pipe(struct AttachPrivateData *priv, const struct KeyEvent *event)
pipe message/attachment to a shell command - Implements attach_function_t -
Definition functions.c:369
static int op_check_traditional(struct AttachPrivateData *priv, const struct KeyEvent *event)
check for classic PGP - Implements attach_function_t -
Definition functions.c:507
static int op_list_unsubscribe(struct AttachPrivateData *priv, const struct KeyEvent *event)
unsubscribe from a mailing list - Implements attach_function_t -
Definition functions.c:602
static int op_attach_save(struct AttachPrivateData *priv, const struct KeyEvent *event)
save message/attachment to a mailbox/file - Implements attach_function_t -
Definition functions.c:391
static int op_extract_keys(struct AttachPrivateData *priv, const struct KeyEvent *event)
extract supported public keys - Implements attach_function_t -
Definition functions.c:555
static int op_resend(struct AttachPrivateData *priv, const struct KeyEvent *event)
use the current message as a template for a new one - Implements attach_function_t -
Definition functions.c:636
static int op_forward_to_group(struct AttachPrivateData *priv, const struct KeyEvent *event)
forward to newsgroup - Implements attach_function_t -
Definition functions.c:680
static int op_bounce_message(struct AttachPrivateData *priv, const struct KeyEvent *event)
remail a message to another user - Implements attach_function_t -
Definition functions.c:493
static int op_attach_view_mailcap(struct AttachPrivateData *priv, const struct KeyEvent *event)
force viewing of attachment using mailcap - Implements attach_function_t -
Definition functions.c:457
static int op_attach_view_pager(struct AttachPrivateData *priv, const struct KeyEvent *event)
view attachment in pager using copiousoutput mailcap - Implements attach_function_t -
Definition functions.c:469
static int op_attach_edit_type(struct AttachPrivateData *priv, const struct KeyEvent *event)
edit attachment content type - Implements attach_function_t -
Definition functions.c:359
static int op_followup(struct AttachPrivateData *priv, const struct KeyEvent *event)
followup to newsgroup - Implements attach_function_t -
Definition functions.c:652
int attach_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Attach function - Implements function_dispatcher_t -.
Definition functions.c:733
#define mutt_error(...)
Definition logging2.h:94
#define mutt_message(...)
Definition logging2.h:93
Convenience wrapper for the gui headers.
void km_menu_add_submenu(struct MenuDefinition *md, struct SubMenu *sm)
Add a SubMenu to a Menu Definition.
Definition init.c:123
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
Definition init.c:91
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
Definition init.c:107
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
Definition init.c:136
Manage keymappings.
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:188
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:164
#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:178
@ 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:677
int mutt_view_attachment(FILE *fp, struct Body *b, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx, struct MuttWindow *win)
View an attachment.
Handling of email attachments.
void mutt_save_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *b, struct Email *e, struct Menu *menu)
Save a list of attachments.
Definition recvattach.c:426
@ 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:962
void mutt_pipe_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *b, 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 *b)
Print a list of Attachments.
Definition recvattach.c:887
API for encryption/signing of emails.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition lib.h:98
#define SEC_PARTSIGN
Not all parts of the email is signed.
Definition lib.h:90
#define SEC_ENCRYPT
Email is encrypted.
Definition lib.h:86
#define WithCrypto
Definition lib.h:124
#define SEC_SIGN
Email is signed.
Definition lib.h:87
@ 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
void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
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:932
Routines for managing attachments.
void mutt_attach_resend(FILE *fp, struct Mailbox *m, struct AttachCtx *actx, struct Body *b)
Resend-message, from the attachment menu.
Definition recvcmd.c:286
void mutt_attach_mail_sender(struct AttachCtx *actx, struct Body *b)
Compose an email to the sender in the email attachment.
Definition recvcmd.c:1128
void mutt_attach_forward(FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *b, SendFlags flags)
Forward an Attachment.
Definition recvcmd.c:789
void attach_bounce_message(struct Mailbox *m, FILE *fp, struct AttachCtx *actx, struct Body *b)
Bounce function, from the attachment menu.
Definition recvcmd.c:162
void mutt_attach_reply(FILE *fp, struct Mailbox *m, struct Email *e, struct AttachCtx *actx, struct Body *b, SendFlags flags)
Attach a reply.
Definition recvcmd.c:945
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:2992
bool mutt_send_list_subscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list subscription email.
Definition send.c:2963
#define SEND_GROUP_CHAT_REPLY
Reply to all recipients preserving To/Cc.
Definition send.h:54
uint32_t SendFlags
Flags for mutt_send_message(), e.g. SEND_REPLY.
Definition send.h:40
#define SEND_GROUP_REPLY
Reply to all.
Definition send.h:43
#define SEND_LIST_REPLY
Reply to mailing list.
Definition send.h:44
#define SEND_NO_FLAGS
No flags are set.
Definition send.h:41
#define SEND_REPLY
Reply to sender.
Definition send.h:42
#define SEND_NEWS
Reply to a news article.
Definition send.h:55
A set of attachments.
Definition attach.h:63
struct Email * email
Used by recvattach for updating.
Definition attach.h:64
struct AttachPtr ** idx
Array of attachments.
Definition attach.h:67
short idxlen
Number of attachmentes.
Definition attach.h:68
short * v2r
Mapping from virtual to real attachment.
Definition attach.h:71
A NeoMutt function.
Definition functions.h:51
attach_function_t function
Function to call.
Definition functions.h:53
int op
Op code, e.g. OP_ATTACH_COLLAPSE.
Definition functions.h:52
Private state data for Attachments.
int op
Op returned from the Pager, e.g. OP_NEXT_ENTRY.
struct Menu * menu
Current Menu.
struct ConfigSubset * sub
Config subset.
struct AttachCtx * actx
List of all Attachments.
bool attach_msg
Are we in "attach message" mode?
struct Mailbox * mailbox
Current Mailbox.
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:73
bool deleted
Attachment marked for deletion.
Definition body.h:88
struct Email * email
header information for message/rfc822
Definition body.h:74
bool tagged
This attachment is tagged.
Definition body.h:90
char * subtype
content-type subtype
Definition body.h:61
unsigned int type
content-type primary type, ContentType
Definition body.h:40
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
bool changed
Email has been edited.
Definition email.h:77
bool attach_del
Has an attachment marked for deletion.
Definition email.h:99
char * followup_to
List of 'followup-to' fields.
Definition envelope.h:80
An event such as a keypress.
Definition get.h:50
int op
Function opcode, e.g. OP_HELP.
Definition get.h:52
A mailbox.
Definition mailbox.h:78
enum MailboxType type
Mailbox type.
Definition mailbox.h:101
bool readonly
Don't allow changes to the mailbox.
Definition mailbox.h:115
Functions for a Dialog or Window.
Definition menu.h:80
Mapping between a function and an operation.
Definition menu.h:38
Mapping between an operation and a key sequence.
Definition menu.h:48
Definition lib.h:80
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:88
void * mdata
Private data.
Definition lib.h:149
bool tag_prefix
User has pressed <tag-prefix>
Definition lib.h:86
int max
Number of entries in the menu.
Definition lib.h:82
void * wdata
Private data.
Container for Accounts, Notifications.
Definition neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Collection of related functions.
Definition menu.h:68
@ MENU_ATTACH
Select an attachment.
Definition type.h:35