NeoMutt  2022-04-29-215-gc12b98
Teaching an old dog new tricks
DOXYGEN
functions.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stdbool.h>
31#include <stdio.h>
32#include "mutt/lib.h"
33#include "config/lib.h"
34#include "email/lib.h"
35#include "core/lib.h"
36#include "gui/lib.h"
37#include "functions.h"
38#include "menu/lib.h"
39#include "ncrypt/lib.h"
40#include "question/lib.h"
41#include "send/lib.h"
42#include "attach.h"
43#include "mutt_attach.h"
44#include "opcodes.h"
45#include "options.h"
46#include "private_data.h"
47#include "recvattach.h"
48#include "recvcmd.h"
49
50static const char *Not_available_in_this_menu = N_("Not available in this menu");
52 "Function not permitted in attach-message mode");
53
59static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
60{
61 int rindex, curlevel;
62
63 struct AttachPtr *cur_att = current_attachment(actx, menu);
64 cur_att->collapsed = !cur_att->collapsed;
65 /* When expanding, expand all the children too */
66 if (cur_att->collapsed)
67 return;
68
69 curlevel = cur_att->level;
70 const int index = menu_get_index(menu);
71 rindex = actx->v2r[index] + 1;
72
73 const bool c_digest_collapse = cs_subset_bool(NeoMutt->sub, "digest_collapse");
74 while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel))
75 {
76 if (c_digest_collapse && (actx->idx[rindex]->body->type == TYPE_MULTIPART) &&
77 mutt_istr_equal(actx->idx[rindex]->body->subtype, "digest"))
78 {
79 actx->idx[rindex]->collapsed = true;
80 }
81 else
82 {
83 actx->idx[rindex]->collapsed = false;
84 }
85 rindex++;
86 }
87}
88
93static bool check_attach(void)
94{
95 if (OptAttachMsg)
96 {
99 return true;
100 }
101
102 return false;
103}
104
110static bool check_readonly(struct Mailbox *m)
111{
112 if (!m || m->readonly)
113 {
115 mutt_error(_("Mailbox is read-only"));
116 return true;
117 }
118
119 return false;
120}
121
127static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
128{
129 if (!menu->tag_prefix)
130 {
131 struct AttachPtr *cur_att = current_attachment(actx, menu);
133 }
134 else
135 {
136 for (int i = 0; i < actx->idxlen; i++)
137 {
138 if (actx->idx[i]->body->tagged)
139 {
141 }
142 }
143 }
144}
145
154static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
155{
156 int rc = 0;
157
158 if (!menu->tag_prefix)
159 {
160 struct AttachPtr *cur_att = current_attachment(actx, menu);
161 rc = crypt_pgp_check_traditional(cur_att->fp, cur_att->body, true);
162 }
163 else
164 {
165 for (int i = 0; i < actx->idxlen; i++)
166 if (actx->idx[i]->body->tagged)
167 rc = rc || crypt_pgp_check_traditional(actx->idx[i]->fp, actx->idx[i]->body, true);
168 }
169
170 return rc;
171}
172
173// -----------------------------------------------------------------------------
174
178static int op_attachment_collapse(struct AttachPrivateData *priv, int op)
179{
180 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
181 if (!cur_att->body->parts)
182 {
183 mutt_error(_("There are no subparts to show"));
184 return FR_NO_ACTION;
185 }
186 attach_collapse(priv->actx, priv->menu);
187 mutt_update_recvattach_menu(priv->actx, priv->menu, false);
188 return FR_SUCCESS;
189}
190
194static int op_attachment_delete(struct AttachPrivateData *priv, int op)
195{
196 if (check_readonly(priv->mailbox))
197 return FR_ERROR;
198
199#ifdef USE_POP
200 if (priv->mailbox->type == MUTT_POP)
201 {
203 mutt_error(_("Can't delete attachment from POP server"));
204 return FR_ERROR;
205 }
206#endif
207
208#ifdef USE_NNTP
209 if (priv->mailbox->type == MUTT_NNTP)
210 {
212 mutt_error(_("Can't delete attachment from news server"));
213 return FR_ERROR;
214 }
215#endif
216
217 if ((WithCrypto != 0) && (priv->actx->email->security & SEC_ENCRYPT))
218 {
219 mutt_message(_("Deletion of attachments from encrypted messages is unsupported"));
220 return FR_ERROR;
221 }
222 if ((WithCrypto != 0) && (priv->actx->email->security & (SEC_SIGN | SEC_PARTSIGN)))
223 {
224 mutt_message(_("Deletion of attachments from signed messages may invalidate the signature"));
225 }
226 if (!priv->menu->tag_prefix)
227 {
228 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
229 if (cur_att->parent_type == TYPE_MULTIPART)
230 {
231 cur_att->body->deleted = true;
232 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
233 const int index = menu_get_index(priv->menu) + 1;
234 if (c_resolve && (index < priv->menu->max))
235 {
236 menu_set_index(priv->menu, index);
237 }
238 else
240 }
241 else
242 {
243 mutt_message(_("Only deletion of multipart attachments is supported"));
244 }
245 }
246 else
247 {
248 for (int i = 0; i < priv->menu->max; i++)
249 {
250 if (priv->actx->idx[i]->body->tagged)
251 {
252 if (priv->actx->idx[i]->parent_type == TYPE_MULTIPART)
253 {
254 priv->actx->idx[i]->body->deleted = true;
256 }
257 else
258 {
259 mutt_message(_("Only deletion of multipart attachments is supported"));
260 }
261 }
262 }
263 }
264
265 return FR_SUCCESS;
266}
267
271static int op_attachment_edit_type(struct AttachPrivateData *priv, int op)
272{
273 recvattach_edit_content_type(priv->actx, priv->menu, priv->actx->email);
275 return FR_SUCCESS;
276}
277
281static int op_attachment_pipe(struct AttachPrivateData *priv, int op)
282{
283 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
284 mutt_pipe_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
285 cur_att->body, false);
286 return FR_SUCCESS;
287}
288
292static int op_attachment_print(struct AttachPrivateData *priv, int op)
293{
294 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
295 mutt_print_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
296 cur_att->body);
297 return FR_SUCCESS;
298}
299
303static int op_attachment_save(struct AttachPrivateData *priv, int op)
304{
305 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
306 mutt_save_attachment_list(priv->actx, cur_att->fp, priv->menu->tag_prefix,
307 cur_att->body, priv->actx->email, priv->menu);
308
309 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
310 const int index = menu_get_index(priv->menu) + 1;
311 if (!priv->menu->tag_prefix && c_resolve && (index < priv->menu->max))
312 menu_set_index(priv->menu, index);
313 return FR_SUCCESS;
314}
315
319static int op_attachment_undelete(struct AttachPrivateData *priv, int op)
320{
321 if (check_readonly(priv->mailbox))
322 return FR_ERROR;
323 if (!priv->menu->tag_prefix)
324 {
325 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
326 cur_att->body->deleted = false;
327 const bool c_resolve = cs_subset_bool(NeoMutt->sub, "resolve");
328 const int index = menu_get_index(priv->menu) + 1;
329 if (c_resolve && (index < priv->menu->max))
330 {
331 menu_set_index(priv->menu, index);
332 }
333 else
335 }
336 else
337 {
338 for (int i = 0; i < priv->menu->max; i++)
339 {
340 if (priv->actx->idx[i]->body->tagged)
341 {
342 priv->actx->idx[i]->body->deleted = false;
344 }
345 }
346 }
347 return FR_SUCCESS;
348}
349
353static int op_attachment_view(struct AttachPrivateData *priv, int op)
354{
355 priv->op = mutt_attach_display_loop(priv->sub, priv->menu, op,
356 priv->actx->email, priv->actx, true);
358
359 return FR_CONTINUE;
360}
361
365static int op_attachment_view_mailcap(struct AttachPrivateData *priv, int op)
366{
367 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
368 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_MAILCAP,
369 priv->actx->email, priv->actx, priv->menu->win);
371 return FR_SUCCESS;
372}
373
377static int op_attachment_view_pager(struct AttachPrivateData *priv, int op)
378{
379 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
380 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_PAGER,
381 priv->actx->email, priv->actx, priv->menu->win);
383 return FR_SUCCESS;
384}
385
389static int op_attachment_view_text(struct AttachPrivateData *priv, int op)
390{
391 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
392 mutt_view_attachment(cur_att->fp, cur_att->body, MUTT_VA_AS_TEXT,
393 priv->actx->email, priv->actx, priv->menu->win);
395 return FR_SUCCESS;
396}
397
401static int op_bounce_message(struct AttachPrivateData *priv, int op)
402{
403 if (check_attach())
404 return FR_ERROR;
405 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
406 mutt_attach_bounce(priv->mailbox, cur_att->fp, priv->actx,
407 priv->menu->tag_prefix ? NULL : cur_att->body);
409 return FR_SUCCESS;
410}
411
415static int op_check_traditional(struct AttachPrivateData *priv, int op)
416{
417 if (((WithCrypto & APPLICATION_PGP) != 0) &&
419 {
420 priv->actx->email->security = crypt_query(NULL);
422 }
423 return FR_SUCCESS;
424}
425
429static int op_compose_to_sender(struct AttachPrivateData *priv, int op)
430{
431 if (check_attach())
432 return FR_ERROR;
433 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
434 mutt_attach_mail_sender(priv->actx, priv->menu->tag_prefix ? NULL : cur_att->body);
436 return FR_SUCCESS;
437}
438
442static int op_exit(struct AttachPrivateData *priv, int op)
443{
444 priv->actx->email->attach_del = false;
445 for (int i = 0; i < priv->actx->idxlen; i++)
446 {
447 if (priv->actx->idx[i]->body && priv->actx->idx[i]->body->deleted)
448 {
449 priv->actx->email->attach_del = true;
450 break;
451 }
452 }
453 if (priv->actx->email->attach_del)
454 priv->actx->email->changed = true;
455
456 mutt_actx_free(&priv->actx);
457 return FR_DONE;
458}
459
463static int op_extract_keys(struct AttachPrivateData *priv, int op)
464{
466 return FR_NO_ACTION;
467
470
471 return FR_SUCCESS;
472}
473
477static int op_forget_passphrase(struct AttachPrivateData *priv, int op)
478{
480 return FR_SUCCESS;
481}
482
486static int op_forward_message(struct AttachPrivateData *priv, int op)
487{
488 if (check_attach())
489 return FR_ERROR;
490 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
491 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
492 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NO_FLAGS);
494 return FR_SUCCESS;
495}
496
500static int op_list_subscribe(struct AttachPrivateData *priv, int op)
501{
502 if (!check_attach())
504 return FR_SUCCESS;
505}
506
510static int op_list_unsubscribe(struct AttachPrivateData *priv, int op)
511{
512 if (!check_attach())
514 return FR_SUCCESS;
515}
516
520static int op_reply(struct AttachPrivateData *priv, int op)
521{
522 if (check_attach())
523 return FR_ERROR;
524
525 SendFlags flags = SEND_REPLY;
526 if (op == OP_GROUP_REPLY)
527 flags |= SEND_GROUP_REPLY;
528 else if (op == OP_GROUP_CHAT_REPLY)
529 flags |= SEND_GROUP_CHAT_REPLY;
530 else if (op == OP_LIST_REPLY)
531 flags |= SEND_LIST_REPLY;
532
533 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
534 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
535 priv->menu->tag_prefix ? NULL : cur_att->body, flags);
537 return FR_SUCCESS;
538}
539
543static int op_resend(struct AttachPrivateData *priv, int op)
544{
545 if (check_attach())
546 return FR_ERROR;
547 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
548 mutt_attach_resend(cur_att->fp, priv->mailbox, priv->actx,
549 priv->menu->tag_prefix ? NULL : cur_att->body);
551 return FR_SUCCESS;
552}
553
554// -----------------------------------------------------------------------------
555
556#ifdef USE_NNTP
560static int op_followup(struct AttachPrivateData *priv, int op)
561{
562 if (check_attach())
563 return FR_ERROR;
564
565 const enum QuadOption c_followup_to_poster = cs_subset_quad(NeoMutt->sub, "followup_to_poster");
566 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
567 if (!cur_att->body->email->env->followup_to ||
568 !mutt_istr_equal(cur_att->body->email->env->followup_to, "poster") ||
569 (query_quadoption(c_followup_to_poster, _("Reply by mail as poster prefers?")) != MUTT_YES))
570 {
571 mutt_attach_reply(cur_att->fp, priv->mailbox, priv->actx->email, priv->actx,
572 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS | SEND_REPLY);
574 return FR_SUCCESS;
575 }
576
577 return op_reply(priv, op);
578}
579
583static int op_forward_to_group(struct AttachPrivateData *priv, int op)
584{
585 if (check_attach())
586 return FR_ERROR;
587 struct AttachPtr *cur_att = current_attachment(priv->actx, priv->menu);
588 mutt_attach_forward(cur_att->fp, priv->actx->email, priv->actx,
589 priv->menu->tag_prefix ? NULL : cur_att->body, SEND_NEWS);
591 return FR_SUCCESS;
592}
593#endif
594
595// -----------------------------------------------------------------------------
596
601 // clang-format off
602 { OP_ATTACHMENT_COLLAPSE, op_attachment_collapse },
603 { OP_ATTACHMENT_DELETE, op_attachment_delete },
604 { OP_ATTACHMENT_EDIT_TYPE, op_attachment_edit_type },
605 { OP_PIPE, op_attachment_pipe },
606 { OP_ATTACHMENT_PRINT, op_attachment_print },
607 { OP_ATTACHMENT_SAVE, op_attachment_save },
608 { OP_ATTACHMENT_UNDELETE, op_attachment_undelete },
609 { OP_ATTACHMENT_VIEW, op_attachment_view },
610 { OP_ATTACHMENT_VIEW_MAILCAP, op_attachment_view_mailcap },
611 { OP_ATTACHMENT_VIEW_PAGER, op_attachment_view_pager },
612 { OP_ATTACHMENT_VIEW_TEXT, op_attachment_view_text },
613 { OP_BOUNCE_MESSAGE, op_bounce_message },
614 { OP_CHECK_TRADITIONAL, op_check_traditional },
615 { OP_COMPOSE_TO_SENDER, op_compose_to_sender },
616 { OP_DISPLAY_HEADERS, op_attachment_view },
617 { OP_EXIT, op_exit },
618 { OP_EXTRACT_KEYS, op_extract_keys },
619#ifdef USE_NNTP
620 { OP_FOLLOWUP, op_followup },
621#endif
622 { OP_FORGET_PASSPHRASE, op_forget_passphrase },
623 { OP_FORWARD_MESSAGE, op_forward_message },
624#ifdef USE_NNTP
625 { OP_FORWARD_TO_GROUP, op_forward_to_group },
626#endif
627 { OP_GROUP_CHAT_REPLY, op_reply },
628 { OP_GROUP_REPLY, op_reply },
629 { OP_LIST_REPLY, op_reply },
630 { OP_LIST_SUBSCRIBE, op_list_subscribe },
631 { OP_LIST_UNSUBSCRIBE, op_list_unsubscribe },
632 { OP_REPLY, op_reply },
633 { OP_RESEND, op_resend },
634 { 0, NULL },
635 // clang-format on
636};
637
642{
643 if (!win)
644 {
646 return FR_ERROR;
647 }
648
649 struct Menu *menu = win->wdata;
650 struct AttachPrivateData *priv = menu->mdata;
651 if (!priv)
652 return FR_ERROR;
653
654 struct MuttWindow *dlg = dialog_find(win);
655 if (!dlg || !dlg->wdata)
656 return FR_ERROR;
657
658 int rc = FR_UNKNOWN;
659 for (size_t i = 0; AttachFunctions[i].op != OP_NULL; i++)
660 {
661 const struct AttachFunction *fn = &AttachFunctions[i];
662 if (fn->op == op)
663 {
664 rc = fn->function(priv, op);
665 break;
666 }
667 }
668
669 return rc;
670}
void mutt_actx_free(struct AttachCtx **ptr)
Free an Attachment Context.
Definition: attach.c:198
static bool check_attach(void)
Check if in attach-message mode.
Definition: functions.c:93
struct AttachFunction AttachFunctions[]
All the NeoMutt functions that the Attach supports.
Definition: functions.c:600
static const char * Not_available_in_this_menu
Definition: functions.c:50
static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
Close the tree of the current attachment.
Definition: functions.c:59
static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
Is the Attachment inline PGP?
Definition: functions.c:154
static const char * Function_not_permitted_in_attach_message_mode
Definition: functions.c:51
static bool check_readonly(struct Mailbox *m)
Check if the Mailbox is readonly.
Definition: functions.c:110
static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
Extract PGP keys from attachments.
Definition: functions.c:127
Handling of email attachments.
enum QuadOption cs_subset_quad(const struct ConfigSubset *sub, const char *name)
Get a quad-value config item by name.
Definition: helpers.c:218
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
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:92
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
Definition: crypt.c:675
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: curs_lib.c:592
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:83
@ 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_attachment_print(struct AttachPrivateData *priv, int op)
print the current entry - Implements attach_function_t -
Definition: functions.c:292
static int op_followup(struct AttachPrivateData *priv, int op)
followup to newsgroup - Implements attach_function_t -
Definition: functions.c:560
static int op_forward_message(struct AttachPrivateData *priv, int op)
forward a message with comments - Implements attach_function_t -
Definition: functions.c:486
static int op_attachment_collapse(struct AttachPrivateData *priv, int op)
toggle display of subparts - Implements attach_function_t -
Definition: functions.c:178
static int op_bounce_message(struct AttachPrivateData *priv, int op)
remail a message to another user - Implements attach_function_t -
Definition: functions.c:401
static int op_attachment_edit_type(struct AttachPrivateData *priv, int op)
edit attachment content type - Implements attach_function_t -
Definition: functions.c:271
static int op_extract_keys(struct AttachPrivateData *priv, int op)
extract supported public keys - Implements attach_function_t -
Definition: functions.c:463
static int op_reply(struct AttachPrivateData *priv, int op)
reply to a message - Implements attach_function_t -
Definition: functions.c:520
static int op_attachment_view(struct AttachPrivateData *priv, int op)
view attachment using mailcap entry if necessary - Implements attach_function_t -
Definition: functions.c:353
static int op_exit(struct AttachPrivateData *priv, int op)
exit this menu - Implements attach_function_t -
Definition: functions.c:442
static int op_forward_to_group(struct AttachPrivateData *priv, int op)
forward to newsgroup - Implements attach_function_t -
Definition: functions.c:583
static int op_attachment_view_mailcap(struct AttachPrivateData *priv, int op)
force viewing of attachment using mailcap - Implements attach_function_t -
Definition: functions.c:365
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:429
static int op_attachment_pipe(struct AttachPrivateData *priv, int op)
pipe message/attachment to a shell command - Implements attach_function_t -
Definition: functions.c:281
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:377
static int op_forget_passphrase(struct AttachPrivateData *priv, int op)
wipe passphrases from memory - Implements attach_function_t -
Definition: functions.c:477
static int op_attachment_undelete(struct AttachPrivateData *priv, int op)
undelete the current entry - Implements attach_function_t -
Definition: functions.c:319
static int op_list_subscribe(struct AttachPrivateData *priv, int op)
subscribe to a mailing list - Implements attach_function_t -
Definition: functions.c:500
static int op_attachment_delete(struct AttachPrivateData *priv, int op)
delete the current entry - Implements attach_function_t -
Definition: functions.c:194
static int op_attachment_save(struct AttachPrivateData *priv, int op)
save message/attachment to a mailbox/file - Implements attach_function_t -
Definition: functions.c:303
static int op_attachment_view_text(struct AttachPrivateData *priv, int op)
view attachment as text - Implements attach_function_t -
Definition: functions.c:389
static int op_list_unsubscribe(struct AttachPrivateData *priv, int op)
unsubscribe from a mailing list - Implements attach_function_t -
Definition: functions.c:510
static int op_check_traditional(struct AttachPrivateData *priv, int op)
check for classic PGP - Implements attach_function_t -
Definition: functions.c:415
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:543
int attach_function_dispatcher(struct MuttWindow *win, int op)
Perform a Attach function - Implements function_dispatcher_t -.
Definition: functions.c:641
#define mutt_error(...)
Definition: logging.h:87
#define mutt_message(...)
Definition: logging.h:86
Convenience wrapper for the gui headers.
@ 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: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:178
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:154
#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:168
@ 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:819
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:416
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:413
@ MUTT_VA_MAILCAP
Force viewing using mailcap entry.
Definition: mutt_attach.h:44
@ MUTT_VA_PAGER
View attachment in pager using copiousoutput mailcap.
Definition: mutt_attach.h:46
@ MUTT_VA_AS_TEXT
Force viewing as text.
Definition: mutt_attach.h:45
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:938
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:705
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top)
Print a list of Attachments.
Definition: recvattach.c:863
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
All user-callable functions.
Handling of global boolean variables.
bool OptAttachMsg
(pseudo) used by attach-message
Definition: options.h:37
Private state data for the Pager.
QuadOption
Possible values for a quad-option.
Definition: quad.h:36
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition: quad.h:39
Ask the user a question.
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
Definition: question.c:386
void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
Definition: recvattach.c:1192
struct AttachPtr * current_attachment(struct AttachCtx *actx, struct Menu *menu)
Get the current attachment.
Definition: recvattach.c:69
void recvattach_edit_content_type(struct AttachCtx *actx, struct Menu *menu, struct Email *e)
Edit the content type of an attachment.
Definition: recvattach.c:908
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:787
void mutt_attach_mail_sender(struct AttachCtx *actx, struct Body *cur)
Compose an email to the sender in the email attachment.
Definition: recvcmd.c:1115
void mutt_attach_resend(FILE *fp, struct Mailbox *m, struct AttachCtx *actx, struct Body *cur)
Resend-message, from the attachment menu.
Definition: recvcmd.c:304
void mutt_attach_bounce(struct Mailbox *m, FILE *fp, struct AttachCtx *actx, struct Body *cur)
Bounce function, from the attachment menu.
Definition: recvcmd.c:163
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:941
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:3064
bool mutt_send_list_subscribe(struct Mailbox *m, struct Email *e)
Send a mailing-list subscription email.
Definition: send.c:3035
#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:34
int op
Op returned from the Pager, e.g. OP_NEXT_ENTRY.
Definition: private_data.h:39
struct Menu * menu
Current Menu.
Definition: private_data.h:35
struct ConfigSubset * sub
Config subset.
Definition: private_data.h:37
struct AttachCtx * actx
List of all Attachments.
Definition: private_data.h:36
struct Mailbox * mailbox
Current Mailbox.
Definition: private_data.h:38
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:99
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
Definition: lib.h:69
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
void * mdata
Private data.
Definition: lib.h:137
bool tag_prefix
User has pressed <tag-prefix>
Definition: lib.h:75
int max
Number of entries in the menu.
Definition: lib.h:71
void * wdata
Private data.
Definition: mutt_window.h:145
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39