NeoMutt  2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Envelope Function API

Prototype for a Envelope Function. More...

Collaboration diagram for Envelope Function API:

Functions

static int op_envelope_edit_bcc (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the BCC list - Implements envelope_function_t -.
static int op_envelope_edit_cc (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the CC list - Implements envelope_function_t -.
static int op_envelope_edit_fcc (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Enter a file to save a copy of this message in - Implements envelope_function_t -.
static int op_envelope_edit_from (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the from field - Implements envelope_function_t -.
static int op_envelope_edit_reply_to (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the Reply-To field - Implements envelope_function_t -.
static int op_envelope_edit_subject (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the subject of this message - Implements envelope_function_t -.
static int op_envelope_edit_to (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the TO list - Implements envelope_function_t -.
static int op_compose_pgp_menu (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Show PGP options - Implements envelope_function_t -.
static int op_compose_smime_menu (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Show S/MIME options - Implements envelope_function_t -.
static int op_compose_autocrypt_menu (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Show autocrypt compose menu options - Implements envelope_function_t -.
static int op_envelope_edit_followup_to (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the Followup-To field - Implements envelope_function_t -.
static int op_envelope_edit_newsgroups (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the newsgroups list - Implements envelope_function_t -.
static int op_envelope_edit_x_comment_to (struct EnvelopeWindowData *wdata, const struct KeyEvent *event)
 Edit the X-Comment-To field - Implements envelope_function_t -.

Detailed Description

Prototype for a Envelope Function.

Parameters
wdataEnvelope Window data
eventEvent to process
Return values
enumFunctionRetval
Precondition
wdata is not NULL
event is not NULL

Function Documentation

◆ op_envelope_edit_bcc()

int op_envelope_edit_bcc ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the BCC list - Implements envelope_function_t -.

Definition at line 196 of file functions.c.

197{
198 if (wdata->is_news)
199 return FR_NO_ACTION;
200 if (!edit_address_list(HDR_BCC, &wdata->email->env->bcc))
201 return FR_NO_ACTION;
202
203 update_crypt_info(wdata);
205 return FR_SUCCESS;
206}
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
static bool edit_address_list(enum HeaderField field, struct AddressList *al)
Let the user edit the address list.
Definition functions.c:109
void update_crypt_info(struct EnvelopeWindowData *wdata)
Update the crypto info.
Definition functions.c:151
@ HDR_BCC
"Bcc:" field
Definition private.h:36
bool mutt_env_notify_send(struct Email *e, enum NotifyEnvelope type)
Send an Envelope change notification.
Definition envelope.c:178
@ NT_ENVELOPE_BCC
"Bcc:" header has changed
Definition envelope.h:137
struct Envelope * env
Envelope information.
Definition email.h:68
bool is_news
Email is a news article.
Definition wdata.h:48
struct Email * email
Email being composed.
Definition wdata.h:40
struct AddressList bcc
Email's 'Bcc' list.
Definition envelope.h:62
Here is the call graph for this function:

◆ op_envelope_edit_cc()

int op_envelope_edit_cc ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the CC list - Implements envelope_function_t -.

Definition at line 211 of file functions.c.

212{
213 if (wdata->is_news)
214 return FR_NO_ACTION;
215 if (!edit_address_list(HDR_CC, &wdata->email->env->cc))
216 return FR_NO_ACTION;
217
218 update_crypt_info(wdata);
220 return FR_SUCCESS;
221}
@ HDR_CC
"Cc:" field
Definition private.h:35
@ NT_ENVELOPE_CC
"Cc:" header has changed
Definition envelope.h:138
struct AddressList cc
Email's 'Cc' list.
Definition envelope.h:61
Here is the call graph for this function:

◆ op_envelope_edit_fcc()

int op_envelope_edit_fcc ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Enter a file to save a copy of this message in - Implements envelope_function_t -.

Definition at line 226 of file functions.c.

227{
228 int rc = FR_NO_ACTION;
229 struct Buffer *fname = buf_pool_get();
230 buf_copy(fname, wdata->fcc);
231
232 struct FileCompletionData cdata = { false, NULL, NULL, NULL, NULL };
234 &CompleteMailboxOps, &cdata) != 0)
235 {
236 goto done; // aborted
237 }
238
239 if (mutt_str_equal(wdata->fcc->data, fname->data))
240 goto done; // no change
241
242 buf_copy(wdata->fcc, fname);
243 pretty_mailbox(wdata->fcc);
245 rc = FR_SUCCESS;
246
247done:
248 buf_pool_release(&fname);
249 return rc;
250}
const struct CompleteOps CompleteMailboxOps
Auto-Completion of Files / Mailboxes.
Definition complete.c:159
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition buffer.c:607
@ MUTT_COMP_CLEAR
Clear input if printable character is pressed.
Definition wdata.h:47
const char *const Prompts[]
Names of header fields used in the envelope, e.g. From:, To:
Definition window.c:89
@ HDR_FCC
"Fcc:" (save folder) field
Definition private.h:39
@ NT_ENVELOPE_FCC
"Fcc:" header has changed
Definition envelope.h:139
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:502
@ HC_MAILBOX
Mailboxes.
Definition lib.h:62
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:666
void pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition muttlib.c:431
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
String manipulation buffer.
Definition buffer.h:36
char * data
Pointer to data.
Definition buffer.h:37
struct Buffer * fcc
Where the outgoing Email will be saved.
Definition wdata.h:41
Input for the file completion function.
Definition curs_lib.h:39
Here is the call graph for this function:

◆ op_envelope_edit_from()

int op_envelope_edit_from ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the from field - Implements envelope_function_t -.

Definition at line 255 of file functions.c.

256{
257 if (!edit_address_list(HDR_FROM, &wdata->email->env->from))
258 return FR_NO_ACTION;
259
260 update_crypt_info(wdata);
262 return FR_SUCCESS;
263}
@ HDR_FROM
"From:" field
Definition private.h:33
@ NT_ENVELOPE_FROM
"From:" header has changed
Definition envelope.h:141
struct AddressList from
Email's 'From' list.
Definition envelope.h:59
Here is the call graph for this function:

◆ op_envelope_edit_reply_to()

int op_envelope_edit_reply_to ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the Reply-To field - Implements envelope_function_t -.

Definition at line 268 of file functions.c.

270{
272 return FR_NO_ACTION;
273
275 return FR_SUCCESS;
276}
@ HDR_REPLYTO
"Reply-To:" field
Definition private.h:38
@ NT_ENVELOPE_REPLY_TO
"Reply-To:" header has changed
Definition envelope.h:143
struct AddressList reply_to
Email's 'reply-to'.
Definition envelope.h:64
Here is the call graph for this function:

◆ op_envelope_edit_subject()

int op_envelope_edit_subject ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the subject of this message - Implements envelope_function_t -.

Definition at line 281 of file functions.c.

283{
284 int rc = FR_NO_ACTION;
285 struct Buffer *buf = buf_pool_get();
286
287 buf_strcpy(buf, wdata->email->env->subject);
288 if (mw_get_field(Prompts[HDR_SUBJECT], buf, MUTT_COMP_NONE, HC_OTHER, NULL, NULL) != 0)
289 {
290 goto done; // aborted
291 }
292
293 if (mutt_str_equal(wdata->email->env->subject, buf_string(buf)))
294 goto done; // no change
295
298 rc = FR_SUCCESS;
299
300done:
301 buf_pool_release(&buf);
302 return rc;
303}
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:401
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
@ MUTT_COMP_NONE
No flags are set.
Definition wdata.h:46
@ HDR_SUBJECT
"Subject:" field
Definition private.h:37
void mutt_env_set_subject(struct Envelope *env, const char *subj)
Set both subject and real_subj to subj.
Definition envelope.c:68
@ NT_ENVELOPE_SUBJECT
"Subject:" header has changed
Definition envelope.h:144
@ HC_OTHER
Miscellaneous strings.
Definition lib.h:61
char *const subject
Email's subject.
Definition envelope.h:70
Here is the call graph for this function:

◆ op_envelope_edit_to()

int op_envelope_edit_to ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the TO list - Implements envelope_function_t -.

Definition at line 308 of file functions.c.

309{
310 if (wdata->is_news)
311 return FR_NO_ACTION;
312 if (!edit_address_list(HDR_TO, &wdata->email->env->to))
313 return FR_NO_ACTION;
314
315 update_crypt_info(wdata);
317 return FR_SUCCESS;
318}
@ HDR_TO
"To:" field
Definition private.h:34
@ NT_ENVELOPE_TO
"To:" header has changed
Definition envelope.h:145
struct AddressList to
Email's 'To' list.
Definition envelope.h:60
Here is the call graph for this function:

◆ op_compose_pgp_menu()

int op_compose_pgp_menu ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Show PGP options - Implements envelope_function_t -.

Definition at line 323 of file functions.c.

324{
325 const SecurityFlags old_flags = wdata->email->security;
327 return FR_NOT_IMPL;
329 {
330 mutt_error(_("No PGP backend configured"));
331 return FR_ERROR;
332 }
333 if (((WithCrypto & APPLICATION_SMIME) != 0) && (wdata->email->security & APPLICATION_SMIME))
334 {
335 if (wdata->email->security & (SEC_ENCRYPT | SEC_SIGN))
336 {
337 if (query_yesorno(_("S/MIME already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
338 {
340 return FR_NO_ACTION;
341 }
342 wdata->email->security &= ~(SEC_ENCRYPT | SEC_SIGN);
343 }
345 wdata->email->security |= APPLICATION_PGP;
346 update_crypt_info(wdata);
347 }
348 wdata->email->security = crypt_pgp_send_menu(wdata->email);
349 update_crypt_info(wdata);
350 if (wdata->email->security == old_flags)
351 return FR_NO_ACTION;
352
355 return FR_SUCCESS;
356}
@ CMD_SEND2_HOOK
:send2-hook
Definition command.h:109
bool crypt_has_module_backend(SecurityFlags type)
Is there a crypto backend for a given type?
Definition cryptglue.c:188
SecurityFlags crypt_pgp_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu().
Definition cryptglue.c:446
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:39
@ FR_NOT_IMPL
Invalid function - feature not enabled.
Definition dispatcher.h:37
@ NT_EMAIL_CHANGE
Email has changed.
Definition email.h:186
#define mutt_error(...)
Definition logging2.h:94
void exec_message_hook(struct Mailbox *m, struct Email *e, enum CommandId id)
Perform a message hook.
Definition exec.c:137
#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).
uint16_t SecurityFlags
Definition lib.h:104
@ SEC_SIGN
Email is signed.
Definition lib.h:93
@ SEC_ENCRYPT
Email is encrypted.
Definition lib.h:92
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition lib.h:106
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition lib.h:107
#define WithCrypto
Definition lib.h:132
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
Definition notify_type.h:44
@ 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:329
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition email.h:73
Here is the call graph for this function:

◆ op_compose_smime_menu()

int op_compose_smime_menu ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Show S/MIME options - Implements envelope_function_t -.

Definition at line 361 of file functions.c.

362{
363 const SecurityFlags old_flags = wdata->email->security;
365 return FR_NOT_IMPL;
367 {
368 mutt_error(_("No S/MIME backend configured"));
369 return FR_ERROR;
370 }
371
372 if (((WithCrypto & APPLICATION_PGP) != 0) && (wdata->email->security & APPLICATION_PGP))
373 {
374 if (wdata->email->security & (SEC_ENCRYPT | SEC_SIGN))
375 {
376 if (query_yesorno(_("PGP already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
377 {
379 return FR_NO_ACTION;
380 }
381 wdata->email->security &= ~(SEC_ENCRYPT | SEC_SIGN);
382 }
385 update_crypt_info(wdata);
386 }
387 wdata->email->security = crypt_smime_send_menu(wdata->email);
388 update_crypt_info(wdata);
389 if (wdata->email->security == old_flags)
390 return FR_NO_ACTION;
391
394 return FR_SUCCESS;
395}
SecurityFlags crypt_smime_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu().
Definition cryptglue.c:632
Here is the call graph for this function:

◆ op_compose_autocrypt_menu()

int op_compose_autocrypt_menu ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Show autocrypt compose menu options - Implements envelope_function_t -.

Definition at line 401 of file functions.c.

403{
404 const SecurityFlags old_flags = wdata->email->security;
405 const bool c_autocrypt = cs_subset_bool(wdata->sub, "autocrypt");
406 if (!c_autocrypt)
407 return FR_NO_ACTION;
408
410 {
411 if (wdata->email->security & (SEC_ENCRYPT | SEC_SIGN))
412 {
413 if (query_yesorno(_("S/MIME already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
414 {
416 return FR_NO_ACTION;
417 }
418 wdata->email->security &= ~(SEC_ENCRYPT | SEC_SIGN);
419 }
421 wdata->email->security |= APPLICATION_PGP;
422 update_crypt_info(wdata);
423 }
424 autocrypt_compose_menu(wdata->email, wdata->sub);
425 update_crypt_info(wdata);
426 if (wdata->email->security == old_flags)
427 return FR_NO_ACTION;
428
431 return FR_SUCCESS;
432}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
static void autocrypt_compose_menu(struct Email *e, const struct ConfigSubset *sub)
Autocrypt compose settings.
Definition functions.c:63
struct ConfigSubset * sub
Inherited config items.
Definition wdata.h:39
Here is the call graph for this function:

◆ op_envelope_edit_followup_to()

int op_envelope_edit_followup_to ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the Followup-To field - Implements envelope_function_t -.

Definition at line 440 of file functions.c.

442{
443 if (!wdata->is_news)
444 return FR_NO_ACTION;
445
446 int rc = FR_NO_ACTION;
447 struct Buffer *buf = buf_pool_get();
448
449 buf_strcpy(buf, wdata->email->env->followup_to);
450 if (mw_get_field(Prompts[HDR_FOLLOWUPTO], buf, MUTT_COMP_NONE, HC_OTHER, NULL, NULL) == 0)
451 {
454 rc = FR_SUCCESS;
455 }
456
457 buf_pool_release(&buf);
458 return rc;
459}
@ HDR_FOLLOWUPTO
"Followup-To:" field
Definition private.h:46
@ NT_ENVELOPE_FOLLOWUP_TO
"Followup-To:" header has changed
Definition envelope.h:140
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
char * followup_to
List of 'followup-to' fields.
Definition envelope.h:80
Here is the call graph for this function:

◆ op_envelope_edit_newsgroups()

int op_envelope_edit_newsgroups ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the newsgroups list - Implements envelope_function_t -.

Definition at line 464 of file functions.c.

466{
467 if (!wdata->is_news)
468 return FR_NO_ACTION;
469
470 int rc = FR_NO_ACTION;
471 struct Buffer *buf = buf_pool_get();
472
473 buf_strcpy(buf, wdata->email->env->newsgroups);
474 if (mw_get_field(Prompts[HDR_NEWSGROUPS], buf, MUTT_COMP_NONE, HC_OTHER, NULL, NULL) == 0)
475 {
478 rc = FR_SUCCESS;
479 }
480
481 buf_pool_release(&buf);
482 return rc;
483}
@ HDR_NEWSGROUPS
"Newsgroups:" field
Definition private.h:45
@ NT_ENVELOPE_NEWSGROUPS
"Newsgroups:" header has changed
Definition envelope.h:142
char * newsgroups
List of newsgroups.
Definition envelope.h:78
Here is the call graph for this function:

◆ op_envelope_edit_x_comment_to()

int op_envelope_edit_x_comment_to ( struct EnvelopeWindowData * wdata,
const struct KeyEvent * event )
static

Edit the X-Comment-To field - Implements envelope_function_t -.

Definition at line 488 of file functions.c.

490{
491 const bool c_x_comment_to = cs_subset_bool(wdata->sub, "x_comment_to");
492 if (!(wdata->is_news && c_x_comment_to))
493 return FR_NO_ACTION;
494
495 int rc = FR_NO_ACTION;
496 struct Buffer *buf = buf_pool_get();
497
498 buf_strcpy(buf, wdata->email->env->x_comment_to);
499 if (mw_get_field(Prompts[HDR_XCOMMENTTO], buf, MUTT_COMP_NONE, HC_OTHER, NULL, NULL) == 0)
500 {
503 rc = FR_SUCCESS;
504 }
505
506 buf_pool_release(&buf);
507 return rc;
508}
@ HDR_XCOMMENTTO
"X-Comment-To:" field
Definition private.h:47
@ NT_ENVELOPE_X_COMMENT_TO
"X-Comment-To:" header has changed
Definition envelope.h:146
char * x_comment_to
List of 'X-comment-to' fields.
Definition envelope.h:81
Here is the call graph for this function: