NeoMutt  2024-03-23-147-g885fbc
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c
Go to the documentation of this file.
1
30#include "config.h"
31#ifdef _MAKEDOC
32#include "docs/makedoc_defs.h"
33#else
34#include <stdbool.h>
35#include <stdio.h>
36#include "mutt/lib.h"
37#include "config/lib.h"
38#include "email/lib.h"
39#include "core/lib.h"
40#include "gui/lib.h"
41#include "key/lib.h"
42#include "menu/lib.h"
43#include "ncrypt/lib.h"
44#include "question/lib.h"
45#include "send/lib.h"
46#include "attach.h"
47#include "functions.h"
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 { "followup-message", OP_FOLLOWUP },
75 { "forget-passphrase", OP_FORGET_PASSPHRASE },
76 { "forward-message", OP_FORWARD_MESSAGE },
77 { "forward-to-group", OP_FORWARD_TO_GROUP },
78 { "group-chat-reply", OP_GROUP_CHAT_REPLY },
79 { "group-reply", OP_GROUP_REPLY },
80 { "list-reply", OP_LIST_REPLY },
81 { "list-subscribe", OP_LIST_SUBSCRIBE },
82 { "list-unsubscribe", OP_LIST_UNSUBSCRIBE },
83 { "pipe-entry", OP_PIPE },
84 { "pipe-message", OP_PIPE },
85 { "print-entry", OP_ATTACHMENT_PRINT },
86 { "reply", OP_REPLY },
87 { "resend-message", OP_RESEND },
88 { "save-entry", OP_ATTACHMENT_SAVE },
89 { "undelete-entry", OP_ATTACHMENT_UNDELETE },
90 { "view-attach", OP_ATTACHMENT_VIEW },
91 { "view-mailcap", OP_ATTACHMENT_VIEW_MAILCAP },
92 { "view-pager", OP_ATTACHMENT_VIEW_PAGER },
93 { "view-text", OP_ATTACHMENT_VIEW_TEXT },
94 { NULL, 0 },
95};
96
100const struct MenuOpSeq AttachmentDefaultBindings[] = { /* map: attachment */
101 { OP_ATTACHMENT_COLLAPSE, "v" },
102 { OP_ATTACHMENT_DELETE, "d" },
103 { OP_ATTACHMENT_EDIT_TYPE, "\005" }, // <Ctrl-E>
104 { OP_EXIT, "q" },
105 { OP_PIPE, "|" },
106 { OP_ATTACHMENT_PRINT, "p" },
107 { OP_ATTACHMENT_SAVE, "s" },
108 { OP_ATTACHMENT_UNDELETE, "u" },
109 { OP_ATTACHMENT_VIEW, "<keypadenter>" },
110 { OP_ATTACHMENT_VIEW, "\n" }, // <Enter>
111 { OP_ATTACHMENT_VIEW, "\r" }, // <Return>
112 { OP_ATTACHMENT_VIEW_MAILCAP, "m" },
113 { OP_ATTACHMENT_VIEW_TEXT, "T" },
114 { OP_BOUNCE_MESSAGE, "b" },
115 { OP_CHECK_TRADITIONAL, "\033P" }, // <Alt-P>
116 { OP_DISPLAY_HEADERS, "h" },
117 { OP_EXTRACT_KEYS, "\013" }, // <Ctrl-K>
118 { OP_FORGET_PASSPHRASE, "\006" }, // <Ctrl-F>
119 { OP_FORWARD_MESSAGE, "f" },
120 { OP_GROUP_REPLY, "g" },
121 { OP_LIST_REPLY, "L" },
122 { OP_REPLY, "r" },
123 { OP_RESEND, "\033e" }, // <Alt-e>
124 { 0, NULL },
125};
126// clang-format on
127
133static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
134{
135 int rindex, curlevel;
136
137 struct AttachPtr *cur_att = current_attachment(actx, menu);
138 cur_att->collapsed = !cur_att->collapsed;
139 /* When expanding, expand all the children too */
140 if (cur_att->collapsed)
141 return;
142
143 curlevel = cur_att->level;
144 const int index = menu_get_index(menu);
145 rindex = actx->v2r[index] + 1;
146
147 const bool c_digest_collapse = cs_subset_bool(NeoMutt->sub, "digest_collapse");
148 while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel))
149 {
150 if (c_digest_collapse && (actx->idx[rindex]->body->type == TYPE_MULTIPART) &&
151 mutt_istr_equal(actx->idx[rindex]->body->subtype, "digest"))
152 {
153 actx->idx[rindex]->collapsed = true;
154 }
155 else
156 {
157 actx->idx[rindex]->collapsed = false;
158 }
159 rindex++;
160 }
161}
162
168static bool check_attach(struct AttachPrivateData *priv)
169{
170 if (priv->attach_msg)
171 {
174 return true;
175 }
176
177 return false;
178}
179
185static bool check_readonly(struct Mailbox *m)
186{
187 if (!m || m->readonly)
188 {
190 mutt_error(_("Mailbox is read-only"));
191 return true;
192 }
193
194 return false;
195}
196
202static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
203{
204 if (menu->tag_prefix)
205 {
206 for (int i = 0; i < actx->idxlen; i++)
207 {
208 if (actx->idx[i]->body->tagged)
209 {
211 }
212 }
213 }
214 else
215 {
216 struct AttachPtr *cur_att = current_attachment(actx, menu);
218 }
219}
220
229static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
230{
231 int rc = 0;
232
233 if (menu->tag_prefix)
234 {
235 for (int i = 0; i < actx->idxlen; i++)
236 if (actx->idx[i]->body->tagged)
237 rc = rc || crypt_pgp_check_traditional(actx->idx[i]->fp, actx->idx[i]->body, true);
238 }
239 else
240 {
241 struct AttachPtr *cur_att = current_attachment(actx, menu);
242 rc = crypt_pgp_check_traditional(cur_att->fp, cur_att->body, true);
243 }
244
245 return rc;
246}
247
248// -----------------------------------------------------------------------------
249
253static int op_attachment_collapse(struct AttachPrivateData *priv, int op)
254{
255 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
256 if (!cur_att->body->parts)
257 {
258 mutt_error(_("There are no subparts to show"));
259 return FR_NO_ACTION;
260 }
261 attach_collapse(priv->actx, priv->menu);
262 mutt_update_recvattach_menu(priv->actx, priv->menu, false);
263 return FR_SUCCESS;
264}
265
269static int op_attachment_delete(struct AttachPrivateData *priv, int op)
270{
271 if (check_readonly(priv->mailbox))
272 return FR_ERROR;
273
274 if (priv->mailbox->type == MUTT_POP)
275 {
277 mutt_error(_("Can't delete attachment from POP server"));
278 return FR_ERROR;
279 }
280
281 if (priv->mailbox->type == MUTT_NNTP)
282 {
284 mutt_error(_("Can't delete attachment from news server"));
285 return FR_ERROR;
286 }
287
288 if ((WithCrypto != 0) && (priv->actx->email->security & SEC_ENCRYPT))
289 {
290 mutt_message(_("Deletion of attachments from encrypted messages is unsupported"));
291 return FR_ERROR;
292 }
293 if ((WithCrypto != 0) && (priv->actx->email->security & (SEC_SIGN | SEC_PARTSIGN)))
294 {
295 mutt_message(_("Deletion of attachments from signed messages may invalidate the signature"));
296 }
297
298 if (priv->menu->tag_prefix)
299 {
300 for (int i = 0; i < priv->menu->max; i++)
301 {
302 if (priv->actx->idx[i]->body->tagged)
303 {
304 if (priv->actx->idx[i]->parent_type == TYPE_MULTIPART)
305 {
306 priv->actx->idx[i]->body->deleted = true;
308 }
309 else
310 {
311 mutt_message(_("Only deletion of multipart attachments is supported"));
312 }
313 }
314 }
315 }
316 else
317 {
318 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
319 if (cur_att->parent_type == TYPE_MULTIPART)
320 {
321 cur_att->body->deleted = true;
322 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
323 const int index = menu_get_index(priv->menu) + 1;
324 if (c_resolve && (index < priv->menu->max))
325 {
326 menu_set_index(priv->menu, index);
327 }
328 else
329 {
331 }
332 }
333 else
334 {
335 mutt_message(_("Only deletion of multipart attachments is supported"));
336 }
337 }
338
339 return FR_SUCCESS;
340}
341
345static int op_attachment_edit_type(struct AttachPrivateData *priv, int op)
346{
347 recvattach_edit_content_type(priv->actx, priv->menu, priv->actx->email);
349 return FR_SUCCESS;
350}
351
355static int op_attachment_pipe(struct AttachPrivateData *priv, int op)
356{
357 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
358 mutt_pipe_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
359 cur_att->body, false);
360 return FR_SUCCESS;
361}
362
366static int op_attachment_print(struct AttachPrivateData *priv, int op)
367{
368 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
369 mutt_print_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
370 cur_att->body);
371 return FR_SUCCESS;
372}
373
377static int op_attachment_save(struct AttachPrivateData *priv, int op)
378{
379 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
380 mutt_save_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
381 cur_att->body, priv->actx->email, priv->menu);
382
383 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
384 const int index = menu_get_index(priv->menu) + 1;
385 if (!priv->menu->tag_prefix && c_resolve && (index < priv->menu->max))
386 menu_set_index(priv->menu, index);
387 return FR_SUCCESS;
388}
389
393static int op_attachment_undelete(struct AttachPrivateData *priv, int op)
394{
395 if (check_readonly(priv->mailbox))
396 return FR_ERROR;
397
398 if (priv->menu->tag_prefix)
399 {
400 for (int i = 0; i < priv->menu->max; i++)
401 {
402 if (priv->actx->idx[i]->body->tagged)
403 {
404 priv->actx->idx[i]->body->deleted = false;
406 }
407 }
408 }
409 else
410 {
411 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
412 cur_att->body->deleted = false;
413 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
414 const int index = menu_get_index(priv->menu) + 1;
415 if (c_resolve && (index < priv->menu->max))
416 {
417 menu_set_index(priv->menu, index);
418 }
419 else
420 {
422 }
423 }
424
425 return FR_SUCCESS;
426}
427
431static int op_attachment_view(struct AttachPrivateData *priv, int op)
432{
433 priv->op = mutt_attach_display_loop(priv->sub, priv->menu, op,
434 priv->actx->email, priv->actx, true);
436
437 return FR_CONTINUE;
438}
439
443static int op_attachment_view_mailcap(struct AttachPrivateData *priv, int op)
444{
445 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
446 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_MAILCAP,
447 priv->actx->email, priv->actx, priv->menu->win);
449 return FR_SUCCESS;
450}
451
455static int op_attachment_view_pager(struct AttachPrivateData *priv, int op)
456{
457 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
458 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_PAGER,
459 priv->actx->email, priv->actx, priv->menu->win);
461 return FR_SUCCESS;
462}
463
467static int op_attachment_view_text(struct AttachPrivateData *priv, int op)
468{
469 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
470 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_AS_TEXT,
471 priv->actx->email, priv->actx, priv->menu->win);
473 return FR_SUCCESS;
474}
475
479static int op_bounce_message(struct AttachPrivateData *priv, int op)
480{
481 if (check_attach(priv))
482 return FR_ERROR;
483 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
484 attach_bounce_message(priv->mailbox, cur_att->fp, priv->actx,
485 priv->menu->tag_prefix ? NULL : cur_att->body);
487 return FR_SUCCESS;
488}
489
493static int op_check_traditional(struct AttachPrivateData *priv, int op)
494{
495 if (((WithCrypto & APPLICATION_PGP) != 0) &&
497 {
498 priv->actx->email->security = crypt_query(NULL);
500 }
501 return FR_SUCCESS;
502}
503
507static int op_compose_to_sender(struct AttachPrivateData *priv, int op)
508{
509 if (check_attach(priv))
510 return FR_ERROR;
511 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
512 mutt_attach_mail_sender(priv->actx, priv->menu->tag_prefix ? NULL : cur_att->body);
514 return FR_SUCCESS;
515}
516
520static int op_exit(struct AttachPrivateData *priv, int op)
521{
522 priv->actx->email->attach_del = false;
523 for (int i = 0; i < priv->actx->idxlen; i++)
524 {
525 if (priv->actx->idx[i]->body && priv->actx->idx[i]->body->deleted)
526 {
527 priv->actx->email->attach_del = true;
528 break;
529 }
530 }
531 if (priv->actx->email->attach_del)
532 priv->actx->email->changed = true;
533
534 mutt_actx_free(&priv->actx);
535 return FR_DONE;
536}
537
541static int op_extract_keys(struct AttachPrivateData *priv, int op)
542{
544 return FR_NO_ACTION;
545
548
549 return FR_SUCCESS;
550}
551
555static int op_forget_passphrase(struct AttachPrivateData *priv, int op)
556{
558 return FR_SUCCESS;
559}
560
564static int op_forward_message(struct AttachPrivateData *priv, int op)
565{
566 if (check_attach(priv))
567 return FR_ERROR;
568 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
569 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
570 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NO_FLAGS);
572 return FR_SUCCESS;
573}
574
578static int op_list_subscribe(struct AttachPrivateData *priv, int op)
579{
580 if (!check_attach(priv))
582 return FR_SUCCESS;
583}
584
588static int op_list_unsubscribe(struct AttachPrivateData *priv, int op)
589{
590 if (!check_attach(priv))
592 return FR_SUCCESS;
593}
594
598static int op_reply(struct AttachPrivateData *priv, int op)
599{
600 if (check_attach(priv))
601 return FR_ERROR;
602
603 SendFlags flags = SEND_REPLY;
604 if (op == OP_GROUP_REPLY)
605 flags |= SEND_GROUP_REPLY;
606 else if (op == OP_GROUP_CHAT_REPLY)
607 flags |= SEND_GROUP_CHAT_REPLY;
608 else if (op == OP_LIST_REPLY)
609 flags |= SEND_LIST_REPLY;
610
611 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
612 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
613 priv->menu->tag_prefix ? NULL : cur_att->body, flags);
615 return FR_SUCCESS;
616}
617
621static int op_resend(struct AttachPrivateData *priv, int op)
622{
623 if (check_attach(priv))
624 return FR_ERROR;
625 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
626 mutt_attach_resend(cur_att->fp, priv->mailbox, priv->actx,
627 priv->menu->tag_prefix ? NULL : cur_att->body);
629 return FR_SUCCESS;
630}
631
632// -----------------------------------------------------------------------------
633
637static int op_followup(struct AttachPrivateData *priv, int op)
638{
639 if (check_attach(priv))
640 return FR_ERROR;
641
642 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
643 if (!cur_att->body->email->env->followup_to ||
644 !mutt_istr_equal(cur_att->body->email->env->followup_to, "poster") ||
645 (query_quadoption(_("Reply by mail as poster prefers?"), NeoMutt->sub,
646 "followup_to_poster") != MUTT_YES))
647 {
648 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
649 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS | SEND_REPLY);
651 return FR_SUCCESS;
652 }
653
654 return op_reply(priv, op);
655}
656
660static int op_forward_to_group(struct AttachPrivateData *priv, int op)
661{
662 if (check_attach(priv))
663 return FR_ERROR;
664 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
665 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
666 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS);
668 return FR_SUCCESS;
669}
670
671// -----------------------------------------------------------------------------
672
676static const struct AttachFunction AttachFunctions[] = {
677 // clang-format off
678 { OP_ATTACHMENT_COLLAPSE, op_attachment_collapse },
679 { OP_ATTACHMENT_DELETE, op_attachment_delete },
680 { OP_ATTACHMENT_EDIT_TYPE, op_attachment_edit_type },
681 { OP_PIPE, op_attachment_pipe },
682 { OP_ATTACHMENT_PRINT, op_attachment_print },
683 { OP_ATTACHMENT_SAVE, op_attachment_save },
684 { OP_ATTACHMENT_UNDELETE, op_attachment_undelete },
685 { OP_ATTACHMENT_VIEW, op_attachment_view },
686 { OP_ATTACHMENT_VIEW_MAILCAP, op_attachment_view_mailcap },
687 { OP_ATTACHMENT_VIEW_PAGER, op_attachment_view_pager },
688 { OP_ATTACHMENT_VIEW_TEXT, op_attachment_view_text },
689 { OP_BOUNCE_MESSAGE, op_bounce_message },
690 { OP_CHECK_TRADITIONAL, op_check_traditional },
691 { OP_COMPOSE_TO_SENDER, op_compose_to_sender },
692 { OP_DISPLAY_HEADERS, op_attachment_view },
693 { OP_EXIT, op_exit },
694 { OP_EXTRACT_KEYS, op_extract_keys },
695 { OP_FOLLOWUP, op_followup },
696 { OP_FORGET_PASSPHRASE, op_forget_passphrase },
697 { OP_FORWARD_MESSAGE, op_forward_message },
698 { OP_FORWARD_TO_GROUP, op_forward_to_group },
699 { OP_GROUP_CHAT_REPLY, op_reply },
700 { OP_GROUP_REPLY, op_reply },
701 { OP_LIST_REPLY, op_reply },
702 { OP_LIST_SUBSCRIBE, op_list_subscribe },
703 { OP_LIST_UNSUBSCRIBE, op_list_unsubscribe },
704 { OP_REPLY, op_reply },
705 { OP_RESEND, op_resend },
706 { 0, NULL },
707 // clang-format on
708};
709
714{
715 if (!win)
716 {
718 return FR_ERROR;
719 }
720
721 struct Menu *menu = win->wdata;
722 struct AttachPrivateData *priv = menu->mdata;
723 if (!priv)
724 return FR_ERROR;
725
726 int rc = FR_UNKNOWN;
727 for (size_t i = 0; AttachFunctions[i].op != OP_NULL; i++)
728 {
729 const struct AttachFunction *fn = &AttachFunctions[i];
730 if (fn->op == op)
731 {
732 rc = fn->function(priv, op);
733 break;
734 }
735 }
736
737 return rc;
738}
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:100
static bool check_attach(struct AttachPrivateData *priv)
Check if in attach-message mode.
Definition: functions.c:168
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:133
static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
Is the Attachment inline PGP?
Definition: functions.c:229
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:676
static bool check_readonly(struct Mailbox *m)
Check if the Mailbox is readonly.
Definition: functions.c:185
static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
Extract PGP keys from attachments.
Definition: functions.c:202
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.
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:52
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition: crypt.c:90
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition: crypt.c:673
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
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:191
static int op_attachment_print(struct AttachPrivateData *priv, int op)
print the current entry - Implements attach_function_t -
Definition: functions.c:366
static int op_followup(struct AttachPrivateData *priv, int op)
followup to newsgroup - Implements attach_function_t -
Definition: functions.c:637
static int op_forward_message(struct AttachPrivateData *priv, int op)
forward a message with comments - Implements attach_function_t -
Definition: functions.c:564
static int op_attachment_collapse(struct AttachPrivateData *priv, int op)
toggle display of subparts - Implements attach_function_t -
Definition: functions.c:253
static int op_bounce_message(struct AttachPrivateData *priv, int op)
remail a message to another user - Implements attach_function_t -
Definition: functions.c:479
static int op_attachment_edit_type(struct AttachPrivateData *priv, int op)
edit attachment content type - Implements attach_function_t -
Definition: functions.c:345
static int op_extract_keys(struct AttachPrivateData *priv, int op)
extract supported public keys - Implements attach_function_t -
Definition: functions.c:541
static int op_reply(struct AttachPrivateData *priv, int op)
reply to a message - Implements attach_function_t -
Definition: functions.c:598
static int op_attachment_view(struct AttachPrivateData *priv, int op)
view attachment using mailcap entry if necessary - Implements attach_function_t -
Definition: functions.c:431
static int op_forward_to_group(struct AttachPrivateData *priv, int op)
forward to newsgroup - Implements attach_function_t -
Definition: functions.c:660
static int op_attachment_view_mailcap(struct AttachPrivateData *priv, int op)
force viewing of attachment using mailcap - Implements attach_function_t -
Definition: functions.c:443
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:507
static int op_attachment_pipe(struct AttachPrivateData *priv, int op)
pipe message/attachment to a shell command - Implements attach_function_t -
Definition: functions.c:355
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:455
static int op_forget_passphrase(struct AttachPrivateData *priv, int op)
wipe passphrases from memory - Implements attach_function_t -
Definition: functions.c:555
static int op_attachment_undelete(struct AttachPrivateData *priv, int op)
undelete the current entry - Implements attach_function_t -
Definition: functions.c:393
static int op_list_subscribe(struct AttachPrivateData *priv, int op)
subscribe to a mailing list - Implements attach_function_t -
Definition: functions.c:578
static int op_attachment_delete(struct AttachPrivateData *priv, int op)
delete the current entry - Implements attach_function_t -
Definition: functions.c:269
static int op_attachment_save(struct AttachPrivateData *priv, int op)
save message/attachment to a mailbox/file - Implements attach_function_t -
Definition: functions.c:377
static int op_attachment_view_text(struct AttachPrivateData *priv, int op)
view attachment as text - Implements attach_function_t -
Definition: functions.c:467
static int op_list_unsubscribe(struct AttachPrivateData *priv, int op)
unsubscribe from a mailing list - Implements attach_function_t -
Definition: functions.c:588
static int op_check_traditional(struct AttachPrivateData *priv, int op)
check for classic PGP - Implements attach_function_t -
Definition: functions.c:493
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:621
int attach_function_dispatcher(struct MuttWindow *win, int op)
Perform a Attach function - Implements function_dispatcher_t -.
Definition: functions.c:713
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_message(...)
Definition: logging2.h:91
Convenience wrapper for the gui headers.
Manage keymappings.
GUI present the user with a selectable list.
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:56
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:184
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:58
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:174
@ 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:721
int mutt_view_attachment(FILE *fp, struct Body *b, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx, struct MuttWindow *win)
View an attachment.
Definition: mutt_attach.c:418
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:433
@ 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:725
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *b)
Print a list of Attachments.
Definition: recvattach.c:888
API for encryption/signing of emails.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:90
#define SEC_PARTSIGN
Not all parts of the email is signed.
Definition: lib.h:82
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:78
#define WithCrypto
Definition: lib.h:116
#define SEC_SIGN
Email is signed.
Definition: lib.h:79
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:366
void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
Definition: recvattach.c:1214
struct AttachPtr * current_attachment(struct AttachCtx *actx, struct Menu *menu)
Get the current attachment.
Definition: recvattach.c:77
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:290
void mutt_attach_mail_sender(struct AttachCtx *actx, struct Body *b)
Compose an email to the sender in the email attachment.
Definition: recvcmd.c:1127
void mutt_attach_forward(FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *b, SendFlags flags)
Forward an Attachment.
Definition: recvcmd.c:793
void attach_bounce_message(struct Mailbox *m, FILE *fp, struct AttachCtx *actx, struct Body *b)
Bounce function, from the attachment menu.
Definition: recvcmd.c:166
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:949
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:3057
bool mutt_send_list_subscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list subscription email.
Definition: send.c:3028
#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
Sidebar functions.
A set of attachments.
Definition: attach.h:65
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
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:36
int op
Op returned from the Pager, e.g. OP_NEXT_ENTRY.
Definition: private_data.h:41
struct Menu * menu
Current Menu.
Definition: private_data.h:37
struct ConfigSubset * sub
Config subset.
Definition: private_data.h:39
struct AttachCtx * actx
List of all Attachments.
Definition: private_data.h:38
bool attach_msg
Are we in "attach message" mode?
Definition: private_data.h:42
struct Mailbox * mailbox
Current Mailbox.
Definition: private_data.h:40
An email to which things will be attached.
Definition: attach.h:37
struct Body * body
Attachment.
Definition: attach.h:38
bool collapsed
Group is collapsed.
Definition: attach.h:46
int level
Nesting depth of attachment.
Definition: attach.h:42
FILE * fp
Used in the recvattach menu.
Definition: attach.h:39
int parent_type
Type of parent attachment, e.g. TYPE_MULTIPART.
Definition: attach.h:40
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: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:102
char * followup_to
List of 'followup-to' fields.
Definition: envelope.h:80
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:116
Mapping between a function and an operation.
Definition: lib.h:101
Mapping between an operation and a key sequence.
Definition: lib.h:110
Definition: lib.h:79
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
void * mdata
Private data.
Definition: lib.h:147
bool tag_prefix
User has pressed <tag-prefix>
Definition: lib.h:85
int max
Number of entries in the menu.
Definition: lib.h:81
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