NeoMutt  2024-04-25-76-g20fe7b
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Compose Function API

Prototype for a Compose Function. More...

+ Collaboration diagram for Compose Function API:

Functions

static int op_attachment_attach_file (struct ComposeSharedData *shared, int op)
 Attach files to this message - Implements compose_function_t -.
 
static int op_attachment_attach_key (struct ComposeSharedData *shared, int op)
 Attach a PGP public key - Implements compose_function_t -.
 
static int op_attachment_attach_message (struct ComposeSharedData *shared, int op)
 Attach messages to this message - Implements compose_function_t -.
 
static int op_attachment_detach (struct ComposeSharedData *shared, int op)
 Delete the current entry - Implements compose_function_t -.
 
static int op_attachment_edit_content_id (struct ComposeSharedData *shared, int op)
 Edit the 'Content-ID' of the attachment - Implements compose_function_t -.
 
static int op_attachment_edit_description (struct ComposeSharedData *shared, int op)
 Edit attachment description - Implements compose_function_t -.
 
static int op_attachment_edit_encoding (struct ComposeSharedData *shared, int op)
 Edit attachment transfer-encoding - Implements compose_function_t -.
 
static int op_attachment_edit_language (struct ComposeSharedData *shared, int op)
 Edit the 'Content-Language' of the attachment - Implements compose_function_t -.
 
static int op_attachment_edit_mime (struct ComposeSharedData *shared, int op)
 Edit attachment using mailcap entry - Implements compose_function_t -.
 
static int op_attachment_edit_type (struct ComposeSharedData *shared, int op)
 Edit attachment content type - Implements compose_function_t -.
 
static int op_attachment_filter (struct ComposeSharedData *shared, int op)
 Filter attachment through a shell command - Implements compose_function_t -.
 
static int op_attachment_get_attachment (struct ComposeSharedData *shared, int op)
 Get a temporary copy of an attachment - Implements compose_function_t -.
 
static int op_attachment_group_alts (struct ComposeSharedData *shared, int op)
 Group tagged attachments as 'multipart/alternative' - Implements compose_function_t -.
 
static int op_attachment_group_lingual (struct ComposeSharedData *shared, int op)
 Group tagged attachments as 'multipart/multilingual' - Implements compose_function_t -.
 
static int op_attachment_group_related (struct ComposeSharedData *shared, int op)
 Group tagged attachments as 'multipart/related' - Implements compose_function_t -.
 
static int op_attachment_move_down (struct ComposeSharedData *shared, int op)
 Move an attachment down in the attachment list - Implements compose_function_t -.
 
static int op_attachment_move_up (struct ComposeSharedData *shared, int op)
 Move an attachment up in the attachment list - Implements compose_function_t -.
 
static int op_attachment_new_mime (struct ComposeSharedData *shared, int op)
 Compose new attachment using mailcap entry - Implements compose_function_t -.
 
static int op_attachment_print (struct ComposeSharedData *shared, int op)
 Print the current entry - Implements compose_function_t -.
 
static int op_attachment_rename_attachment (struct ComposeSharedData *shared, int op)
 Send attachment with a different name - Implements compose_function_t -.
 
static int op_attachment_save (struct ComposeSharedData *shared, int op)
 Save message/attachment to a mailbox/file - Implements compose_function_t -.
 
static int op_attachment_toggle_disposition (struct ComposeSharedData *shared, int op)
 Toggle disposition between inline/attachment - Implements compose_function_t -.
 
static int op_attachment_toggle_recode (struct ComposeSharedData *shared, int op)
 Toggle recoding of this attachment - Implements compose_function_t -.
 
static int op_attachment_toggle_unlink (struct ComposeSharedData *shared, int op)
 Toggle whether to delete file after sending it - Implements compose_function_t -.
 
static int op_attachment_ungroup (struct ComposeSharedData *shared, int op)
 Ungroup a 'multipart' attachment - Implements compose_function_t -.
 
static int op_attachment_update_encoding (struct ComposeSharedData *shared, int op)
 Update an attachment's encoding info - Implements compose_function_t -.
 
static int op_envelope_edit_headers (struct ComposeSharedData *shared, int op)
 Edit the message with headers - Implements compose_function_t -.
 
static int op_compose_edit_file (struct ComposeSharedData *shared, int op)
 Edit the file to be attached - Implements compose_function_t -.
 
static int op_compose_edit_message (struct ComposeSharedData *shared, int op)
 Edit the message - Implements compose_function_t -.
 
static int op_compose_ispell (struct ComposeSharedData *shared, int op)
 Run ispell on the message - Implements compose_function_t -.
 
static int op_compose_postpone_message (struct ComposeSharedData *shared, int op)
 Save this message to send later - Implements compose_function_t -.
 
static int op_compose_rename_file (struct ComposeSharedData *shared, int op)
 Rename/move an attached file - Implements compose_function_t -.
 
static int op_compose_send_message (struct ComposeSharedData *shared, int op)
 Send the message - Implements compose_function_t -.
 
static int op_compose_write_message (struct ComposeSharedData *shared, int op)
 Write the message to a folder - Implements compose_function_t -.
 
static int op_display_headers (struct ComposeSharedData *shared, int op)
 Display message and toggle header weeding - Implements compose_function_t -.
 
static int op_exit (struct ComposeSharedData *shared, int op)
 Exit this menu - Implements compose_function_t -.
 
static int op_forget_passphrase (struct ComposeSharedData *shared, int op)
 Wipe passphrases from memory - Implements compose_function_t -.
 

Detailed Description

Prototype for a Compose Function.

Parameters
sharedShared Compose data
opOperation to perform, e.g. OP_COMPOSE_WRITE_MESSAGE
Return values
enumFunctionRetval

Function Documentation

◆ op_attachment_attach_file()

static int op_attachment_attach_file ( struct ComposeSharedData shared,
int  op 
)
static

Attach files to this message - Implements compose_function_t -.

Definition at line 740 of file functions.c.

741{
742 char *prompt = _("Attach file");
743 int numfiles = 0;
744 char **files = NULL;
745
746 struct Buffer *fname = buf_pool_get();
747 if ((mw_enter_fname(prompt, fname, false, NULL, true, &files, &numfiles,
748 MUTT_SEL_MULTI) == -1) ||
749 buf_is_empty(fname))
750 {
751 for (int i = 0; i < numfiles; i++)
752 FREE(&files[i]);
753
754 FREE(&files);
755 buf_pool_release(&fname);
756 return FR_NO_ACTION;
757 }
758
759 bool error = false;
760 bool added_attachment = false;
761 if (numfiles > 1)
762 {
763 mutt_message(ngettext("Attaching selected file...",
764 "Attaching selected files...", numfiles));
765 }
766 for (int i = 0; i < numfiles; i++)
767 {
768 char *att = files[i];
769 if (!att)
770 continue;
771
772 struct AttachPtr *ap = mutt_aptr_new();
773 ap->unowned = true;
774 ap->body = mutt_make_file_attach(att, shared->sub);
775 if (ap->body)
776 {
777 added_attachment = true;
778 update_idx(shared->adata->menu, shared->adata->actx, ap);
779 }
780 else
781 {
782 error = true;
783 mutt_error(_("Unable to attach %s"), att);
784 mutt_aptr_free(&ap);
785 }
786 FREE(&files[i]);
787 }
788
789 FREE(&files);
790 buf_pool_release(&fname);
791
792 if (!error)
794
797 if (added_attachment)
799 return FR_SUCCESS;
800}
struct AttachPtr * mutt_aptr_new(void)
Create a new Attachment Pointer.
Definition: attach.c:40
void mutt_aptr_free(struct AttachPtr **ptr)
Free an Attachment Pointer.
Definition: attach.c:49
#define MUTT_SEL_MULTI
Multi-selection is enabled.
Definition: lib.h:59
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:291
static void update_idx(struct Menu *menu, struct AttachCtx *actx, struct AttachPtr *ap)
Add a new attachment to the message.
Definition: functions.c:431
@ FR_SUCCESS
Valid function - successfully performed.
Definition: dispatcher.h:39
@ FR_NO_ACTION
Valid function - no action performed.
Definition: dispatcher.h:37
@ NT_EMAIL_CHANGE_ATTACH
Email's Attachments have changed.
Definition: email.h:191
int mw_enter_fname(const char *prompt, struct Buffer *fname, bool mailbox, struct Mailbox *m, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file -.
Definition: curs_lib.c:236
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_message(...)
Definition: logging2.h:91
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:692
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
Definition: hook.h:48
#define FREE(x)
Definition: memory.h:45
#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
#define _(a)
Definition: message.h:28
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:173
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
Definition: notify_type.h:44
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
struct Body * mutt_make_file_attach(const char *path, struct ConfigSubset *sub)
Create a file attachment.
Definition: sendlib.c:607
An email to which things will be attached.
Definition: attach.h:37
struct Body * body
Attachment.
Definition: attach.h:38
bool unowned
Don't unlink on detach.
Definition: attach.h:44
String manipulation buffer.
Definition: buffer.h:36
struct Menu * menu
Menu displaying the attachments.
Definition: attach_data.h:35
struct AttachCtx * actx
Set of attachments.
Definition: attach_data.h:34
struct ConfigSubset * sub
Config set to use.
Definition: shared_data.h:36
struct ComposeAttachData * adata
Attachments.
Definition: shared_data.h:39
struct Email * email
Email being composed.
Definition: shared_data.h:38
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition: email.h:73
+ Here is the call graph for this function:

◆ op_attachment_attach_key()

static int op_attachment_attach_key ( struct ComposeSharedData shared,
int  op 
)
static

Attach a PGP public key - Implements compose_function_t -.

Definition at line 805 of file functions.c.

806{
808 return FR_NOT_IMPL;
809 struct AttachPtr *ap = mutt_aptr_new();
811 if (ap->body)
812 {
813 update_idx(shared->adata->menu, shared->adata->actx, ap);
816 }
817 else
818 {
819 mutt_aptr_free(&ap);
820 }
821
823 return FR_SUCCESS;
824}
struct Body * crypt_pgp_make_key_attachment(void)
Wrapper for CryptModuleSpecs::pgp_make_key_attachment()
Definition: cryptglue.c:304
@ FR_NOT_IMPL
Invalid function - feature not enabled.
Definition: dispatcher.h:36
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:90
#define WithCrypto
Definition: lib.h:116
+ Here is the call graph for this function:

◆ op_attachment_attach_message()

static int op_attachment_attach_message ( struct ComposeSharedData shared,
int  op 
)
static

Attach messages to this message - Implements compose_function_t -.

This function handles:

  • OP_ATTACHMENT_ATTACH_MESSAGE
  • OP_ATTACHMENT_ATTACH_NEWS_MESSAGE

Definition at line 833 of file functions.c.

834{
835 char *prompt = _("Open mailbox to attach message from");
836
837 OptNews = false;
838 if (shared->mailbox && (op == OP_ATTACHMENT_ATTACH_NEWS_MESSAGE))
839 {
840 const char *const c_news_server = cs_subset_string(shared->sub, "news_server");
841 CurrentNewsSrv = nntp_select_server(shared->mailbox, c_news_server, false);
842 if (!CurrentNewsSrv)
843 return FR_NO_ACTION;
844
845 prompt = _("Open newsgroup to attach message from");
846 OptNews = true;
847 }
848
849 struct Buffer *fname = buf_pool_get();
850 if (shared->mailbox)
851 {
852 if ((op == OP_ATTACHMENT_ATTACH_MESSAGE) ^ (shared->mailbox->type == MUTT_NNTP))
853 {
854 buf_strcpy(fname, mailbox_path(shared->mailbox));
855 buf_pretty_mailbox(fname);
856 }
857 }
858
859 if ((mw_enter_fname(prompt, fname, true, shared->mailbox, false, NULL, NULL,
860 MUTT_SEL_NO_FLAGS) == -1) ||
861 buf_is_empty(fname))
862 {
863 buf_pool_release(&fname);
864 return FR_NO_ACTION;
865 }
866
867 if (OptNews)
869 else
870 buf_expand_path(fname);
871
872 if (imap_path_probe(buf_string(fname), NULL) != MUTT_IMAP)
873 {
874 if (pop_path_probe(buf_string(fname), NULL) != MUTT_POP)
875 {
876 if (!OptNews && (nntp_path_probe(buf_string(fname), NULL) != MUTT_NNTP))
877 {
879 {
880 /* check to make sure the file exists and is readable */
881 if (access(buf_string(fname), R_OK) == -1)
882 {
883 mutt_perror("%s", buf_string(fname));
884 buf_pool_release(&fname);
885 return FR_ERROR;
886 }
887 }
888 }
889 }
890 }
891
893
894 struct Mailbox *m_attach = mx_path_resolve(buf_string(fname));
895 const bool old_readonly = m_attach->readonly;
896 if (!mx_mbox_open(m_attach, MUTT_READONLY))
897 {
898 mutt_error(_("Unable to open mailbox %s"), buf_string(fname));
899 mx_fastclose_mailbox(m_attach, false);
900 m_attach = NULL;
901 buf_pool_release(&fname);
902 return FR_ERROR;
903 }
904 buf_pool_release(&fname);
905
906 if (m_attach->msg_count == 0)
907 {
908 mx_mbox_close(m_attach);
909 mutt_error(_("No messages in that folder"));
910 return FR_NO_ACTION;
911 }
912
913 /* `$sort`, `$sort_aux`, `$use_threads` could be changed in dlg_index() */
914 const enum SortType old_sort = cs_subset_sort(shared->sub, "sort");
915 const enum SortType old_sort_aux = cs_subset_sort(shared->sub, "sort_aux");
916 const unsigned char old_use_threads = cs_subset_enum(shared->sub, "use_threads");
917
918 mutt_message(_("Tag the messages you want to attach"));
919 struct MuttWindow *dlg = index_pager_init();
920 struct IndexSharedData *index_shared = dlg->wdata;
921 index_shared->attach_msg = true;
922 dialog_push(dlg);
923 struct Mailbox *m_attach_new = dlg_index(dlg, m_attach);
924 dialog_pop();
925 mutt_window_free(&dlg);
926
927 if (!shared->mailbox)
928 {
929 /* Restore old $sort variables */
930 cs_subset_str_native_set(shared->sub, "sort", old_sort, NULL);
931 cs_subset_str_native_set(shared->sub, "sort_aux", old_sort_aux, NULL);
932 cs_subset_str_native_set(shared->sub, "use_threads", old_use_threads, NULL);
935 return FR_SUCCESS;
936 }
937
938 bool added_attachment = false;
939 for (int i = 0; i < m_attach_new->msg_count; i++)
940 {
941 if (!m_attach_new->emails[i])
942 break;
943 if (!message_is_tagged(m_attach_new->emails[i]))
944 continue;
945
946 struct AttachPtr *ap = mutt_aptr_new();
947 ap->body = mutt_make_message_attach(m_attach_new, m_attach_new->emails[i],
948 true, shared->sub);
949 if (ap->body)
950 {
951 added_attachment = true;
952 update_idx(shared->adata->menu, shared->adata->actx, ap);
953 }
954 else
955 {
956 mutt_error(_("Unable to attach"));
957 mutt_aptr_free(&ap);
958 }
959 }
961
962 if (m_attach_new == m_attach)
963 {
964 m_attach->readonly = old_readonly;
965 }
966 mx_fastclose_mailbox(m_attach_new, false);
967
968 /* Restore old $sort variables */
969 cs_subset_str_native_set(shared->sub, "sort", old_sort, NULL);
970 cs_subset_str_native_set(shared->sub, "sort_aux", old_sort_aux, NULL);
971 cs_subset_str_native_set(shared->sub, "use_threads", old_use_threads, NULL);
973 if (added_attachment)
975 return FR_SUCCESS;
976}
#define MUTT_SEL_NO_FLAGS
No flags are set.
Definition: lib.h:57
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:395
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:291
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
Definition: helpers.c:71
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:266
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:223
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:51
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:52
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:50
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: dialog.c:109
void dialog_pop(void)
Hide a Window from the user.
Definition: dialog.c:142
@ FR_ERROR
Valid function - error occurred.
Definition: dispatcher.h:38
struct MuttWindow * index_pager_init(void)
Allocate the Windows for the Index/Pager.
Definition: dlg_index.c:1404
bool OptNews
(pseudo) used to change reader mode
Definition: globals.c:70
struct Mailbox * dlg_index(struct MuttWindow *dlg, struct Mailbox *m_init)
Display a list of emails -.
Definition: dlg_index.c:1070
#define mutt_perror(...)
Definition: logging2.h:93
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe() -.
Definition: nntp.c:2786
enum MailboxType pop_path_probe(const char *path, const struct stat *st)
Is this a POP Mailbox? - Implements MxOps::path_probe() -.
Definition: pop.c:1157
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
Definition: imap.c:2345
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:202
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:554
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:328
bool message_is_tagged(struct Email *e)
Is a message in the index tagged (and within limit)
Definition: mview.c:364
void mx_fastclose_mailbox(struct Mailbox *m, bool keep_account)
Free up memory associated with the Mailbox.
Definition: mx.c:414
bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:288
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1321
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
Definition: mx.c:1636
enum MxStatus mx_mbox_close(struct Mailbox *m)
Save changes and close mailbox.
Definition: mx.c:598
#define MUTT_READONLY
Open in read-only mode.
Definition: mxapi.h:43
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition: newsrc.c:558
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:77
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition: newsrc.c:1063
struct Body * mutt_make_message_attach(struct Mailbox *m, struct Email *e, bool attach_msg, struct ConfigSubset *sub)
Create a message attachment.
Definition: sendlib.c:454
SortType
Methods for sorting.
Definition: sort2.h:34
size_t dsize
Length of data.
Definition: buffer.h:39
char * data
Pointer to data.
Definition: buffer.h:37
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:37
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:49
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
bool attach_msg
Are we in "attach message" mode?
Definition: shared_data.h:46
A mailbox.
Definition: mailbox.h:79
int msg_count
Total number of messages.
Definition: mailbox.h:88
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
bool readonly
Don't allow changes to the mailbox.
Definition: mailbox.h:116
void * wdata
Private data.
Definition: mutt_window.h:145
struct Connection * conn
Connection to NNTP Server.
Definition: adata.h:62
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: subset.c:297
+ Here is the call graph for this function:

◆ op_attachment_detach()

static int op_attachment_detach ( struct ComposeSharedData shared,
int  op 
)
static

Delete the current entry - Implements compose_function_t -.

Definition at line 981 of file functions.c.

982{
983 struct AttachCtx *actx = shared->adata->actx;
984 if (!check_count(actx))
985 return FR_NO_ACTION;
986
987 struct Menu *menu = shared->adata->menu;
988 struct AttachPtr *cur_att = current_attachment(actx, menu);
989 if (cur_att->unowned)
990 cur_att->body->unlink = false;
991
992 int index = menu_get_index(menu);
993 if (delete_attachment(actx, index) == -1)
994 return FR_ERROR;
995
996 menu->num_tagged = 0;
997 for (int i = 0; i < actx->idxlen; i++)
998 {
999 if (actx->idx[i]->body->tagged)
1000 menu->num_tagged++;
1001 }
1002
1003 update_menu(actx, menu, false);
1005
1006 index = menu_get_index(menu);
1007 if (index == 0)
1008 shared->email->body = actx->idx[0]->body;
1009
1010 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1011 return FR_SUCCESS;
1012}
static bool check_count(struct AttachCtx *actx)
Check if there are any attachments.
Definition: functions.c:225
static int delete_attachment(struct AttachCtx *actx, int aidx)
Delete an attachment.
Definition: functions.c:341
void update_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Redraw the compose window.
Definition: dlg_compose.c:217
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
struct AttachPtr * current_attachment(struct AttachCtx *actx, struct Menu *menu)
Get the current attachment.
Definition: recvattach.c:77
A set of attachments.
Definition: attach.h:65
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:69
short idxlen
Number of attachmentes.
Definition: attach.h:70
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
Definition: body.h:67
bool tagged
This attachment is tagged.
Definition: body.h:89
struct Body * body
List of MIME parts.
Definition: email.h:69
Definition: lib.h:79
int num_tagged
Number of tagged entries.
Definition: lib.h:93
+ Here is the call graph for this function:

◆ op_attachment_edit_content_id()

static int op_attachment_edit_content_id ( struct ComposeSharedData shared,
int  op 
)
static

Edit the 'Content-ID' of the attachment - Implements compose_function_t -.

Definition at line 1017 of file functions.c.

1018{
1019 if (!check_count(shared->adata->actx))
1020 return FR_NO_ACTION;
1021
1022 int rc = FR_NO_ACTION;
1023 struct Buffer *buf = buf_pool_get();
1024 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1025 shared->adata->menu);
1026
1027 char *id = mutt_param_get(&cur_att->body->parameter, "content-id");
1028 if (id)
1029 {
1030 buf_strcpy(buf, id);
1031 }
1032 else
1033 {
1034 id = gen_cid();
1035 buf_strcpy(buf, id);
1036 FREE(&id);
1037 }
1038
1039 if (mw_get_field("Content-ID: ", buf, MUTT_COMP_NO_FLAGS, HC_OTHER, NULL, NULL) == 0)
1040 {
1041 if (!mutt_str_equal(id, buf_string(buf)))
1042 {
1043 if (check_cid(buf_string(buf)))
1044 {
1045 mutt_param_set(&cur_att->body->parameter, "content-id", buf_string(buf));
1048 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1049 rc = FR_SUCCESS;
1050 }
1051 else
1052 {
1053 mutt_error(_("Content-ID can only contain the characters: -.0-9@A-Z_a-z"));
1054 rc = FR_ERROR;
1055 }
1056 }
1057 }
1058
1059 buf_pool_release(&buf);
1060
1061 if (rc != FR_ERROR)
1063
1064 return rc;
1065}
static char * gen_cid(void)
Generate a random Content ID.
Definition: functions.c:242
static bool check_cid(const char *cid)
Check if a Content-ID is valid.
Definition: functions.c:258
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
Definition: window.c:274
@ HC_OTHER
Miscellaneous strings.
Definition: lib.h:56
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:58
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:660
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:56
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
Definition: parameter.c:85
void mutt_param_set(struct ParameterList *pl, const char *attribute, const char *value)
Set a Parameter.
Definition: parameter.c:111
struct ParameterList parameter
Parameters of the content-type.
Definition: body.h:62
+ Here is the call graph for this function:

◆ op_attachment_edit_description()

static int op_attachment_edit_description ( struct ComposeSharedData shared,
int  op 
)
static

Edit attachment description - Implements compose_function_t -.

Definition at line 1070 of file functions.c.

1071{
1072 if (!check_count(shared->adata->actx))
1073 return FR_NO_ACTION;
1074
1075 int rc = FR_NO_ACTION;
1076 struct Buffer *buf = buf_pool_get();
1077
1078 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1079 shared->adata->menu);
1080 buf_strcpy(buf, cur_att->body->description);
1081
1082 /* header names should not be translated */
1083 if (mw_get_field("Description: ", buf, MUTT_COMP_NO_FLAGS, HC_OTHER, NULL, NULL) == 0)
1084 {
1085 if (!mutt_str_equal(cur_att->body->description, buf_string(buf)))
1086 {
1087 mutt_str_replace(&cur_att->body->description, buf_string(buf));
1089 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1090 rc = FR_SUCCESS;
1091 }
1092 }
1093
1094 buf_pool_release(&buf);
1095 return rc;
1096}
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:280
char * description
content-description
Definition: body.h:55
+ Here is the call graph for this function:

◆ op_attachment_edit_encoding()

static int op_attachment_edit_encoding ( struct ComposeSharedData shared,
int  op 
)
static

Edit attachment transfer-encoding - Implements compose_function_t -.

Definition at line 1101 of file functions.c.

1102{
1103 if (!check_count(shared->adata->actx))
1104 return FR_NO_ACTION;
1105
1106 int rc = FR_NO_ACTION;
1107 struct Buffer *buf = buf_pool_get();
1108
1109 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1110 shared->adata->menu);
1111 buf_strcpy(buf, ENCODING(cur_att->body->encoding));
1112
1113 if ((mw_get_field("Content-Transfer-Encoding: ", buf, MUTT_COMP_NO_FLAGS,
1114 HC_OTHER, NULL, NULL) == 0) &&
1115 !buf_is_empty(buf))
1116 {
1117 int enc = mutt_check_encoding(buf_string(buf));
1118 if ((enc != ENC_OTHER) && (enc != ENC_UUENCODED))
1119 {
1120 if (enc != cur_att->body->encoding)
1121 {
1122 cur_att->body->encoding = enc;
1126 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1127 rc = FR_SUCCESS;
1128 }
1129 }
1130 else
1131 {
1132 mutt_error(_("Invalid encoding"));
1133 rc = FR_ERROR;
1134 }
1135 }
1136
1137 buf_pool_release(&buf);
1138 return rc;
1139}
int mutt_check_encoding(const char *c)
Check the encoding type.
Definition: parse.c:437
@ ENC_UUENCODED
UUEncoded text.
Definition: mime.h:54
@ ENC_OTHER
Encoding unknown.
Definition: mime.h:48
#define ENCODING(x)
Definition: mime.h:92
unsigned int encoding
content-transfer-encoding, ContentEncoding
Definition: body.h:41
+ Here is the call graph for this function:

◆ op_attachment_edit_language()

static int op_attachment_edit_language ( struct ComposeSharedData shared,
int  op 
)
static

Edit the 'Content-Language' of the attachment - Implements compose_function_t -.

Definition at line 1144 of file functions.c.

1145{
1146 if (!check_count(shared->adata->actx))
1147 return FR_NO_ACTION;
1148
1149 int rc = FR_NO_ACTION;
1150 struct Buffer *buf = buf_pool_get();
1151 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1152 shared->adata->menu);
1153
1154 buf_strcpy(buf, cur_att->body->language);
1155 if (mw_get_field("Content-Language: ", buf, MUTT_COMP_NO_FLAGS, HC_OTHER, NULL, NULL) == 0)
1156 {
1157 if (!mutt_str_equal(cur_att->body->language, buf_string(buf)))
1158 {
1159 mutt_str_replace(&cur_att->body->language, buf_string(buf));
1162 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1163 rc = FR_SUCCESS;
1164 }
1166 }
1167 else
1168 {
1169 mutt_warning(_("Empty 'Content-Language'"));
1170 rc = FR_ERROR;
1171 }
1172
1173 buf_pool_release(&buf);
1174 return rc;
1175}
#define mutt_warning(...)
Definition: logging2.h:90
char * language
content-language (RFC8255)
Definition: body.h:77
+ Here is the call graph for this function:

◆ op_attachment_edit_mime()

static int op_attachment_edit_mime ( struct ComposeSharedData shared,
int  op 
)
static

Edit attachment using mailcap entry - Implements compose_function_t -.

Definition at line 1180 of file functions.c.

1181{
1182 if (!check_count(shared->adata->actx))
1183 return FR_NO_ACTION;
1184 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1185 shared->adata->menu);
1186 if (!mutt_edit_attachment(cur_att->body))
1187 return FR_NO_ACTION;
1188
1189 mutt_update_encoding(cur_att->body, shared->sub);
1191 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1192 return FR_SUCCESS;
1193}
bool mutt_edit_attachment(struct Body *b)
Edit an attachment.
Definition: mutt_attach.c:265
void mutt_update_encoding(struct Body *b, struct ConfigSubset *sub)
Update the encoding type.
Definition: sendlib.c:422
+ Here is the call graph for this function:

◆ op_attachment_edit_type()

static int op_attachment_edit_type ( struct ComposeSharedData shared,
int  op 
)
static

Edit attachment content type - Implements compose_function_t -.

Definition at line 1198 of file functions.c.

1199{
1200 if (!check_count(shared->adata->actx))
1201 return FR_NO_ACTION;
1202
1203 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1204 shared->adata->menu);
1205 if (!mutt_edit_content_type(NULL, cur_att->body, NULL))
1206 return FR_NO_ACTION;
1207
1208 /* this may have been a change to text/something */
1209 mutt_update_encoding(cur_att->body, shared->sub);
1211 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1212 return FR_SUCCESS;
1213}
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
Definition: external.c:1070
+ Here is the call graph for this function:

◆ op_attachment_filter()

static int op_attachment_filter ( struct ComposeSharedData shared,
int  op 
)
static

Filter attachment through a shell command - Implements compose_function_t -.

This function handles:

  • OP_ATTACHMENT_FILTER
  • OP_PIPE

Definition at line 1222 of file functions.c.

1223{
1224 struct AttachCtx *actx = shared->adata->actx;
1225 if (!check_count(actx))
1226 return FR_NO_ACTION;
1227
1228 struct Menu *menu = shared->adata->menu;
1229 struct AttachPtr *cur_att = current_attachment(actx, menu);
1230 if (cur_att->body->type == TYPE_MULTIPART)
1231 {
1232 mutt_error(_("Can't filter multipart attachments"));
1233 return FR_ERROR;
1234 }
1235 mutt_pipe_attachment_list(actx, NULL, menu->tag_prefix, cur_att->body,
1236 (op == OP_ATTACHMENT_FILTER));
1237 if (op == OP_ATTACHMENT_FILTER) /* cte might have changed */
1238 {
1240 }
1242 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1243 return FR_SUCCESS;
1244}
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition: mime.h:37
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
unsigned int type
content-type primary type, ContentType
Definition: body.h:40
bool tag_prefix
User has pressed <tag-prefix>
Definition: lib.h:85
+ Here is the call graph for this function:

◆ op_attachment_get_attachment()

static int op_attachment_get_attachment ( struct ComposeSharedData shared,
int  op 
)
static

Get a temporary copy of an attachment - Implements compose_function_t -.

Definition at line 1249 of file functions.c.

1250{
1251 struct AttachCtx *actx = shared->adata->actx;
1252 if (!check_count(actx))
1253 return FR_NO_ACTION;
1254
1255 int rc = FR_ERROR;
1256 struct Menu *menu = shared->adata->menu;
1257 struct BodyArray ba = ARRAY_HEAD_INITIALIZER;
1258 ba_add_tagged(&ba, actx, menu);
1259 if (ARRAY_EMPTY(&ba))
1260 goto done;
1261
1262 struct Body **bp = NULL;
1263 ARRAY_FOREACH(bp, &ba)
1264 {
1265 if ((*bp)->type == TYPE_MULTIPART)
1266 {
1267 mutt_warning(_("Can't get multipart attachments"));
1268 continue;
1269 }
1271 }
1272
1274 rc = FR_SUCCESS;
1275
1276done:
1277 ARRAY_FREE(&ba);
1278 /* No send2hook since this doesn't change the message. */
1279 return rc;
1280}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:74
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:204
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition: array.h:58
int mutt_get_tmp_attachment(struct Body *b)
Get a temporary copy of an attachment.
Definition: mutt_attach.c:72
int ba_add_tagged(struct BodyArray *ba, struct AttachCtx *actx, struct Menu *menu)
Get an array of tagged Attachments.
Definition: recvattach.c:1241
The body of an email.
Definition: body.h:36
+ Here is the call graph for this function:

◆ op_attachment_group_alts()

static int op_attachment_group_alts ( struct ComposeSharedData shared,
int  op 
)
static

Group tagged attachments as 'multipart/alternative' - Implements compose_function_t -.

Definition at line 1285 of file functions.c.

1286{
1287 if (shared->adata->menu->num_tagged < 2)
1288 {
1289 mutt_error(_("Grouping 'alternatives' requires at least 2 tagged messages"));
1290 return FR_ERROR;
1291 }
1292
1293 return group_attachments(shared, "alternative");
1294}
static int group_attachments(struct ComposeSharedData *shared, char *subtype)
Group tagged attachments into a multipart group.
Definition: functions.c:522
+ Here is the call graph for this function:

◆ op_attachment_group_lingual()

static int op_attachment_group_lingual ( struct ComposeSharedData shared,
int  op 
)
static

Group tagged attachments as 'multipart/multilingual' - Implements compose_function_t -.

Definition at line 1299 of file functions.c.

1300{
1301 if (shared->adata->menu->num_tagged < 2)
1302 {
1303 mutt_error(_("Grouping 'multilingual' requires at least 2 tagged messages"));
1304 return FR_ERROR;
1305 }
1306
1307 /* traverse to see whether all the parts have Content-Language: set */
1308 int tagged_with_lang_num = 0;
1309 for (struct Body *b = shared->email->body; b; b = b->next)
1310 if (b->tagged && b->language && *b->language)
1311 tagged_with_lang_num++;
1312
1313 if (shared->adata->menu->num_tagged != tagged_with_lang_num)
1314 {
1315 if (query_yesorno(_("Not all parts have 'Content-Language' set, continue?"),
1316 MUTT_YES) != MUTT_YES)
1317 {
1318 mutt_message(_("Not sending this message"));
1319 return FR_ERROR;
1320 }
1321 }
1322
1323 return group_attachments(shared, "multilingual");
1324}
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition: quad.h:39
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
Definition: question.c:326
struct Body * next
next attachment in the list
Definition: body.h:71
+ Here is the call graph for this function:

◆ op_attachment_group_related()

static int op_attachment_group_related ( struct ComposeSharedData shared,
int  op 
)
static

Group tagged attachments as 'multipart/related' - Implements compose_function_t -.

Definition at line 1329 of file functions.c.

1330{
1331 if (shared->adata->menu->num_tagged < 2)
1332 {
1333 mutt_error(_("Grouping 'related' requires at least 2 tagged messages"));
1334 return FR_ERROR;
1335 }
1336
1337 // ensure Content-ID is set for tagged attachments
1338 for (struct Body *b = shared->email->body; b; b = b->next)
1339 {
1340 if (!b->tagged || (b->type == TYPE_MULTIPART))
1341 continue;
1342
1343 char *id = mutt_param_get(&b->parameter, "content-id");
1344 if (id)
1345 continue;
1346
1347 id = gen_cid();
1348 if (id)
1349 {
1350 mutt_param_set(&b->parameter, "content-id", id);
1351 FREE(&id);
1352 }
1353 }
1354
1355 return group_attachments(shared, "related");
1356}
+ Here is the call graph for this function:

◆ op_attachment_move_down()

static int op_attachment_move_down ( struct ComposeSharedData shared,
int  op 
)
static

Move an attachment down in the attachment list - Implements compose_function_t -.

Definition at line 1361 of file functions.c.

1362{
1363 int index = menu_get_index(shared->adata->menu);
1364
1365 struct AttachCtx *actx = shared->adata->actx;
1366
1367 if (index < 0)
1368 return FR_ERROR;
1369
1370 if (index == (actx->idxlen - 1))
1371 {
1372 mutt_error(_("Attachment is already at bottom"));
1373 return FR_NO_ACTION;
1374 }
1375 if ((actx->idx[index]->parent_type == TYPE_MULTIPART) &&
1376 !actx->idx[index]->body->next)
1377 {
1378 mutt_error(_("Attachment can't be moved out of group"));
1379 return FR_ERROR;
1380 }
1381
1382 // find next attachment at current level
1383 int nextidx = index + 1;
1384 while ((nextidx < actx->idxlen) &&
1385 (actx->idx[nextidx]->level > actx->idx[index]->level))
1386 {
1387 nextidx++;
1388 }
1389 if (nextidx == actx->idxlen)
1390 {
1391 mutt_error(_("Attachment is already at bottom"));
1392 return FR_NO_ACTION;
1393 }
1394
1395 // find final position
1396 int finalidx = index + 1;
1397 if (nextidx < actx->idxlen - 1)
1398 {
1399 if ((actx->idx[nextidx]->body->type == TYPE_MULTIPART) &&
1400 (actx->idx[nextidx + 1]->level > actx->idx[nextidx]->level))
1401 {
1402 finalidx += attach_body_count(actx->idx[nextidx]->body->parts, true);
1403 }
1404 }
1405
1406 compose_attach_swap(shared->email, shared->adata->actx, index, nextidx);
1407 mutt_update_tree(shared->adata->actx);
1409 menu_set_index(shared->adata->menu, finalidx);
1410 return FR_SUCCESS;
1411}
int attach_body_count(struct Body *body, bool recurse)
Count bodies.
Definition: lib.c:42
static void compose_attach_swap(struct Email *e, struct AttachCtx *actx, int first, int second)
Swap two adjacent entries in the attachment list.
Definition: functions.c:456
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:174
void mutt_update_tree(struct AttachCtx *actx)
Refresh the list of attachments.
Definition: recvattach.c:122
int level
Nesting depth of attachment.
Definition: attach.h:42
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
+ Here is the call graph for this function:

◆ op_attachment_move_up()

static int op_attachment_move_up ( struct ComposeSharedData shared,
int  op 
)
static

Move an attachment up in the attachment list - Implements compose_function_t -.

Definition at line 1416 of file functions.c.

1417{
1418 int index = menu_get_index(shared->adata->menu);
1419 if (index < 0)
1420 return FR_ERROR;
1421
1422 struct AttachCtx *actx = shared->adata->actx;
1423
1424 if (index == 0)
1425 {
1426 mutt_error(_("Attachment is already at top"));
1427 return FR_NO_ACTION;
1428 }
1429 if (actx->idx[index - 1]->level < actx->idx[index]->level)
1430 {
1431 mutt_error(_("Attachment can't be moved out of group"));
1432 return FR_ERROR;
1433 }
1434
1435 // find previous attachment at current level
1436 int previdx = index - 1;
1437 while ((previdx > 0) && (actx->idx[previdx]->level > actx->idx[index]->level))
1438 previdx--;
1439
1440 compose_attach_swap(shared->email, actx, previdx, index);
1441 mutt_update_tree(actx);
1443 menu_set_index(shared->adata->menu, previdx);
1444 return FR_SUCCESS;
1445}
+ Here is the call graph for this function:

◆ op_attachment_new_mime()

static int op_attachment_new_mime ( struct ComposeSharedData shared,
int  op 
)
static

Compose new attachment using mailcap entry - Implements compose_function_t -.

Definition at line 1450 of file functions.c.

1451{
1452 int rc = FR_NO_ACTION;
1453 struct Buffer *fname = buf_pool_get();
1454 struct Buffer *type = NULL;
1455 struct AttachPtr *ap = NULL;
1456
1457 struct FileCompletionData cdata = { false, shared->mailbox, NULL, NULL };
1458 if ((mw_get_field(_("New file: "), fname, MUTT_COMP_NO_FLAGS, HC_FILE,
1459 &CompleteFileOps, &cdata) != 0) ||
1460 buf_is_empty(fname))
1461 {
1462 goto done;
1463 }
1464 buf_expand_path(fname);
1465
1466 /* Call to lookup_mime_type () ? maybe later */
1467 type = buf_pool_get();
1468 if ((mw_get_field("Content-Type: ", type, MUTT_COMP_NO_FLAGS, HC_OTHER, NULL, NULL) != 0) ||
1469 buf_is_empty(type))
1470 {
1471 goto done;
1472 }
1473
1474 rc = FR_ERROR;
1475 char *p = strchr(buf_string(type), '/');
1476 if (!p)
1477 {
1478 mutt_error(_("Content-Type is of the form base/sub"));
1479 goto done;
1480 }
1481 *p++ = 0;
1482 enum ContentType itype = mutt_check_mime_type(buf_string(type));
1483 if (itype == TYPE_OTHER)
1484 {
1485 mutt_error(_("Unknown Content-Type %s"), buf_string(type));
1486 goto done;
1487 }
1488
1489 ap = mutt_aptr_new();
1490 /* Touch the file */
1491 FILE *fp = mutt_file_fopen(buf_string(fname), "w");
1492 if (!fp)
1493 {
1494 mutt_error(_("Can't create file %s"), buf_string(fname));
1495 goto done;
1496 }
1497 mutt_file_fclose(&fp);
1498
1499 ap->body = mutt_make_file_attach(buf_string(fname), shared->sub);
1500 if (!ap->body)
1501 {
1502 mutt_error(_("Error attaching file"));
1503 goto done;
1504 }
1505 update_idx(shared->adata->menu, shared->adata->actx, ap);
1506 ap = NULL; // shared->adata->actx has taken ownership
1507
1508 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1509 shared->adata->menu);
1510 cur_att->body->type = itype;
1511 mutt_str_replace(&cur_att->body->subtype, p);
1512 cur_att->body->unlink = true;
1515
1516 if (mutt_compose_attachment(cur_att->body))
1517 {
1518 mutt_update_encoding(cur_att->body, shared->sub);
1520 }
1521 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1522 rc = FR_SUCCESS;
1523
1524done:
1525 mutt_aptr_free(&ap);
1526 buf_pool_release(&type);
1527 buf_pool_release(&fname);
1528 return rc;
1529}
const struct CompleteOps CompleteFileOps
Auto-Completion of Files.
Definition: complete.c:154
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
Definition: parse.c:366
#define mutt_file_fclose(FP)
Definition: file.h:149
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:148
@ HC_FILE
Files.
Definition: lib.h:54
ContentType
Content-Type.
Definition: mime.h:30
@ TYPE_OTHER
Unknown Content-Type.
Definition: mime.h:31
int mutt_compose_attachment(struct Body *b)
Create an attachment.
Definition: mutt_attach.c:120
char * subtype
content-type subtype
Definition: body.h:60
Input for the file completion function.
Definition: curs_lib.h:40
+ Here is the call graph for this function:

◆ op_attachment_print()

static int op_attachment_print ( struct ComposeSharedData shared,
int  op 
)
static

Print the current entry - Implements compose_function_t -.

Definition at line 1534 of file functions.c.

1535{
1536 struct AttachCtx *actx = shared->adata->actx;
1537 if (!check_count(actx))
1538 return FR_NO_ACTION;
1539
1540 struct Menu *menu = shared->adata->menu;
1541 struct AttachPtr *cur_att = current_attachment(actx, menu);
1542 if (cur_att->body->type == TYPE_MULTIPART)
1543 {
1544 mutt_error(_("Can't print multipart attachments"));
1545 return FR_ERROR;
1546 }
1547
1548 mutt_print_attachment_list(actx, NULL, menu->tag_prefix, cur_att->body);
1549 /* no send2hook, since this doesn't modify the message */
1550 return FR_SUCCESS;
1551}
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *b)
Print a list of Attachments.
Definition: recvattach.c:888
+ Here is the call graph for this function:

◆ op_attachment_rename_attachment()

static int op_attachment_rename_attachment ( struct ComposeSharedData shared,
int  op 
)
static

Send attachment with a different name - Implements compose_function_t -.

Definition at line 1556 of file functions.c.

1557{
1558 if (!check_count(shared->adata->actx))
1559 return FR_NO_ACTION;
1560 char *src = NULL;
1561 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1562 shared->adata->menu);
1563 if (cur_att->body->d_filename)
1564 src = cur_att->body->d_filename;
1565 else
1566 src = cur_att->body->filename;
1567 struct Buffer *fname = buf_pool_get();
1568 buf_strcpy(fname, mutt_path_basename(NONULL(src)));
1569 struct FileCompletionData cdata = { false, shared->mailbox, NULL, NULL };
1570 int rc = mw_get_field(_("Send attachment with name: "), fname,
1572 if (rc == 0)
1573 {
1574 // It's valid to set an empty string here, to erase what was set
1575 mutt_str_replace(&cur_att->body->d_filename, buf_string(fname));
1577 }
1578 buf_pool_release(&fname);
1579 return FR_SUCCESS;
1580}
const char * mutt_path_basename(const char *path)
Find the last component for a pathname.
Definition: path.c:282
#define NONULL(x)
Definition: string2.h:37
char * d_filename
filename to be used for the content-disposition header If NULL, filename is used instead.
Definition: body.h:56
char * filename
When sending a message, this is the file to which this structure refers.
Definition: body.h:58
+ Here is the call graph for this function:

◆ op_attachment_save()

static int op_attachment_save ( struct ComposeSharedData shared,
int  op 
)
static

Save message/attachment to a mailbox/file - Implements compose_function_t -.

Definition at line 1585 of file functions.c.

1586{
1587 struct AttachCtx *actx = shared->adata->actx;
1588 if (!check_count(actx))
1589 return FR_NO_ACTION;
1590
1591 struct Menu *menu = shared->adata->menu;
1592 struct AttachPtr *cur_att = current_attachment(actx, menu);
1593 if (cur_att->body->type == TYPE_MULTIPART)
1594 {
1595 mutt_error(_("Can't save multipart attachments"));
1596 return FR_ERROR;
1597 }
1598
1599 mutt_save_attachment_list(actx, NULL, menu->tag_prefix, cur_att->body, NULL, menu);
1600 /* no send2hook, since this doesn't modify the message */
1601 return FR_SUCCESS;
1602}
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
+ Here is the call graph for this function:

◆ op_attachment_toggle_disposition()

static int op_attachment_toggle_disposition ( struct ComposeSharedData shared,
int  op 
)
static

Toggle disposition between inline/attachment - Implements compose_function_t -.

Definition at line 1607 of file functions.c.

1608{
1609 /* toggle the content-disposition between inline/attachment */
1610 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1611 shared->adata->menu);
1612 cur_att->body->disposition = (cur_att->body->disposition == DISP_INLINE) ?
1613 DISP_ATTACH :
1616 return FR_SUCCESS;
1617}
@ DISP_ATTACH
Content is attached.
Definition: mime.h:63
@ DISP_INLINE
Content is inline.
Definition: mime.h:62
unsigned int disposition
content-disposition, ContentDisposition
Definition: body.h:42
+ Here is the call graph for this function:

◆ op_attachment_toggle_recode()

static int op_attachment_toggle_recode ( struct ComposeSharedData shared,
int  op 
)
static

Toggle recoding of this attachment - Implements compose_function_t -.

Definition at line 1622 of file functions.c.

1623{
1624 if (!check_count(shared->adata->actx))
1625 return FR_NO_ACTION;
1626 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1627 shared->adata->menu);
1628 if (!mutt_is_text_part(cur_att->body))
1629 {
1630 mutt_error(_("Recoding only affects text attachments"));
1631 return FR_ERROR;
1632 }
1633 cur_att->body->noconv = !cur_att->body->noconv;
1634 if (cur_att->body->noconv)
1635 mutt_message(_("The current attachment won't be converted"));
1636 else
1637 mutt_message(_("The current attachment will be converted"));
1639 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1640 return FR_SUCCESS;
1641}
bool mutt_is_text_part(const struct Body *b)
Is this part of an email in plain text?
Definition: muttlib.c:442
bool noconv
Don't do character set conversion.
Definition: body.h:46
+ Here is the call graph for this function:

◆ op_attachment_toggle_unlink()

static int op_attachment_toggle_unlink ( struct ComposeSharedData shared,
int  op 
)
static

Toggle whether to delete file after sending it - Implements compose_function_t -.

Definition at line 1646 of file functions.c.

1647{
1648 if (!check_count(shared->adata->actx))
1649 return FR_NO_ACTION;
1650 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1651 shared->adata->menu);
1652 cur_att->body->unlink = !cur_att->body->unlink;
1653
1655 /* No send2hook since this doesn't change the message. */
1656 return FR_SUCCESS;
1657}
+ Here is the call graph for this function:

◆ op_attachment_ungroup()

static int op_attachment_ungroup ( struct ComposeSharedData shared,
int  op 
)
static

Ungroup a 'multipart' attachment - Implements compose_function_t -.

Definition at line 1662 of file functions.c.

1663{
1664 if (shared->adata->actx->idx[shared->adata->menu->current]->body->type != TYPE_MULTIPART)
1665 {
1666 mutt_error(_("Attachment is not 'multipart'"));
1667 return FR_ERROR;
1668 }
1669
1670 int aidx = shared->adata->menu->current;
1671 struct AttachCtx *actx = shared->adata->actx;
1672 struct Body *b = actx->idx[aidx]->body;
1673 struct Body *b_next = b->next;
1674 struct Body *b_previous = NULL;
1675 struct Body *b_parent = NULL;
1676 int parent_type = actx->idx[aidx]->parent_type;
1677 int level = actx->idx[aidx]->level;
1678
1679 // reorder body pointers
1680 if (attach_body_previous(shared->email->body, b, &b_previous))
1681 b_previous->next = b->parts;
1682 else if (attach_body_parent(shared->email->body, NULL, b, &b_parent))
1683 b_parent->parts = b->parts;
1684 else
1685 shared->email->body = b->parts;
1686
1687 // update attachment list
1688 int i = aidx + 1;
1689 while (actx->idx[i]->level > level)
1690 {
1691 actx->idx[i]->level--;
1692 if (actx->idx[i]->level == level)
1693 {
1694 actx->idx[i]->parent_type = parent_type;
1695 // set body->next for final attachment in group
1696 if (!actx->idx[i]->body->next)
1697 actx->idx[i]->body->next = b_next;
1698 }
1699 i++;
1700 if (i == actx->idxlen)
1701 break;
1702 }
1703
1704 // free memory
1705 actx->idx[aidx]->body->parts = NULL;
1706 actx->idx[aidx]->body->next = NULL;
1707 actx->idx[aidx]->body->email = NULL;
1708 mutt_body_free(&actx->idx[aidx]->body);
1709 FREE(&actx->idx[aidx]->tree);
1710 FREE(&actx->idx[aidx]);
1711
1712 // reorder attachment list
1713 for (int j = aidx; j < (actx->idxlen - 1); j++)
1714 actx->idx[j] = actx->idx[j + 1];
1715 actx->idx[actx->idxlen - 1] = NULL;
1716 actx->idxlen--;
1717 update_menu(actx, shared->adata->menu, false);
1718
1719 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1720 return FR_SUCCESS;
1721}
bool attach_body_parent(struct Body *start, struct Body *start_parent, struct Body *body, struct Body **body_parent)
Find the parent of a body.
Definition: lib.c:71
bool attach_body_previous(struct Body *start, struct Body *body, struct Body **previous)
Find the previous body of a body.
Definition: lib.c:142
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition: body.c:58
char * tree
Tree characters to display.
Definition: attach.h:41
struct Email * email
header information for message/rfc822
Definition: body.h:73
int current
Current entry.
Definition: lib.h:80
+ Here is the call graph for this function:

◆ op_attachment_update_encoding()

static int op_attachment_update_encoding ( struct ComposeSharedData shared,
int  op 
)
static

Update an attachment's encoding info - Implements compose_function_t -.

Definition at line 1726 of file functions.c.

1727{
1728 struct AttachCtx *actx = shared->adata->actx;
1729 if (!check_count(actx))
1730 return FR_NO_ACTION;
1731
1732 int rc = FR_NO_ACTION;
1733 struct Menu *menu = shared->adata->menu;
1734 struct BodyArray ba = ARRAY_HEAD_INITIALIZER;
1735 ba_add_tagged(&ba, actx, menu);
1736 if (ARRAY_EMPTY(&ba))
1737 goto done;
1738
1739 struct Body **bp = NULL;
1740 ARRAY_FOREACH(bp, &ba)
1741 {
1742 mutt_update_encoding(*bp, shared->sub);
1743 }
1744
1747 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1748 rc = FR_SUCCESS;
1749
1750done:
1751 ARRAY_FREE(&ba);
1752 return rc;
1753}
+ Here is the call graph for this function:

◆ op_envelope_edit_headers()

static int op_envelope_edit_headers ( struct ComposeSharedData shared,
int  op 
)
static

Edit the message with headers - Implements compose_function_t -.

Definition at line 1760 of file functions.c.

1761{
1763 const char *tag = NULL;
1764 char *err = NULL;
1765 mutt_env_to_local(shared->email->env);
1766 const char *const c_editor = cs_subset_string(shared->sub, "editor");
1767 if (shared->email->body->type == TYPE_MULTIPART)
1768 {
1769 struct Body *b = shared->email->body->parts;
1770 while (b->parts)
1771 b = b->parts;
1772 mutt_edit_headers(NONULL(c_editor), b->filename, shared->email, shared->fcc);
1773 }
1774 else
1775 {
1776 mutt_edit_headers(NONULL(c_editor), shared->email->body->filename,
1777 shared->email, shared->fcc);
1778 }
1779
1780 if (mutt_env_to_intl(shared->email->env, &tag, &err))
1781 {
1782 mutt_error(_("Bad IDN in '%s': '%s'"), tag, err);
1783 FREE(&err);
1784 }
1786
1788 mutt_update_encoding(shared->email->body, shared->sub);
1789
1790 /* attachments may have been added */
1791 if (shared->adata->actx->idxlen &&
1792 shared->adata->actx->idx[shared->adata->actx->idxlen - 1]->body->next)
1793 {
1795 update_menu(shared->adata->actx, shared->adata->menu, true);
1796 }
1797
1799 /* Unconditional hook since editor was invoked */
1800 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1801 return FR_SUCCESS;
1802}
void mutt_actx_entries_free(struct AttachCtx *actx)
Free entries in an Attachment Context.
Definition: attach.c:162
@ NT_EMAIL_CHANGE_ENVELOPE
Email's Envelope has changed.
Definition: email.h:190
int mutt_env_to_intl(struct Envelope *env, const char **tag, char **err)
Convert an Envelope's Address fields to Punycode format.
Definition: envelope.c:355
void mutt_env_to_local(struct Envelope *env)
Convert an Envelope's Address fields to local format.
Definition: envelope.c:317
void mutt_edit_headers(const char *editor, const char *body, struct Email *e, struct Buffer *fcc)
Let the user edit the message header and body.
Definition: mutt_header.c:182
void mutt_rfc3676_space_unstuff(struct Email *e)
Remove RFC3676 space stuffing.
Definition: rfc3676.c:499
void mutt_rfc3676_space_stuff(struct Email *e)
Perform RFC3676 space stuffing on an Email.
Definition: rfc3676.c:486
struct Buffer * fcc
Buffer to save FCC.
Definition: shared_data.h:42
struct Envelope * env
Envelope information.
Definition: email.h:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ op_compose_edit_file()

static int op_compose_edit_file ( struct ComposeSharedData shared,
int  op 
)
static

Edit the file to be attached - Implements compose_function_t -.

Definition at line 1807 of file functions.c.

1808{
1809 if (!check_count(shared->adata->actx))
1810 return FR_NO_ACTION;
1811 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1812 shared->adata->menu);
1813 if (cur_att->body->type == TYPE_MULTIPART)
1814 {
1815 mutt_error(_("Can't edit multipart attachments"));
1816 return FR_ERROR;
1817 }
1818 const char *const c_editor = cs_subset_string(shared->sub, "editor");
1819 mutt_edit_file(NONULL(c_editor), cur_att->body->filename);
1820 mutt_update_encoding(cur_att->body, shared->sub);
1823 /* Unconditional hook since editor was invoked */
1824 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1825 return FR_SUCCESS;
1826}
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
Definition: curs_lib.c:116
+ Here is the call graph for this function:

◆ op_compose_edit_message()

static int op_compose_edit_message ( struct ComposeSharedData shared,
int  op 
)
static

Edit the message - Implements compose_function_t -.

Definition at line 1831 of file functions.c.

1832{
1833 const bool c_edit_headers = cs_subset_bool(shared->sub, "edit_headers");
1834 if (!c_edit_headers)
1835 {
1837 const char *const c_editor = cs_subset_string(shared->sub, "editor");
1838 mutt_edit_file(c_editor, shared->email->body->filename);
1840 mutt_update_encoding(shared->email->body, shared->sub);
1842 /* Unconditional hook since editor was invoked */
1843 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1844 return FR_SUCCESS;
1845 }
1846
1847 return op_envelope_edit_headers(shared, op);
1848}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:47
static int op_envelope_edit_headers(struct ComposeSharedData *shared, int op)
Edit the message with headers - Implements compose_function_t -.
Definition: functions.c:1760
+ Here is the call graph for this function:

◆ op_compose_ispell()

static int op_compose_ispell ( struct ComposeSharedData shared,
int  op 
)
static

Run ispell on the message - Implements compose_function_t -.

Definition at line 1853 of file functions.c.

1854{
1855 endwin();
1856 const char *const c_ispell = cs_subset_string(shared->sub, "ispell");
1857 char buf[PATH_MAX] = { 0 };
1858 snprintf(buf, sizeof(buf), "%s -x %s", NONULL(c_ispell), shared->email->body->filename);
1859 if (mutt_system(buf) == -1)
1860 {
1861 mutt_error(_("Error running \"%s\""), buf);
1862 return FR_ERROR;
1863 }
1864
1865 mutt_update_encoding(shared->email->body, shared->sub);
1867 return FR_SUCCESS;
1868}
#define PATH_MAX
Definition: mutt.h:42
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:52
int endwin(void)
+ Here is the call graph for this function:

◆ op_compose_postpone_message()

static int op_compose_postpone_message ( struct ComposeSharedData shared,
int  op 
)
static

Save this message to send later - Implements compose_function_t -.

Definition at line 1873 of file functions.c.

1874{
1875 if (check_attachments(shared->adata->actx, shared->sub) != 0)
1876 {
1878 return FR_ERROR;
1879 }
1880
1881 shared->rc = 1;
1882 return FR_DONE;
1883}
static int check_attachments(struct AttachCtx *actx, struct ConfigSubset *sub)
Check if any attachments have changed or been deleted.
Definition: functions.c:278
@ FR_DONE
Exit the Dialog.
Definition: dispatcher.h:35
int rc
Return code to leave compose.
Definition: shared_data.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ op_compose_rename_file()

static int op_compose_rename_file ( struct ComposeSharedData shared,
int  op 
)
static

Rename/move an attached file - Implements compose_function_t -.

Definition at line 1888 of file functions.c.

1889{
1890 if (!check_count(shared->adata->actx))
1891 return FR_NO_ACTION;
1892 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
1893 shared->adata->menu);
1894 if (cur_att->body->type == TYPE_MULTIPART)
1895 {
1896 mutt_error(_("Can't rename multipart attachments"));
1897 return FR_ERROR;
1898 }
1899 struct Buffer *fname = buf_pool_get();
1900 buf_strcpy(fname, cur_att->body->filename);
1901 buf_pretty_mailbox(fname);
1902 struct FileCompletionData cdata = { false, shared->mailbox, NULL, NULL };
1903 if ((mw_get_field(_("Rename to: "), fname, MUTT_COMP_NO_FLAGS, HC_FILE,
1904 &CompleteFileOps, &cdata) == 0) &&
1905 !buf_is_empty(fname))
1906 {
1907 struct stat st = { 0 };
1908 if (stat(cur_att->body->filename, &st) == -1)
1909 {
1910 /* L10N: "stat" is a system call. Do "man 2 stat" for more information. */
1911 mutt_error(_("Can't stat %s: %s"), buf_string(fname), strerror(errno));
1912 buf_pool_release(&fname);
1913 return FR_ERROR;
1914 }
1915
1916 buf_expand_path(fname);
1917 if (mutt_file_rename(cur_att->body->filename, buf_string(fname)))
1918 {
1919 buf_pool_release(&fname);
1920 return FR_ERROR;
1921 }
1922
1923 mutt_str_replace(&cur_att->body->filename, buf_string(fname));
1925
1926 if (cur_att->body->stamp >= st.st_mtime)
1927 mutt_stamp_attachment(cur_att->body);
1928 mutt_message_hook(NULL, shared->email, MUTT_SEND2_HOOK);
1929 }
1930 buf_pool_release(&fname);
1931 return FR_SUCCESS;
1932}
int mutt_file_rename(const char *oldfile, const char *newfile)
Rename a file.
Definition: file.c:1371
void mutt_stamp_attachment(struct Body *b)
Timestamp an Attachment.
Definition: sendlib.c:410
time_t stamp
Time stamp of last encoding update.
Definition: body.h:76
+ Here is the call graph for this function:

◆ op_compose_send_message()

static int op_compose_send_message ( struct ComposeSharedData shared,
int  op 
)
static

Send the message - Implements compose_function_t -.

Definition at line 1937 of file functions.c.

1938{
1939 /* Note: We don't invoke send2-hook here, since we want to leave
1940 * users an opportunity to change settings from the ":" prompt. */
1941 if (check_attachments(shared->adata->actx, shared->sub) != 0)
1942 {
1944 return FR_NO_ACTION;
1945 }
1946
1947#ifdef MIXMASTER
1948 if (!STAILQ_EMPTY(&shared->email->chain) && (mix_check_message(shared->email) != 0))
1949 return FR_NO_ACTION;
1950#endif
1951
1952 if (!shared->fcc_set && !buf_is_empty(shared->fcc))
1953 {
1954 enum QuadOption ans = query_quadoption(_("Save a copy of this message?"),
1955 shared->sub, "copy");
1956 if (ans == MUTT_ABORT)
1957 return FR_NO_ACTION;
1958 else if (ans == MUTT_NO)
1959 buf_reset(shared->fcc);
1960 }
1961
1962 shared->rc = 0;
1963 return FR_DONE;
1964}
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:76
int mix_check_message(struct Email *e)
Safety-check the message before passing it to mixmaster.
Definition: mixmaster.c:50
QuadOption
Possible values for a quad-option.
Definition: quad.h:36
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
Definition: quad.h:37
@ MUTT_NO
User answered 'No', or assume 'No'.
Definition: quad.h:38
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
Definition: question.c:365
#define STAILQ_EMPTY(head)
Definition: queue.h:348
bool fcc_set
User has edited the Fcc: field.
Definition: shared_data.h:44
struct ListHead chain
Mixmaster chain.
Definition: email.h:93
+ Here is the call graph for this function:

◆ op_compose_write_message()

static int op_compose_write_message ( struct ComposeSharedData shared,
int  op 
)
static

Write the message to a folder - Implements compose_function_t -.

Definition at line 1969 of file functions.c.

1970{
1971 int rc = FR_NO_ACTION;
1972 struct Buffer *fname = buf_pool_get();
1973 if (shared->mailbox)
1974 {
1975 buf_strcpy(fname, mailbox_path(shared->mailbox));
1976 buf_pretty_mailbox(fname);
1977 }
1978 if (shared->adata->actx->idxlen)
1979 shared->email->body = shared->adata->actx->idx[0]->body;
1980 if ((mw_enter_fname(_("Write message to mailbox"), fname, true, shared->mailbox,
1981 false, NULL, NULL, MUTT_SEL_NO_FLAGS) != -1) &&
1982 !buf_is_empty(fname))
1983 {
1984 mutt_message(_("Writing message to %s ..."), buf_string(fname));
1985 buf_expand_path(fname);
1986
1987 if (shared->email->body->next)
1988 shared->email->body = mutt_make_multipart(shared->email->body);
1989
1990 if (mutt_write_fcc(buf_string(fname), shared->email, NULL, false, NULL,
1991 NULL, shared->sub) == 0)
1992 mutt_message(_("Message written"));
1993
1994 shared->email->body = mutt_remove_multipart(shared->email->body);
1995 rc = FR_SUCCESS;
1996 }
1997 buf_pool_release(&fname);
1998 return rc;
1999}
struct Body * mutt_remove_multipart(struct Body *b)
Extract the multipart body if it exists.
Definition: multipart.c:126
struct Body * mutt_make_multipart(struct Body *b)
Create a multipart email.
Definition: multipart.c:100
int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, bool post, const char *fcc, char **finalpath, struct ConfigSubset *sub)
Write email to FCC mailbox.
Definition: sendlib.c:1053
+ Here is the call graph for this function:

◆ op_display_headers()

static int op_display_headers ( struct ComposeSharedData shared,
int  op 
)
static

Display message and toggle header weeding - Implements compose_function_t -.

This function handles:

  • OP_ATTACHMENT_VIEW
  • OP_ATTACHMENT_VIEW_MAILCAP
  • OP_ATTACHMENT_VIEW_PAGER
  • OP_ATTACHMENT_VIEW_TEXT
  • OP_DISPLAY_HEADERS

Definition at line 2011 of file functions.c.

2012{
2013 if (!check_count(shared->adata->actx))
2014 return FR_NO_ACTION;
2015
2016 enum ViewAttachMode mode = MUTT_VA_REGULAR;
2017
2018 switch (op)
2019 {
2020 case OP_ATTACHMENT_VIEW:
2021 case OP_DISPLAY_HEADERS:
2022 break;
2023
2024 case OP_ATTACHMENT_VIEW_MAILCAP:
2025 mode = MUTT_VA_MAILCAP;
2026 break;
2027
2028 case OP_ATTACHMENT_VIEW_PAGER:
2029 mode = MUTT_VA_PAGER;
2030 break;
2031
2032 case OP_ATTACHMENT_VIEW_TEXT:
2033 mode = MUTT_VA_AS_TEXT;
2034 break;
2035 }
2036
2037 if (mode == MUTT_VA_REGULAR)
2038 {
2039 mutt_attach_display_loop(shared->sub, shared->adata->menu, op,
2040 shared->email, shared->adata->actx, false);
2041 }
2042 else
2043 {
2044 struct AttachPtr *cur_att = current_attachment(shared->adata->actx,
2045 shared->adata->menu);
2046 mutt_view_attachment(NULL, cur_att->body, mode, shared->email,
2047 shared->adata->actx, shared->adata->menu->win);
2048 }
2049
2051 /* no send2hook, since this doesn't modify the message */
2052 return FR_SUCCESS;
2053}
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:419
ViewAttachMode
Options for mutt_view_attachment()
Definition: mutt_attach.h:43
@ MUTT_VA_MAILCAP
Force viewing using mailcap entry.
Definition: mutt_attach.h:45
@ MUTT_VA_REGULAR
View using default method.
Definition: mutt_attach.h:44
@ 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
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
+ Here is the call graph for this function:

◆ op_exit()

static int op_exit ( struct ComposeSharedData shared,
int  op 
)
static

Exit this menu - Implements compose_function_t -.

Definition at line 2058 of file functions.c.

2059{
2060 enum QuadOption ans = query_quadoption(_("Save (postpone) draft message?"),
2061 shared->sub, "postpone");
2062 if (ans == MUTT_NO)
2063 {
2064 for (int i = 0; i < shared->adata->actx->idxlen; i++)
2065 if (shared->adata->actx->idx[i]->unowned)
2066 shared->adata->actx->idx[i]->body->unlink = false;
2067
2068 if (!(shared->flags & MUTT_COMPOSE_NOFREEHEADER))
2069 {
2070 for (int i = 0; i < shared->adata->actx->idxlen; i++)
2071 {
2072 /* avoid freeing other attachments */
2073 shared->adata->actx->idx[i]->body->next = NULL;
2074 if (!shared->adata->actx->idx[i]->body->email)
2075 shared->adata->actx->idx[i]->body->parts = NULL;
2076 mutt_body_free(&shared->adata->actx->idx[i]->body);
2077 }
2078 }
2079 shared->rc = -1;
2080 return FR_DONE;
2081 }
2082 else if (ans == MUTT_ABORT)
2083 {
2084 return FR_NO_ACTION;
2085 }
2086
2087 return op_compose_postpone_message(shared, op);
2088}
#define MUTT_COMPOSE_NOFREEHEADER
Definition: lib.h:50
static int op_compose_postpone_message(struct ComposeSharedData *shared, int op)
Save this message to send later - Implements compose_function_t -.
Definition: functions.c:1873
int flags
Flags, e.g. MUTT_COMPOSE_NOFREEHEADER.
Definition: shared_data.h:43
+ Here is the call graph for this function:

◆ op_forget_passphrase()

static int op_forget_passphrase ( struct ComposeSharedData shared,
int  op 
)
static

Wipe passphrases from memory - Implements compose_function_t -.

Definition at line 2093 of file functions.c.

2094{
2096 return FR_SUCCESS;
2097}
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition: crypt.c:90
+ Here is the call graph for this function: