NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
DOXYGEN
recvcmd.h File Reference

Send/reply with an attachment. More...

#include <stdio.h>
#include "send/lib.h"
+ Include dependency graph for recvcmd.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void mutt_attach_bounce (struct Mailbox *m, FILE *fp, struct AttachCtx *actx, struct Body *cur)
 Bounce function, from the attachment menu. More...
 
void mutt_attach_resend (FILE *fp, struct Mailbox *m, struct AttachCtx *actx, struct Body *cur)
 Resend-message, from the attachment menu. More...
 
void mutt_attach_forward (FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *cur, SendFlags flags)
 Forward an Attachment. More...
 
void mutt_attach_reply (FILE *fp, struct Mailbox *m, struct Email *e, struct AttachCtx *actx, struct Body *e_cur, SendFlags flags)
 Attach a reply. More...
 
void mutt_attach_mail_sender (struct AttachCtx *actx, struct Body *cur)
 Compose an email to the sender in the email attachment. More...
 

Detailed Description

Send/reply with an attachment.

Authors
  • Thomas Roessler

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file recvcmd.h.

Function Documentation

◆ mutt_attach_bounce()

void mutt_attach_bounce ( struct Mailbox m,
FILE *  fp,
struct AttachCtx actx,
struct Body cur 
)

Bounce function, from the attachment menu.

Parameters
mMailbox
fpHandle of message
actxAttachment context
curBody of email

Definition at line 163 of file recvcmd.c.

164{
165 if (!m || !fp || !actx)
166 return;
167
168 if (!check_all_msg(actx, cur, true))
169 return;
170
171 struct AddressList al = TAILQ_HEAD_INITIALIZER(al);
172 struct Buffer *prompt = mutt_buffer_pool_get();
173 struct Buffer *buf = mutt_buffer_pool_get();
174
175 /* RFC5322 mandates a From: header, so warn before bouncing
176 * messages without one */
177 if (cur)
178 {
179 if (TAILQ_EMPTY(&cur->email->env->from))
180 {
181 mutt_error(_("Warning: message contains no From: header"));
183 }
184 }
185 else
186 {
187 for (short i = 0; i < actx->idxlen; i++)
188 {
189 if (actx->idx[i]->body->tagged)
190 {
191 if (TAILQ_EMPTY(&actx->idx[i]->body->email->env->from))
192 {
193 mutt_error(_("Warning: message contains no From: header"));
195 break;
196 }
197 }
198 }
199 }
200
201 /* one or more messages? */
202 int num_msg = cur ? 1 : count_tagged(actx);
203 if (num_msg == 1)
204 mutt_buffer_strcpy(prompt, _("Bounce message to: "));
205 else
206 mutt_buffer_strcpy(prompt, _("Bounce tagged messages to: "));
207
209 false, NULL, NULL, NULL) != 0) ||
211 {
212 goto done;
213 }
214
216 if (TAILQ_EMPTY(&al))
217 {
218 mutt_error(_("Error parsing address"));
219 goto done;
220 }
221
223
224 char *err = NULL;
225 if (mutt_addrlist_to_intl(&al, &err) < 0)
226 {
227 mutt_error(_("Bad IDN: '%s'"), err);
228 FREE(&err);
229 goto done;
230 }
231
233 mutt_buffer_alloc(buf, 8192);
234 mutt_addrlist_write(&al, buf->data, buf->dsize, true);
235
236#define EXTRA_SPACE (15 + 7 + 2)
237 /* See commands.c. */
238 mutt_buffer_printf(prompt, ngettext("Bounce message to %s?", "Bounce messages to %s?", num_msg),
239 mutt_buffer_string(buf));
240
241 const size_t width = msgwin_get_width();
242 if (mutt_strwidth(mutt_buffer_string(prompt)) > (width - EXTRA_SPACE))
243 {
244 struct Buffer *scratch = mutt_buffer_pool_get();
245 mutt_simple_format(scratch->data, scratch->dsize - 4, 0, width - EXTRA_SPACE,
246 JUSTIFY_LEFT, 0, prompt->data, prompt->dsize, false);
247 mutt_buffer_addstr(scratch, "...?");
248 mutt_buffer_copy(prompt, scratch);
249 mutt_buffer_pool_release(&scratch);
250 }
251 else
252 {
253 mutt_buffer_addstr(prompt, "?");
254 }
255
256 const enum QuadOption c_bounce = cs_subset_quad(NeoMutt->sub, "bounce");
257 if (query_quadoption(c_bounce, mutt_buffer_string(prompt)) != MUTT_YES)
258 {
260 mutt_message(ngettext("Message not bounced", "Messages not bounced", num_msg));
261 goto done;
262 }
263
265
266 int rc = 0;
267 if (cur)
268 {
269 rc = mutt_bounce_message(fp, m, cur->email, &al, NeoMutt->sub);
270 }
271 else
272 {
273 for (short i = 0; i < actx->idxlen; i++)
274 {
275 if (actx->idx[i]->body->tagged)
276 {
277 if (mutt_bounce_message(actx->idx[i]->fp, m, actx->idx[i]->body->email,
278 &al, NeoMutt->sub))
279 {
280 rc = 1;
281 }
282 }
283 }
284 }
285
286 if (rc == 0)
287 mutt_message(ngettext("Message bounced", "Messages bounced", num_msg));
288 else
289 mutt_error(ngettext("Error bouncing message", "Error bouncing messages", num_msg));
290
291done:
295}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1470
size_t mutt_addrlist_write(const struct AddressList *al, char *buf, size_t buflen, bool display)
Write an Address to a buffer.
Definition: address.c:1150
int mutt_addrlist_parse(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:458
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1305
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
Definition: alias.c:298
void mutt_buffer_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition: buffer.c:275
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:260
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:327
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:233
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:168
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:462
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:85
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
enum QuadOption cs_subset_quad(const struct ConfigSubset *sub, const char *name)
Get a quad-value config item by name.
Definition: helpers.c:218
void mutt_simple_format(char *buf, size_t buflen, int min_width, int max_width, enum FormatJustify justify, char pad_char, const char *s, size_t n, bool arboreal)
Format a string, like snprintf()
Definition: curs_lib.c:639
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:907
@ JUSTIFY_LEFT
Left justify the text.
Definition: curs_lib.h:42
int mutt_buffer_get_field(const char *field, struct Buffer *buf, CompletionFlags complete, bool multiple, struct Mailbox *m, char ***files, int *numfiles)
Ask the user for a string.
Definition: window.c:180
#define mutt_error(...)
Definition: logging.h:87
#define mutt_message(...)
Definition: logging.h:86
#define FREE(x)
Definition: memory.h:43
size_t msgwin_get_width(void)
Get the width of the Message Window.
Definition: msgwin.c:269
void msgwin_clear_text(void)
Clear the text in the Message Window.
Definition: msgwin.c:249
#define _(a)
Definition: message.h:28
#define MUTT_COMP_ALIAS
Alias completion (in alias dialog)
Definition: mutt.h:53
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
QuadOption
Possible values for a quad-option.
Definition: quad.h:36
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition: quad.h:39
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
Definition: question.c:386
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:637
#define TAILQ_EMPTY(head)
Definition: queue.h:721
static short count_tagged(struct AttachCtx *actx)
Count the number of tagged attachments.
Definition: recvcmd.c:128
#define EXTRA_SPACE
static bool check_all_msg(struct AttachCtx *actx, struct Body *cur, bool err)
Are all the Attachments RFC822 messages?
Definition: recvcmd.c:87
int mutt_bounce_message(FILE *fp, struct Mailbox *m, struct Email *e, struct AddressList *to, struct ConfigSubset *sub)
Bounce an email message.
Definition: sendlib.c:894
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:55
short idxlen
Number of attachmentes.
Definition: attach.h:56
struct Body * body
Attachment.
Definition: attach.h:36
FILE * fp
Used in the recvattach menu.
Definition: attach.h:37
struct Email * email
header information for message/rfc822
Definition: body.h:73
bool tagged
This attachment is tagged.
Definition: body.h:89
String manipulation buffer.
Definition: buffer.h:34
size_t dsize
Length of data.
Definition: buffer.h:37
char * data
Pointer to data.
Definition: buffer.h:35
struct Envelope * env
Envelope information.
Definition: email.h:66
struct AddressList from
Email's 'From' list.
Definition: envelope.h:59
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_attach_resend()

void mutt_attach_resend ( FILE *  fp,
struct Mailbox m,
struct AttachCtx actx,
struct Body cur 
)

Resend-message, from the attachment menu.

Parameters
fpFile containing email
mCurrent mailbox
actxAttachment context
curAttachment

Definition at line 304 of file recvcmd.c.

305{
306 if (!check_all_msg(actx, cur, true))
307 return;
308
309 if (cur)
310 mutt_resend_message(fp, m, cur->email, NeoMutt->sub);
311 else
312 {
313 for (short i = 0; i < actx->idxlen; i++)
314 {
315 if (actx->idx[i]->body->tagged)
316 {
317 mutt_resend_message(actx->idx[i]->fp, m, actx->idx[i]->body->email,
318 NeoMutt->sub);
319 }
320 }
321 }
322}
int mutt_resend_message(FILE *fp, struct Mailbox *m, struct Email *e_cur, struct ConfigSubset *sub)
Resend an email.
Definition: send.c:1638
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_attach_forward()

void mutt_attach_forward ( FILE *  fp,
struct Email e,
struct AttachCtx actx,
struct Body cur,
SendFlags  flags 
)

Forward an Attachment.

Parameters
fpHandle to the attachment
eEmail
actxAttachment Context
curCurrent message
flagsSend mode, see SendFlags

Definition at line 787 of file recvcmd.c.

789{
790 if (check_all_msg(actx, cur, false))
791 attach_forward_msgs(fp, actx, cur, flags);
792 else
793 {
794 const short nattach = count_tagged(actx);
795 attach_forward_bodies(fp, e, actx, cur, nattach);
796 }
797}
static void attach_forward_bodies(FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *cur, short nattach)
Forward one or several MIME bodies.
Definition: recvcmd.c:480
static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, struct Body *cur, SendFlags flags)
Forward one or several message-type attachments.
Definition: recvcmd.c:659
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_attach_reply()

void mutt_attach_reply ( FILE *  fp,
struct Mailbox m,
struct Email e,
struct AttachCtx actx,
struct Body e_cur,
SendFlags  flags 
)

Attach a reply.

Parameters
fpFile handle to reply
mMailbox
eEmail
actxAttachment Context
e_curCurrent message
flagsSend mode, see SendFlags

Definition at line 941 of file recvcmd.c.

943{
944 bool mime_reply_any = false;
945
946 short nattach = 0;
947 struct AttachPtr *parent = NULL;
948 struct Email *e_parent = NULL;
949 FILE *fp_parent = NULL;
950 struct Email *e_tmp = NULL;
951 FILE *fp_tmp = NULL;
952 struct Buffer *tmpbody = NULL;
953 struct EmailList el = STAILQ_HEAD_INITIALIZER(el);
954
955 char prefix[128] = { 0 };
956
957#ifdef USE_NNTP
958 if (flags & SEND_NEWS)
959 OptNewsSend = true;
960 else
961 OptNewsSend = false;
962#endif
963
964 if (!check_all_msg(actx, e_cur, false))
965 {
966 nattach = count_tagged(actx);
967 parent = find_parent(actx, e_cur, nattach);
968 if (parent)
969 {
970 e_parent = parent->body->email;
971 fp_parent = parent->fp;
972 }
973 else
974 {
975 e_parent = e;
976 fp_parent = actx->fp_root;
977 }
978 }
979
980 if ((nattach > 1) && !check_can_decode(actx, e_cur))
981 {
982 const enum QuadOption c_mime_forward_rest = cs_subset_quad(NeoMutt->sub, "mime_forward_rest");
983 const enum QuadOption ans = query_quadoption(
984 c_mime_forward_rest,
985 _("Can't decode all tagged attachments. MIME-encapsulate the others?"));
986 if (ans == MUTT_ABORT)
987 return;
988 if (ans == MUTT_YES)
989 mime_reply_any = true;
990 }
991 else if (nattach == 1)
992 mime_reply_any = true;
993
994 e_tmp = email_new();
995 e_tmp->env = mutt_env_new();
996
997 if (attach_reply_envelope_defaults(e_tmp->env, actx,
998 e_parent ? e_parent : (e_cur ? e_cur->email : NULL),
999 flags) == -1)
1000 {
1001 goto cleanup;
1002 }
1003
1004 tmpbody = mutt_buffer_pool_get();
1005 mutt_buffer_mktemp(tmpbody);
1006 fp_tmp = mutt_file_fopen(mutt_buffer_string(tmpbody), "w");
1007 if (!fp_tmp)
1008 {
1009 mutt_error(_("Can't create %s"), mutt_buffer_string(tmpbody));
1010 goto cleanup;
1011 }
1012
1013 if (!e_parent)
1014 {
1015 if (e_cur)
1016 attach_include_reply(fp, fp_tmp, e_cur->email);
1017 else
1018 {
1019 for (short i = 0; i < actx->idxlen; i++)
1020 {
1021 if (actx->idx[i]->body->tagged)
1022 attach_include_reply(actx->idx[i]->fp, fp_tmp, actx->idx[i]->body->email);
1023 }
1024 }
1025 }
1026 else
1027 {
1028 mutt_make_attribution(e_parent, fp_tmp, NeoMutt->sub);
1029
1030 struct State st;
1031 memset(&st, 0, sizeof(struct State));
1032 st.fp_out = fp_tmp;
1033
1034 const bool c_text_flowed = cs_subset_bool(NeoMutt->sub, "text_flowed");
1035 if (c_text_flowed)
1036 {
1037 mutt_str_copy(prefix, ">", sizeof(prefix));
1038 }
1039 else
1040 {
1041 const char *const c_indent_string = cs_subset_string(NeoMutt->sub, "indent_string");
1042 mutt_make_string(prefix, sizeof(prefix), 0, NONULL(c_indent_string), m,
1043 -1, e_parent, MUTT_FORMAT_NO_FLAGS, NULL);
1044 }
1045
1046 st.prefix = prefix;
1047 st.flags = MUTT_CHARCONV;
1048
1049 const bool c_weed = cs_subset_bool(NeoMutt->sub, "weed");
1050 if (c_weed)
1051 st.flags |= MUTT_WEED;
1052
1053 const bool c_header = cs_subset_bool(NeoMutt->sub, "header");
1054 if (c_header)
1055 include_header(true, fp_parent, e_parent, fp_tmp, prefix);
1056
1057 if (e_cur)
1058 {
1059 if (mutt_can_decode(e_cur))
1060 {
1061 st.fp_in = fp;
1062 mutt_body_handler(e_cur, &st);
1063 state_putc(&st, '\n');
1064 }
1065 else
1066 mutt_body_copy(fp, &e_tmp->body, e_cur);
1067 }
1068 else
1069 {
1070 for (short i = 0; i < actx->idxlen; i++)
1071 {
1072 if (actx->idx[i]->body->tagged && mutt_can_decode(actx->idx[i]->body))
1073 {
1074 st.fp_in = actx->idx[i]->fp;
1075 mutt_body_handler(actx->idx[i]->body, &st);
1076 state_putc(&st, '\n');
1077 }
1078 }
1079 }
1080
1081 mutt_make_post_indent(e_parent, fp_tmp, NeoMutt->sub);
1082
1083 if (mime_reply_any && !e_cur && !copy_problematic_attachments(&e_tmp->body, actx, false))
1084 {
1085 goto cleanup;
1086 }
1087 }
1088
1089 mutt_file_fclose(&fp_tmp);
1090
1091 emaillist_add_email(&el, e_parent ? e_parent : (e_cur ? e_cur->email : NULL));
1092 if (mutt_send_message(flags, e_tmp, mutt_buffer_string(tmpbody), NULL, &el,
1093 NeoMutt->sub) == 0)
1094 {
1095 mutt_set_flag(m, e, MUTT_REPLIED, true);
1096 }
1097 e_tmp = NULL; /* mutt_send_message frees this */
1098
1099cleanup:
1100 if (fp_tmp)
1101 {
1102 mutt_file_fclose(&fp_tmp);
1104 }
1105 mutt_buffer_pool_release(&tmpbody);
1106 email_free(&e_tmp);
1107 emaillist_clear(&el);
1108}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:317
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
int emaillist_add_email(struct EmailList *el, struct Email *e)
Add an Email to a list.
Definition: email.c:159
struct Email * email_new(void)
Create a new Email.
Definition: email.c:78
void email_free(struct Email **ptr)
Free an Email.
Definition: email.c:44
void emaillist_clear(struct EmailList *el)
Drop a private list of Emails.
Definition: email.c:138
struct Envelope * mutt_env_new(void)
Create a new Envelope.
Definition: envelope.c:43
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:618
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:152
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:194
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: format_flags.h:30
bool mutt_can_decode(struct Body *b)
Will decoding the attachment produce any output.
Definition: handler.c:1827
int mutt_body_handler(struct Body *b, struct State *s)
Handler for the Body of an email.
Definition: handler.c:1597
void mutt_make_string(char *buf, size_t buflen, int cols, const char *s, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
Definition: hdrline.c:1405
#define MUTT_WEED
Weed headers even when not in display mode.
Definition: state.h:35
#define state_putc(STATE, STR)
Definition: state.h:57
#define MUTT_CHARCONV
Do character set conversions.
Definition: state.h:36
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:652
@ MUTT_REPLIED
Messages that have been replied to.
Definition: mutt.h:92
int mutt_body_copy(FILE *fp, struct Body **tgt, struct Body *src)
Create a send-mode duplicate from a receive-mode body.
Definition: mutt_body.c:48
#define mutt_buffer_mktemp(buf)
Definition: muttlib.h:74
bool OptNewsSend
(pseudo) used to change behavior when posting
Definition: options.h:51
#define mutt_set_flag(m, e, flag, bf)
Definition: protos.h:63
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
Definition: quad.h:37
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
static void attach_include_reply(FILE *fp, FILE *fp_tmp, struct Email *e)
This is very similar to send.c's include_reply()
Definition: recvcmd.c:911
static struct Body ** copy_problematic_attachments(struct Body **last, struct AttachCtx *actx, bool force)
Attach the body parts which can't be decoded.
Definition: recvcmd.c:455
static void include_header(bool quote, FILE *fp_in, struct Email *e, FILE *fp_out, char *prefix)
Write an email header to a file, optionally quoting it.
Definition: recvcmd.c:417
static bool check_can_decode(struct AttachCtx *actx, struct Body *cur)
Can we decode all tagged attachments?
Definition: recvcmd.c:111
static struct AttachPtr * find_parent(struct AttachCtx *actx, struct Body *cur, short nattach)
Find the parent of an Attachment.
Definition: recvcmd.c:386
static int attach_reply_envelope_defaults(struct Envelope *env, struct AttachCtx *actx, struct Email *parent, SendFlags flags)
Create the envelope defaults for a reply.
Definition: recvcmd.c:818
void mutt_make_post_indent(struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Add suffix to replied email text.
Definition: send.c:742
void mutt_make_attribution(struct Email *e, FILE *fp_out, struct ConfigSubset *sub)
Add "on DATE, PERSON wrote" header.
Definition: send.c:633
int mutt_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Mailbox *m, struct EmailList *el, struct ConfigSubset *sub)
Send an email.
Definition: send.c:2126
#define SEND_NEWS
Reply to a news article.
Definition: send.h:53
#define NONULL(x)
Definition: string2.h:37
FILE * fp_root
Used by recvattach for updating.
Definition: attach.h:53
An email to which things will be attached.
Definition: attach.h:35
The envelope/body of an email.
Definition: email.h:37
struct Body * body
List of MIME parts.
Definition: email.h:67
Keep track when processing files.
Definition: state.h:46
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
Definition: state.h:50
char * prefix
String to add to the beginning of each output line.
Definition: state.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_attach_mail_sender()

void mutt_attach_mail_sender ( struct AttachCtx actx,
struct Body cur 
)

Compose an email to the sender in the email attachment.

Parameters
actxAttachment Context
curCurrent attachment

Definition at line 1115 of file recvcmd.c.

1116{
1117 if (!check_all_msg(actx, cur, 0))
1118 {
1119 /* L10N: You will see this error message if you invoke <compose-to-sender>
1120 when you are on a normal attachment. */
1121 mutt_error(_("You may only compose to sender with message/rfc822 parts"));
1122 return;
1123 }
1124
1125 struct Email *e_tmp = email_new();
1126 e_tmp->env = mutt_env_new();
1127
1128 if (cur)
1129 {
1130 if (mutt_fetch_recips(e_tmp->env, cur->email->env, SEND_TO_SENDER, NeoMutt->sub) == -1)
1131 {
1132 email_free(&e_tmp);
1133 return;
1134 }
1135 }
1136 else
1137 {
1138 for (int i = 0; i < actx->idxlen; i++)
1139 {
1140 if (actx->idx[i]->body->tagged &&
1141 (mutt_fetch_recips(e_tmp->env, actx->idx[i]->body->email->env,
1142 SEND_TO_SENDER, NeoMutt->sub) == -1))
1143 {
1144 email_free(&e_tmp);
1145 return;
1146 }
1147 }
1148 }
1149
1150 // This call will free e_tmp for us
1151 mutt_send_message(SEND_NO_FLAGS, e_tmp, NULL, NULL, NULL, NeoMutt->sub);
1152}
int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, SendFlags flags, struct ConfigSubset *sub)
Generate recpients for a reply email.
Definition: send.c:925
#define SEND_TO_SENDER
Compose new email to sender.
Definition: send.h:51
#define SEND_NO_FLAGS
No flags are set.
Definition: send.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function: