NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
compose.c File Reference
#include "config.h"
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "conn/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "lib.h"
#include "index/lib.h"
#include "ncrypt/lib.h"
#include "send/lib.h"
#include "browser.h"
#include "commands.h"
#include "context.h"
#include "format_flags.h"
#include "hook.h"
#include "init.h"
#include "keymap.h"
#include "mutt_attach.h"
#include "mutt_globals.h"
#include "mutt_header.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "muttlib.h"
#include "mx.h"
#include "opcodes.h"
#include "options.h"
#include "protos.h"
#include "recvattach.h"
#include "rfc3676.h"
#include "sort.h"
#include <libintl.h>
#include "remailer.h"
#include "nntp/lib.h"
#include "nntp/adata.h"
#include "pop/lib.h"
#include "imap/lib.h"
#include "autocrypt/lib.h"
+ Include dependency graph for compose.c:

Go to the source code of this file.

Data Structures

struct  ComposeRedrawData
 Keep track when the compose screen needs redrawing. More...
 

Macros

#define MAX_ADDR_ROWS   5
 Maximum number of rows to use for the To:, Cc:, Bcc: fields. More...
 
#define MAX_USER_HDR_ROWS   5
 Maximum number of rows to use for the Headers: field. More...
 
#define CHECK_COUNT
 
#define CUR_ATTACH   actx->idx[actx->v2r[menu->current]]
 
#define ALTS_TAG   "Alternatives for \"%s\""
 
#define LINGUAL_TAG   "Multilingual part for \"%s\""
 

Enumerations

enum  HeaderField {
  HDR_FROM, HDR_TO, HDR_CC, HDR_BCC,
  HDR_SUBJECT, HDR_REPLYTO, HDR_FCC, HDR_MIX,
  HDR_CRYPT, HDR_CRYPTINFO, HDR_AUTOCRYPT, HDR_NEWSGROUPS,
  HDR_FOLLOWUPTO, HDR_XCOMMENTTO, HDR_CUSTOM_HEADERS, HDR_ATTACH_TITLE
}
 Ordered list of headers for the compose screen. More...
 

Functions

static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, struct Menu *menu, const char *src)
 Compose the string for the status bar. More...
 
static void calc_header_width_padding (int idx, const char *header, bool calc_max)
 Calculate the width needed for the compose labels. More...
 
static void init_header_padding (void)
 Calculate how much padding the compose table will need. More...
 
static void snd_make_entry (struct Menu *menu, char *buf, size_t buflen, int line)
 Format a menu item for the attachment list - Implements Menu::make_entry() More...
 
static void autocrypt_compose_menu (struct Email *e, const struct ConfigSubset *sub)
 Autocrypt compose settings. More...
 
static void draw_floating (struct MuttWindow *win, int col, int row, const char *text)
 Draw a floating label. More...
 
static void draw_header (struct MuttWindow *win, int row, enum HeaderField field)
 Draw an aligned label. More...
 
static void draw_header_content (struct MuttWindow *win, int row, enum HeaderField field, const char *content)
 Draw content on a separate line aligned to header prompt. More...
 
static int calc_address (struct AddressList *al, struct ListHead *slist, short cols, short *srows)
 Calculate how many rows an AddressList will need. More...
 
static int calc_security (struct Email *e, short *rows, const struct ConfigSubset *sub)
 Calculate how many rows the security info will need. More...
 
static int calc_user_hdrs (const struct ListHead *hdrs)
 Calculate how many rows are needed for user-defined headers. More...
 
static int calc_envelope (struct ComposeRedrawData *rd)
 Calculate how many rows the envelope will need. More...
 
static int redraw_crypt_lines (struct ComposeRedrawData *rd, int row)
 Update the encryption info in the compose window. More...
 
static void update_crypt_info (struct ComposeRedrawData *rd)
 Update the crypto info. More...
 
static void redraw_mix_line (struct ListHead *chain, struct ComposeRedrawData *rd, int row)
 Redraw the Mixmaster chain. More...
 
static int check_attachments (struct AttachCtx *actx, struct ConfigSubset *sub)
 Check if any attachments have changed or been deleted. More...
 
static int draw_envelope_addr (int field, struct AddressList *al, struct MuttWindow *win, int row, size_t max_lines)
 Write addresses to the compose window. More...
 
static int draw_envelope_user_hdrs (const struct ComposeRedrawData *rd, int row)
 Write user-defined headers to the compose window. More...
 
static void draw_envelope (struct ComposeRedrawData *rd)
 Write the email headers to the compose window. More...
 
static bool edit_address_list (int field, struct AddressList *al)
 Let the user edit the address list. More...
 
static int delete_attachment (struct AttachCtx *actx, int x)
 Delete an attachment. More...
 
static void mutt_gen_compose_attach_list (struct AttachCtx *actx, struct Body *m, int parent_type, int level)
 Generate the attachment list for the compose screen. More...
 
static void mutt_update_compose_menu (struct AttachCtx *actx, struct Menu *menu, bool init)
 Redraw the compose window. More...
 
static void update_idx (struct Menu *menu, struct AttachCtx *actx, struct AttachPtr *ap)
 Add a new attchment to the message. More...
 
static void compose_custom_redraw (struct Menu *menu)
 Redraw the compose menu - Implements Menu::custom_redraw() More...
 
static void compose_attach_swap (struct Body *msg, struct AttachPtr **idx, short first)
 Swap two adjacent entries in the attachment list. More...
 
static unsigned long cum_attachs_size (struct Menu *menu)
 Cumulative Attachments Size. More...
 
static const char * compose_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
 Create the status bar string for compose mode - Implements format_t. More...
 
static int compose_config_observer (struct NotifyCallback *nc)
 Listen for config changes affecting the Compose menu - Implements observer_t. More...
 
static int compose_header_observer (struct NotifyCallback *nc)
 Listen for header changes - Implements observer_t. More...
 
int mutt_compose_menu (struct Email *e, struct Buffer *fcc, struct Email *e_cur, uint8_t flags, struct ConfigSubset *sub)
 Allow the user to edit the message envelope. More...
 

Variables

static const char * There_are_no_attachments = N_("There are no attachments")
 
static int HeaderPadding [HDR_ATTACH_TITLE] = { 0 }
 
static int MaxHeaderWidth = 0
 
static const char *const Prompts []
 
static const struct Mapping ComposeHelp []
 Help Bar for the Compose dialog. More...
 
static const struct Mapping ComposeNewsHelp []
 Help Bar for the News Compose dialog. More...
 
static const char * AutocryptRecUiFlags []
 

Detailed Description

GUI editor for an email's headers

Authors
  • Michael R. Elkins
  • g10 Code GmbH
  • Pietro Cerutti
  • Richard Russon

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 compose.c.

Macro Definition Documentation

◆ MAX_ADDR_ROWS

#define MAX_ADDR_ROWS   5

Maximum number of rows to use for the To:, Cc:, Bcc: fields.

Definition at line 94 of file compose.c.

◆ MAX_USER_HDR_ROWS

#define MAX_USER_HDR_ROWS   5

Maximum number of rows to use for the Headers: field.

Definition at line 97 of file compose.c.

◆ CHECK_COUNT

#define CHECK_COUNT
Value:
if (actx->idxlen == 0) \
{ \
mutt_error(_(There_are_no_attachments)); \
break; \
}

Definition at line 133 of file compose.c.

◆ CUR_ATTACH

#define CUR_ATTACH   actx->idx[actx->v2r[menu->current]]

Definition at line 140 of file compose.c.

◆ ALTS_TAG

#define ALTS_TAG   "Alternatives for \"%s\""

◆ LINGUAL_TAG

#define LINGUAL_TAG   "Multilingual part for \"%s\""

Enumeration Type Documentation

◆ HeaderField

Ordered list of headers for the compose screen.

The position of various fields on the compose screen.

Enumerator
HDR_FROM 

"From:" field

HDR_TO 

"To:" field

HDR_CC 

"Cc:" field

HDR_BCC 

"Bcc:" field

HDR_SUBJECT 

"Subject:" field

HDR_REPLYTO 

"Reply-To:" field

HDR_FCC 

"Fcc:" (save folder) field

HDR_MIX 

"Mix:" field (Mixmaster chain)

HDR_CRYPT 

"Security:" field (encryption/signing info)

HDR_CRYPTINFO 

"Sign as:" field (encryption/signing info)

HDR_AUTOCRYPT 

"Autocrypt:" and "Recommendation:" fields

HDR_NEWSGROUPS 

"Newsgroups:" field

HDR_FOLLOWUPTO 

"Followup-To:" field

HDR_XCOMMENTTO 

"X-Comment-To:" field

HDR_CUSTOM_HEADERS 

"Headers:" field

HDR_ATTACH_TITLE 

The "-- Attachments" line.

Definition at line 147 of file compose.c.

148 {
149  HDR_FROM,
150  HDR_TO,
151  HDR_CC,
152  HDR_BCC,
153  HDR_SUBJECT,
154  HDR_REPLYTO,
155  HDR_FCC,
156 #ifdef MIXMASTER
157  HDR_MIX,
158 #endif
159  HDR_CRYPT,
160  HDR_CRYPTINFO,
161 #ifdef USE_AUTOCRYPT
162  HDR_AUTOCRYPT,
163 #endif
164 #ifdef USE_NNTP
168 #endif
171 };

Function Documentation

◆ compose_status_line()

static void compose_status_line ( char *  buf,
size_t  buflen,
size_t  col,
int  cols,
struct Menu menu,
const char *  src 
)
static

Compose the string for the status bar.

Parameters
[out]bufBuffer in which to save string
[in]buflenBuffer length
[in]colStarting column
[in]colsNumber of screen columns
[in]menuCurrent menu
[in]srcPrintf-like format string

Definition at line 1391 of file compose.c.

1393 {
1394  mutt_expando_format(buf, buflen, col, cols, src, compose_format_str,
1395  (intptr_t) menu, MUTT_FORMAT_NO_FLAGS);
1396 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_header_width_padding()

static void calc_header_width_padding ( int  idx,
const char *  header,
bool  calc_max 
)
static

Calculate the width needed for the compose labels.

Parameters
idxStore the result at this index of HeaderPadding
headerHeader string
calc_maxIf true, calculate the maximum width

Definition at line 283 of file compose.c.

284 {
285  int width;
286 
287  HeaderPadding[idx] = mutt_str_len(header);
288  width = mutt_strwidth(header);
289  if (calc_max && (MaxHeaderWidth < width))
290  MaxHeaderWidth = width;
291  HeaderPadding[idx] -= width;
292 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_header_padding()

static void init_header_padding ( void  )
static

Calculate how much padding the compose table will need.

The padding needed for each header is strlen() + max_width - strwidth().

calc_header_width_padding sets each entry in HeaderPadding to strlen - width. Then, afterwards, we go through and add max_width to each entry.

Definition at line 302 of file compose.c.

303 {
304  static bool done = false;
305 
306  if (done)
307  return;
308  done = true;
309 
310  for (int i = 0; i < HDR_ATTACH_TITLE; i++)
311  {
312  if (i == HDR_CRYPTINFO)
313  continue;
314  calc_header_width_padding(i, _(Prompts[i]), true);
315  }
316 
317  /* Don't include "Sign as: " in the MaxHeaderWidth calculation. It
318  * doesn't show up by default, and so can make the indentation of
319  * the other fields look funny. */
321 
322  for (int i = 0; i < HDR_ATTACH_TITLE; i++)
323  {
325  if (HeaderPadding[i] < 0)
326  HeaderPadding[i] = 0;
327  }
328 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ snd_make_entry()

static void snd_make_entry ( struct Menu menu,
char *  buf,
size_t  buflen,
int  line 
)
static

Format a menu item for the attachment list - Implements Menu::make_entry()

Definition at line 333 of file compose.c.

334 {
335  struct AttachCtx *actx = menu->mdata;
336 
337  const struct ComposeRedrawData *rd = (const struct ComposeRedrawData *) menu->redraw_data;
338  const struct ConfigSubset *sub = rd->sub;
339 
340  const char *c_attach_format = cs_subset_string(sub, "attach_format");
341  mutt_expando_format(buf, buflen, 0, menu->win_index->state.cols, NONULL(c_attach_format),
342  attach_format_str, (intptr_t)(actx->idx[actx->v2r[line]]),
344 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autocrypt_compose_menu()

static void autocrypt_compose_menu ( struct Email e,
const struct ConfigSubset sub 
)
static

Autocrypt compose settings.

Parameters
eEmail
subConfigSubset

Definition at line 352 of file compose.c.

353 {
354  /* L10N: The compose menu autocrypt prompt.
355  (e)ncrypt enables encryption via autocrypt.
356  (c)lear sets cleartext.
357  (a)utomatic defers to the recommendation. */
358  const char *prompt = _("Autocrypt: (e)ncrypt, (c)lear, (a)utomatic?");
359 
361 
362  /* L10N: The letter corresponding to the compose menu autocrypt prompt
363  (e)ncrypt, (c)lear, (a)utomatic */
364  const char *letters = _("eca");
365 
366  int choice = mutt_multi_choice(prompt, letters);
367  switch (choice)
368  {
369  case 1:
372  break;
373  case 2:
374  e->security &= ~SEC_AUTOCRYPT;
376  break;
377  case 3:
378  {
380  const bool c_crypt_opportunistic_encrypt =
381  cs_subset_bool(sub, "crypt_opportunistic_encrypt");
382  if (c_crypt_opportunistic_encrypt)
383  e->security |= SEC_OPPENCRYPT;
384  break;
385  }
386  }
387 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_floating()

static void draw_floating ( struct MuttWindow win,
int  col,
int  row,
const char *  text 
)
static

Draw a floating label.

Parameters
winWindow to draw on
colColumn to draw at
rowRow to draw at
textText to display

Definition at line 397 of file compose.c.

398 {
400  mutt_window_mvprintw(win, col, row, "%s", text);
402 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_header()

static void draw_header ( struct MuttWindow win,
int  row,
enum HeaderField  field 
)
static

Draw an aligned label.

Parameters
winWindow to draw on
rowRow to draw at
fieldField to display, e.g. HDR_FROM

Definition at line 410 of file compose.c.

411 {
413  mutt_window_mvprintw(win, 0, row, "%*s", HeaderPadding[field], _(Prompts[field]));
415 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_header_content()

static void draw_header_content ( struct MuttWindow win,
int  row,
enum HeaderField  field,
const char *  content 
)
static

Draw content on a separate line aligned to header prompt.

Parameters
winWindow to draw on
rowRow to draw at
fieldField to display, e.g. HDR_FROM
contentText to display

Content will be truncated if it is wider than the window.

Definition at line 426 of file compose.c.

428 {
429  mutt_window_move(win, HeaderPadding[field], row);
430  mutt_paddstr(win->state.cols - HeaderPadding[field], content);
431 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_address()

static int calc_address ( struct AddressList *  al,
struct ListHead *  slist,
short  cols,
short *  srows 
)
static

Calculate how many rows an AddressList will need.

Parameters
[in]alAddress List
[out]slistString list
[in]colsScreen columns available
[out]srowsRows needed
Return values
numRows needed
Note
Number of rows is capped at MAX_ADDR_ROWS

Definition at line 443 of file compose.c.

445 {
446  mutt_list_free(slist);
447  mutt_addrlist_write_list(al, slist);
448 
449  int rows = 1;
450  int addr_len;
451  int width_left = cols;
452  struct ListNode *next = NULL;
453  struct ListNode *np = NULL;
454  STAILQ_FOREACH(np, slist, entries)
455  {
456  next = STAILQ_NEXT(np, entries);
457  addr_len = mutt_strwidth(np->data);
458  if (next)
459  addr_len += 2; // ", "
460 
461  try_again:
462  if (addr_len >= width_left)
463  {
464  if (width_left == cols)
465  break;
466 
467  rows++;
468  width_left = cols;
469  goto try_again;
470  }
471 
472  if (addr_len < width_left)
473  width_left -= addr_len;
474  }
475 
476  *srows = MIN(rows, MAX_ADDR_ROWS);
477  return *srows;
478 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_security()

static int calc_security ( struct Email e,
short *  rows,
const struct ConfigSubset sub 
)
static

Calculate how many rows the security info will need.

Parameters
eEmail
rowsRows needed
subConfigSubset
Return values
numRows needed

Definition at line 487 of file compose.c.

488 {
490  *rows = 0; // Neither PGP nor SMIME are built into NeoMutt
491  else if ((e->security & (SEC_ENCRYPT | SEC_SIGN)) != 0)
492  *rows = 2; // 'Security:' and 'Sign as:'
493  else
494  *rows = 1; // Just 'Security:'
495 
496 #ifdef USE_AUTOCRYPT
497  const bool c_autocrypt = cs_subset_bool(sub, "autocrypt");
498  if (c_autocrypt)
499  *rows += 1;
500 #endif
501 
502  return *rows;
503 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_user_hdrs()

static int calc_user_hdrs ( const struct ListHead *  hdrs)
static

Calculate how many rows are needed for user-defined headers.

Parameters
hdrsHeader List
Return values
numRows needed, limited to MAX_USER_HDR_ROWS

Definition at line 510 of file compose.c.

511 {
512  int rows = 0; /* Don't print at all if no custom headers*/
513  struct ListNode *np = NULL;
514  STAILQ_FOREACH(np, hdrs, entries)
515  {
516  if (rows == MAX_USER_HDR_ROWS)
517  break;
518  rows++;
519  }
520  return rows;
521 }
+ Here is the caller graph for this function:

◆ calc_envelope()

static int calc_envelope ( struct ComposeRedrawData rd)
static

Calculate how many rows the envelope will need.

Parameters
rdEmail and other compose data
Return values
numRows needed

Definition at line 528 of file compose.c.

529 {
530  int rows = 4; // 'From:', 'Subject:', 'Reply-To:', 'Fcc:'
531 #ifdef MIXMASTER
532  rows++;
533 #endif
534 
535  struct Email *e = rd->email;
536  struct Envelope *env = e->env;
537  const int cols = rd->win_envelope->state.cols - MaxHeaderWidth;
538 
539 #ifdef USE_NNTP
540  if (OptNewsSend)
541  {
542  rows += 2; // 'Newsgroups:' and 'Followup-To:'
543  const bool c_x_comment_to = cs_subset_bool(rd->sub, "x_comment_to");
544  if (c_x_comment_to)
545  rows++;
546  }
547  else
548 #endif
549  {
550  rows += calc_address(&env->to, &rd->to_list, cols, &rd->to_rows);
551  rows += calc_address(&env->cc, &rd->cc_list, cols, &rd->cc_rows);
552  rows += calc_address(&env->bcc, &rd->bcc_list, cols, &rd->bcc_rows);
553  }
554  rows += calc_security(e, &rd->sec_rows, rd->sub);
555  const bool c_compose_show_user_headers =
556  cs_subset_bool(rd->sub, "compose_show_user_headers");
557  if (c_compose_show_user_headers)
558  rows += calc_user_hdrs(&env->userhdrs);
559 
560  return rows;
561 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redraw_crypt_lines()

static int redraw_crypt_lines ( struct ComposeRedrawData rd,
int  row 
)
static

Update the encryption info in the compose window.

Parameters
rdEmail and other compose data
rowWindow row to start drawing

Definition at line 568 of file compose.c.

569 {
570  struct Email *e = rd->email;
571 
572  draw_header(rd->win_envelope, row++, HDR_CRYPT);
573 
575  return 0;
576 
577  // We'll probably need two lines for 'Security:' and 'Sign as:'
578  int used = 2;
579  if ((e->security & (SEC_ENCRYPT | SEC_SIGN)) == (SEC_ENCRYPT | SEC_SIGN))
580  {
582  mutt_window_addstr(_("Sign, Encrypt"));
583  }
584  else if (e->security & SEC_ENCRYPT)
585  {
587  mutt_window_addstr(_("Encrypt"));
588  }
589  else if (e->security & SEC_SIGN)
590  {
592  mutt_window_addstr(_("Sign"));
593  }
594  else
595  {
596  /* L10N: This refers to the encryption of the email, e.g. "Security: None" */
598  mutt_window_addstr(_("None"));
599  used = 1; // 'Sign as:' won't be needed
600  }
602 
603  if ((e->security & (SEC_ENCRYPT | SEC_SIGN)))
604  {
605  if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & APPLICATION_PGP))
606  {
607  if ((e->security & SEC_INLINE))
608  mutt_window_addstr(_(" (inline PGP)"));
609  else
610  mutt_window_addstr(_(" (PGP/MIME)"));
611  }
612  else if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME))
613  mutt_window_addstr(_(" (S/MIME)"));
614  }
615 
616  const bool c_crypt_opportunistic_encrypt =
617  cs_subset_bool(rd->sub, "crypt_opportunistic_encrypt");
618  if (c_crypt_opportunistic_encrypt && (e->security & SEC_OPPENCRYPT))
619  mutt_window_addstr(_(" (OppEnc mode)"));
620 
622 
623  if (((WithCrypto & APPLICATION_PGP) != 0) &&
624  (e->security & APPLICATION_PGP) && (e->security & SEC_SIGN))
625  {
627  const char *c_pgp_sign_as = cs_subset_string(rd->sub, "pgp_sign_as");
628  mutt_window_printf("%s", c_pgp_sign_as ? c_pgp_sign_as : _("<default>"));
629  }
630 
631  if (((WithCrypto & APPLICATION_SMIME) != 0) &&
632  (e->security & APPLICATION_SMIME) && (e->security & SEC_SIGN))
633  {
635  const char *c_smime_sign_as = cs_subset_string(rd->sub, "pgp_sign_as");
636  mutt_window_printf("%s", c_smime_sign_as ? c_smime_sign_as : _("<default>"));
637  }
638 
639  const char *c_smime_encrypt_with =
640  cs_subset_string(rd->sub, "smime_encrypt_with");
641  if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME) &&
642  (e->security & SEC_ENCRYPT) && c_smime_encrypt_with)
643  {
644  draw_floating(rd->win_envelope, 40, row - 1, _("Encrypt with: "));
645  mutt_window_printf("%s", NONULL(c_smime_encrypt_with));
646  }
647 
648 #ifdef USE_AUTOCRYPT
649  const bool c_autocrypt = cs_subset_bool(rd->sub, "autocrypt");
650  if (c_autocrypt)
651  {
653  if (e->security & SEC_AUTOCRYPT)
654  {
656  mutt_window_addstr(_("Encrypt"));
657  }
658  else
659  {
661  mutt_window_addstr(_("Off"));
662  }
663 
664  /* L10N: The autocrypt compose menu Recommendation field.
665  Displays the output of the recommendation engine
666  (Off, No, Discouraged, Available, Yes) */
667  draw_floating(rd->win_envelope, 40, row, _("Recommendation: "));
669 
670  used++;
671  }
672 #endif
673  return used;
674 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_crypt_info()

static void update_crypt_info ( struct ComposeRedrawData rd)
static

Update the crypto info.

Parameters
rdEmail and other compose data

Definition at line 680 of file compose.c.

681 {
682  struct Email *e = rd->email;
683 
684  const bool c_crypt_opportunistic_encrypt =
685  cs_subset_bool(rd->sub, "crypt_opportunistic_encrypt");
686  if (c_crypt_opportunistic_encrypt)
688 
689 #ifdef USE_AUTOCRYPT
690  const bool c_autocrypt = cs_subset_bool(rd->sub, "autocrypt");
691  if (c_autocrypt)
692  {
693  struct Mailbox *m = ctx_mailbox(Context);
695 
696  /* Anything that enables SEC_ENCRYPT or SEC_SIGN, or turns on SMIME
697  * overrides autocrypt, be it oppenc or the user having turned on
698  * those flags manually. */
701  else
702  {
703  if (!(e->security & SEC_AUTOCRYPT_OVERRIDE))
704  {
705  if (rd->autocrypt_rec == AUTOCRYPT_REC_YES)
706  {
709  }
710  else
711  e->security &= ~SEC_AUTOCRYPT;
712  }
713  }
714  }
715 #endif
716 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redraw_mix_line()

static void redraw_mix_line ( struct ListHead *  chain,
struct ComposeRedrawData rd,
int  row 
)
static

Redraw the Mixmaster chain.

Parameters
chainList of chain links
rdEmail and other compose data
rowWindow row to start drawing

Definition at line 725 of file compose.c.

726 {
727  char *t = NULL;
728 
729  draw_header(rd->win_envelope, row, HDR_MIX);
730 
731  if (STAILQ_EMPTY(chain))
732  {
733  mutt_window_addstr(_("<no chain defined>"));
735  return;
736  }
737 
738  int c = 12;
739  struct ListNode *np = NULL;
740  STAILQ_FOREACH(np, chain, entries)
741  {
742  t = np->data;
743  if (t && (t[0] == '0') && (t[1] == '\0'))
744  t = "<random>";
745 
746  if (c + mutt_str_len(t) + 2 >= rd->win_envelope->state.cols)
747  break;
748 
750  if (STAILQ_NEXT(np, entries))
751  mutt_window_addstr(", ");
752 
753  c += mutt_str_len(t) + 2;
754  }
755 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_attachments()

static int check_attachments ( struct AttachCtx actx,
struct ConfigSubset sub 
)
static

Check if any attachments have changed or been deleted.

Parameters
actxAttachment context
subConfigSubset
Return values
0Success
-1Error

Definition at line 765 of file compose.c.

766 {
767  int rc = -1;
768  struct stat st;
769  struct Buffer *pretty = NULL, *msg = NULL;
770 
771  for (int i = 0; i < actx->idxlen; i++)
772  {
773  if (actx->idx[i]->body->type == TYPE_MULTIPART)
774  continue;
775  if (stat(actx->idx[i]->body->filename, &st) != 0)
776  {
777  if (!pretty)
778  pretty = mutt_buffer_pool_get();
779  mutt_buffer_strcpy(pretty, actx->idx[i]->body->filename);
781  /* L10N: This message is displayed in the compose menu when an attachment
782  doesn't stat. %d is the attachment number and %s is the attachment
783  filename. The filename is located last to avoid a long path hiding
784  the error message. */
785  mutt_error(_("Attachment #%d no longer exists: %s"), i + 1,
786  mutt_buffer_string(pretty));
787  goto cleanup;
788  }
789 
790  if (actx->idx[i]->body->stamp < st.st_mtime)
791  {
792  if (!pretty)
793  pretty = mutt_buffer_pool_get();
794  mutt_buffer_strcpy(pretty, actx->idx[i]->body->filename);
796 
797  if (!msg)
798  msg = mutt_buffer_pool_get();
799  /* L10N: This message is displayed in the compose menu when an attachment
800  is modified behind the scenes. %d is the attachment number and %s is
801  the attachment filename. The filename is located last to avoid a long
802  path hiding the prompt question. */
803  mutt_buffer_printf(msg, _("Attachment #%d modified. Update encoding for %s?"),
804  i + 1, mutt_buffer_string(pretty));
805 
807  if (ans == MUTT_YES)
808  mutt_update_encoding(actx->idx[i]->body, sub);
809  else if (ans == MUTT_ABORT)
810  goto cleanup;
811  }
812  }
813 
814  rc = 0;
815 
816 cleanup:
817  mutt_buffer_pool_release(&pretty);
819  return rc;
820 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_envelope_addr()

static int draw_envelope_addr ( int  field,
struct AddressList *  al,
struct MuttWindow win,
int  row,
size_t  max_lines 
)
static

Write addresses to the compose window.

Parameters
fieldField to display, e.g. HDR_FROM
alAddress list to write
winWindow
rowWindow row to start drawing
max_linesHow many lines may be used

Definition at line 830 of file compose.c.

832 {
833  draw_header(win, row, field);
834 
835  struct ListHead list = STAILQ_HEAD_INITIALIZER(list);
836  int count = mutt_addrlist_write_list(al, &list);
837 
838  int lines_used = 1;
839  int width_left = win->state.cols - MaxHeaderWidth;
840  char more[32];
841  int more_len = 0;
842 
843  char *sep = NULL;
844  struct ListNode *next = NULL;
845  struct ListNode *np = NULL;
846  STAILQ_FOREACH(np, &list, entries)
847  {
848  next = STAILQ_NEXT(np, entries);
849  int addr_len = mutt_strwidth(np->data);
850  if (next)
851  {
852  sep = ", ";
853  addr_len += 2;
854  }
855  else
856  {
857  sep = "";
858  }
859 
860  count--;
861  try_again:
862  more_len = snprintf(more, sizeof(more),
863  ngettext("(+%d more)", "(+%d more)", count), count);
864  mutt_debug(LL_DEBUG3, "text: '%s' len: %d\n", more, more_len);
865 
866  int reserve = ((count > 0) && (lines_used == max_lines)) ? more_len : 0;
867  mutt_debug(LL_DEBUG3, "processing: %s (al:%ld, wl:%d, r:%d, lu:%ld)\n",
868  np->data, addr_len, width_left, reserve, lines_used);
869  if (addr_len >= (width_left - reserve))
870  {
871  mutt_debug(LL_DEBUG3, "not enough space\n");
872  if (lines_used == max_lines)
873  {
874  mutt_debug(LL_DEBUG3, "no more lines\n");
875  mutt_debug(LL_DEBUG3, "truncating: %s\n", np->data);
876  mutt_paddstr(width_left, np->data);
877  break;
878  }
879 
880  if (width_left == (win->state.cols - MaxHeaderWidth))
881  {
882  mutt_debug(LL_DEBUG3, "couldn't print: %s\n", np->data);
883  mutt_paddstr(width_left, np->data);
884  break;
885  }
886 
887  mutt_debug(LL_DEBUG3, "start a new line\n");
889  row++;
890  lines_used++;
891  width_left = win->state.cols - MaxHeaderWidth;
892  mutt_window_move(win, MaxHeaderWidth, row);
893  goto try_again;
894  }
895 
896  if (addr_len < width_left)
897  {
898  mutt_debug(LL_DEBUG3, "space for: %s\n", np->data);
900  mutt_window_addstr(sep);
901  width_left -= addr_len;
902  }
903  mutt_debug(LL_DEBUG3, "%ld addresses remaining\n", count);
904  mutt_debug(LL_DEBUG3, "%ld lines remaining\n", max_lines - lines_used);
905  }
906  mutt_list_free(&list);
907 
908  if (count > 0)
909  {
910  mutt_window_move(win, win->state.cols - more_len, row);
912  mutt_window_addstr(more);
914  mutt_debug(LL_DEBUG3, "%ld more (len %d)\n", count, more_len);
915  }
916  else
917  {
919  }
920 
921  for (int i = lines_used; i < max_lines; i++)
922  {
923  mutt_window_move(win, 0, row + i);
925  }
926 
927  mutt_debug(LL_DEBUG3, "used %d lines\n", lines_used);
928  return lines_used;
929 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_envelope_user_hdrs()

static int draw_envelope_user_hdrs ( const struct ComposeRedrawData rd,
int  row 
)
static

Write user-defined headers to the compose window.

Parameters
rdEmail and other compose data
rowWindow row to start drawing from

Definition at line 936 of file compose.c.

937 {
938  const char *overflow_text = "...";
939  int rows_used = 0;
940 
941  struct ListNode *first = STAILQ_FIRST(&rd->email->env->userhdrs);
942  if (!first)
943  return rows_used;
944 
945  /* Draw first entry on same line as prompt */
950  first->data);
951  rows_used++;
952 
953  /* Draw any following entries on their own line */
954  struct ListNode *np = STAILQ_NEXT(first, entries);
955  if (!np)
956  return rows_used;
957 
958  STAILQ_FOREACH_FROM(np, &rd->email->env->userhdrs, entries)
959  {
960  if ((rows_used == (MAX_USER_HDR_ROWS - 1)) && STAILQ_NEXT(np, entries))
961  {
962  draw_header_content(rd->win_envelope, row + rows_used, HDR_CUSTOM_HEADERS, overflow_text);
963  rows_used++;
964  break;
965  }
966  draw_header_content(rd->win_envelope, row + rows_used, HDR_CUSTOM_HEADERS, np->data);
967  rows_used++;
968  }
969  return rows_used;
970 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_envelope()

static void draw_envelope ( struct ComposeRedrawData rd)
static

Write the email headers to the compose window.

Parameters
rdEmail and other compose data

Definition at line 976 of file compose.c.

977 {
978  struct Email *e = rd->email;
979  const char *fcc = mutt_buffer_string(rd->fcc);
980  const int cols = rd->win_envelope->state.cols - MaxHeaderWidth;
981 
983  int row = draw_envelope_addr(HDR_FROM, &e->env->from, rd->win_envelope, 0, 1);
984 
985 #ifdef USE_NNTP
986  if (OptNewsSend)
987  {
989  mutt_paddstr(cols, NONULL(e->env->newsgroups));
990 
992  mutt_paddstr(cols, NONULL(e->env->followup_to));
993 
994  const bool c_x_comment_to = cs_subset_bool(rd->sub, "x_comment_to");
995  if (c_x_comment_to)
996  {
998  mutt_paddstr(cols, NONULL(e->env->x_comment_to));
999  }
1000  }
1001  else
1002 #endif
1003  {
1004  row += draw_envelope_addr(HDR_TO, &e->env->to, rd->win_envelope, row, rd->to_rows);
1005  row += draw_envelope_addr(HDR_CC, &e->env->cc, rd->win_envelope, row, rd->cc_rows);
1006  row += draw_envelope_addr(HDR_BCC, &e->env->bcc, rd->win_envelope, row, rd->bcc_rows);
1007  }
1008 
1009  draw_header(rd->win_envelope, row++, HDR_SUBJECT);
1010  mutt_paddstr(cols, NONULL(e->env->subject));
1011 
1012  row += draw_envelope_addr(HDR_REPLYTO, &e->env->reply_to, rd->win_envelope, row, 1);
1013 
1014  draw_header(rd->win_envelope, row++, HDR_FCC);
1015  mutt_paddstr(cols, fcc);
1016 
1017  if (WithCrypto)
1018  row += redraw_crypt_lines(rd, row);
1019 
1020 #ifdef MIXMASTER
1021  redraw_mix_line(&e->chain, rd, row++);
1022 #endif
1023  const bool c_compose_show_user_headers =
1024  cs_subset_bool(rd->sub, "compose_show_user_headers");
1025  if (c_compose_show_user_headers)
1026  row += draw_envelope_user_hdrs(rd, row);
1027 
1029  mutt_window_mvaddstr(rd->win_abar, 0, 0, _("-- Attachments"));
1032 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_address_list()

static bool edit_address_list ( int  field,
struct AddressList *  al 
)
static

Let the user edit the address list.

Parameters
[in]fieldField to edit, e.g. HDR_FROM
[in,out]alAddressList to edit
Return values
booltrue if the address list was changed

Definition at line 1040 of file compose.c.

1041 {
1042  char buf[8192] = { 0 }; /* needs to be large for alias expansion */
1043  char old_list[8192] = { 0 };
1044 
1046  mutt_addrlist_write(al, buf, sizeof(buf), false);
1047  mutt_str_copy(old_list, buf, sizeof(buf));
1048  if (mutt_get_field(_(Prompts[field]), buf, sizeof(buf), MUTT_ALIAS, false, NULL, NULL) == 0)
1049  {
1050  mutt_addrlist_clear(al);
1051  mutt_addrlist_parse2(al, buf);
1052  mutt_expand_aliases(al);
1053  }
1054 
1055  char *err = NULL;
1056  if (mutt_addrlist_to_intl(al, &err) != 0)
1057  {
1058  mutt_error(_("Bad IDN: '%s'"), err);
1059  mutt_refresh();
1060  FREE(&err);
1061  }
1062 
1063  return !mutt_str_equal(buf, old_list);
1064 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete_attachment()

static int delete_attachment ( struct AttachCtx actx,
int  x 
)
static

Delete an attachment.

Parameters
actxAttachment context
xIndex number of attachment
Return values
0Success
-1Error

Definition at line 1073 of file compose.c.

1074 {
1075  struct AttachPtr **idx = actx->idx;
1076  int rindex = actx->v2r[x];
1077 
1078  if ((rindex == 0) && (actx->idxlen == 1))
1079  {
1080  mutt_error(_("You may not delete the only attachment"));
1081  idx[rindex]->body->tagged = false;
1082  return -1;
1083  }
1084 
1085  for (int y = 0; y < actx->idxlen; y++)
1086  {
1087  if (idx[y]->body->next == idx[rindex]->body)
1088  {
1089  idx[y]->body->next = idx[rindex]->body->next;
1090  break;
1091  }
1092  }
1093 
1094  idx[rindex]->body->next = NULL;
1095  /* mutt_make_message_attach() creates body->parts, shared by
1096  * body->email->body. If we NULL out that, it creates a memory
1097  * leak because mutt_free_body() frees body->parts, not
1098  * body->email->body.
1099  *
1100  * Other mutt_send_message() message constructors are careful to free
1101  * any body->parts, removing depth:
1102  * - mutt_prepare_template() used by postponed, resent, and draft files
1103  * - mutt_copy_body() used by the recvattach menu and $forward_attachments.
1104  *
1105  * I believe it is safe to completely remove the "body->parts =
1106  * NULL" statement. But for safety, am doing so only for the case
1107  * it must be avoided: message attachments.
1108  */
1109  if (!idx[rindex]->body->email)
1110  idx[rindex]->body->parts = NULL;
1111  mutt_body_free(&(idx[rindex]->body));
1112  FREE(&idx[rindex]->tree);
1113  FREE(&idx[rindex]);
1114  for (; rindex < actx->idxlen - 1; rindex++)
1115  idx[rindex] = idx[rindex + 1];
1116  idx[actx->idxlen - 1] = NULL;
1117  actx->idxlen--;
1118 
1119  return 0;
1120 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_gen_compose_attach_list()

static void mutt_gen_compose_attach_list ( struct AttachCtx actx,
struct Body m,
int  parent_type,
int  level 
)
static

Generate the attachment list for the compose screen.

Parameters
actxAttachment context
mAttachment
parent_typeAttachment type, e.g TYPE_MULTIPART
levelNesting depth of attachment

Definition at line 1129 of file compose.c.

1131 {
1132  for (; m; m = m->next)
1133  {
1134  if ((m->type == TYPE_MULTIPART) && m->parts &&
1136  {
1138  }
1139  else
1140  {
1141  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1142  mutt_actx_add_attach(actx, ap);
1143  ap->body = m;
1144  m->aptr = ap;
1145  ap->parent_type = parent_type;
1146  ap->level = level;
1147 
1148  /* We don't support multipart messages in the compose menu yet */
1149  }
1150  }
1151 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_update_compose_menu()

static void mutt_update_compose_menu ( struct AttachCtx actx,
struct Menu menu,
bool  init 
)
static

Redraw the compose window.

Parameters
actxAttachment context
menuCurrent menu
initIf true, initialise the attachment list

Definition at line 1159 of file compose.c.

1160 {
1161  if (init)
1162  {
1163  mutt_gen_compose_attach_list(actx, actx->email->body, -1, 0);
1164  mutt_attach_init(actx);
1165  menu->mdata = actx;
1166  }
1167 
1168  mutt_update_tree(actx);
1169 
1170  menu->max = actx->vcount;
1171  if (menu->max)
1172  {
1173  if (menu->current >= menu->max)
1174  menu->current = menu->max - 1;
1175  }
1176  else
1177  menu->current = 0;
1178 
1179  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
1180 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_idx()

static void update_idx ( struct Menu menu,
struct AttachCtx actx,
struct AttachPtr ap 
)
static

Add a new attchment to the message.

Parameters
menuCurrent menu
actxAttachment context
apAttachment to add

Definition at line 1188 of file compose.c.

1189 {
1190  ap->level = (actx->idxlen > 0) ? actx->idx[actx->idxlen - 1]->level : 0;
1191  if (actx->idxlen)
1192  actx->idx[actx->idxlen - 1]->body->next = ap->body;
1193  ap->body->aptr = ap;
1194  mutt_actx_add_attach(actx, ap);
1195  mutt_update_compose_menu(actx, menu, false);
1196  menu->current = actx->vcount - 1;
1197 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_custom_redraw()

static void compose_custom_redraw ( struct Menu menu)
static

Redraw the compose menu - Implements Menu::custom_redraw()

Definition at line 1202 of file compose.c.

1203 {
1204  struct ComposeRedrawData *rd = menu->redraw_data;
1205  if (!rd)
1206  return;
1207 
1208  if (menu->redraw & REDRAW_FLOW)
1209  {
1210  rd->win_envelope->req_rows = calc_envelope(rd);
1212  }
1213 
1214  if (menu->redraw & REDRAW_FULL)
1215  {
1216  menu_redraw_full(menu);
1217  draw_envelope(rd);
1218  menu->pagelen = menu->win_index->state.rows;
1219  }
1220 
1221  menu_check_recenter(menu);
1222 
1223  if (menu->redraw & REDRAW_STATUS)
1224  {
1225  char buf[1024];
1226  const char *c_compose_format = cs_subset_string(rd->sub, "compose_format");
1227  compose_status_line(buf, sizeof(buf), 0, menu->win_ibar->state.cols, menu,
1228  NONULL(c_compose_format));
1229  mutt_window_move(menu->win_ibar, 0, 0);
1231  mutt_draw_statusline(menu->win_ibar->state.cols, buf, sizeof(buf));
1233  menu->redraw &= ~REDRAW_STATUS;
1234  }
1235 
1236  if (menu->redraw & REDRAW_INDEX)
1237  menu_redraw_index(menu);
1238  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNC))
1239  menu_redraw_motion(menu);
1240  else if (menu->redraw == REDRAW_CURRENT)
1241  menu_redraw_current(menu);
1242  menu->redraw = REDRAW_NO_FLAGS;
1243 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_attach_swap()

static void compose_attach_swap ( struct Body msg,
struct AttachPtr **  idx,
short  first 
)
static

Swap two adjacent entries in the attachment list.

Parameters
[in]msgBody of email
[out]idxArray of Attachments
[in]firstIndex of first attachment to swap

Definition at line 1251 of file compose.c.

1252 {
1253  /* Reorder Body pointers.
1254  * Must traverse msg from top since Body has no previous ptr. */
1255  for (struct Body *part = msg; part; part = part->next)
1256  {
1257  if (part->next == idx[first]->body)
1258  {
1259  idx[first]->body->next = idx[first + 1]->body->next;
1260  idx[first + 1]->body->next = idx[first]->body;
1261  part->next = idx[first + 1]->body;
1262  break;
1263  }
1264  }
1265 
1266  /* Reorder index */
1267  struct AttachPtr *saved = idx[first];
1268  idx[first] = idx[first + 1];
1269  idx[first + 1] = saved;
1270 
1271  /* Swap ptr->num */
1272  int i = idx[first]->num;
1273  idx[first]->num = idx[first + 1]->num;
1274  idx[first + 1]->num = i;
1275 }
+ Here is the caller graph for this function:

◆ cum_attachs_size()

static unsigned long cum_attachs_size ( struct Menu menu)
static

Cumulative Attachments Size.

Parameters
menuMenu listing attachments
Return values
numBytes in attachments

Returns the total number of bytes used by the attachments in the attachment list after content-transfer-encodings have been applied.

Definition at line 1285 of file compose.c.

1286 {
1287  size_t s = 0;
1288  struct AttachCtx *actx = menu->mdata;
1289  struct AttachPtr **idx = actx->idx;
1290  struct Content *info = NULL;
1291  struct Body *b = NULL;
1292  struct ComposeRedrawData *rd = (struct ComposeRedrawData *) menu->redraw_data;
1293  struct ConfigSubset *sub = rd->sub;
1294 
1295  for (unsigned short i = 0; i < actx->idxlen; i++)
1296  {
1297  b = idx[i]->body;
1298 
1299  if (!b->content)
1301 
1302  info = b->content;
1303  if (info)
1304  {
1305  switch (b->encoding)
1306  {
1307  case ENC_QUOTED_PRINTABLE:
1308  s += 3 * (info->lobin + info->hibin) + info->ascii + info->crlf;
1309  break;
1310  case ENC_BASE64:
1311  s += (4 * (info->lobin + info->hibin + info->ascii + info->crlf)) / 3;
1312  break;
1313  default:
1314  s += info->lobin + info->hibin + info->ascii + info->crlf;
1315  break;
1316  }
1317  }
1318  }
1319 
1320  return s;
1321 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_format_str()

static const char* compose_format_str ( char *  buf,
size_t  buflen,
size_t  col,
int  cols,
char  op,
const char *  src,
const char *  prec,
const char *  if_str,
const char *  else_str,
intptr_t  data,
MuttFormatFlags  flags 
)
static

Create the status bar string for compose mode - Implements format_t.

Expando Description
%a Total number of attachments
%h Local hostname
%l Approximate size (in bytes) of the current message
%v NeoMutt version string

Definition at line 1333 of file compose.c.

1337 {
1338  char fmt[128], tmp[128];
1339  bool optional = (flags & MUTT_FORMAT_OPTIONAL);
1340  struct Menu *menu = (struct Menu *) data;
1341 
1342  *buf = '\0';
1343  switch (op)
1344  {
1345  case 'a': /* total number of attachments */
1346  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
1347  snprintf(buf, buflen, fmt, menu->max);
1348  break;
1349 
1350  case 'h': /* hostname */
1351  snprintf(fmt, sizeof(fmt), "%%%ss", prec);
1352  snprintf(buf, buflen, fmt, NONULL(ShortHostname));
1353  break;
1354 
1355  case 'l': /* approx length of current message in bytes */
1356  snprintf(fmt, sizeof(fmt), "%%%ss", prec);
1357  mutt_str_pretty_size(tmp, sizeof(tmp), menu ? cum_attachs_size(menu) : 0);
1358  snprintf(buf, buflen, fmt, tmp);
1359  break;
1360 
1361  case 'v':
1362  snprintf(buf, buflen, "%s", mutt_make_version());
1363  break;
1364 
1365  case 0:
1366  *buf = '\0';
1367  return src;
1368 
1369  default:
1370  snprintf(buf, buflen, "%%%s%c", prec, op);
1371  break;
1372  }
1373 
1374  if (optional)
1375  compose_status_line(buf, buflen, col, cols, menu, if_str);
1376  else if (flags & MUTT_FORMAT_OPTIONAL)
1377  compose_status_line(buf, buflen, col, cols, menu, else_str);
1378 
1379  return src;
1380 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_config_observer()

static int compose_config_observer ( struct NotifyCallback nc)
static

Listen for config changes affecting the Compose menu - Implements observer_t.

Definition at line 1401 of file compose.c.

1402 {
1403  if (!nc->event_data || !nc->global_data)
1404  return -1;
1405  if (nc->event_type != NT_CONFIG)
1406  return 0;
1407 
1408  struct EventConfig *ec = nc->event_data;
1409  struct MuttWindow *dlg = nc->global_data;
1410 
1411  if (!mutt_str_equal(ec->name, "status_on_top"))
1412  return 0;
1413 
1414  struct MuttWindow *win_ebar = mutt_window_find(dlg, WT_INDEX_BAR);
1415  if (!win_ebar)
1416  return 0;
1417 
1418  TAILQ_REMOVE(&dlg->children, win_ebar, entries);
1419 
1420  const bool c_status_on_top = cs_subset_bool(ec->sub, "status_on_top");
1421  if (c_status_on_top)
1422  TAILQ_INSERT_HEAD(&dlg->children, win_ebar, entries);
1423  else
1424  TAILQ_INSERT_TAIL(&dlg->children, win_ebar, entries);
1425 
1426  mutt_window_reflow(dlg);
1427  return 0;
1428 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_header_observer()

static int compose_header_observer ( struct NotifyCallback nc)
static

Listen for header changes - Implements observer_t.

Definition at line 1433 of file compose.c.

1434 {
1435  if ((nc->event_type != NT_HEADER) || !nc->event_data || !nc->global_data)
1436  return -1;
1437 
1438  const struct EventHeader *event = nc->event_data;
1439  struct ComposeRedrawData *rd = nc->global_data;
1440  struct Envelope *env = rd->email->env;
1441  struct MuttWindow *dlg = rd->win_envelope->parent;
1442 
1443  if ((nc->event_subtype == NT_HEADER_ADD) || (nc->event_subtype == NT_HEADER_CHANGE))
1444  {
1445  header_set(&env->userhdrs, event->header);
1446  mutt_window_reflow(dlg);
1447  return 0;
1448  }
1449  if (nc->event_subtype == NT_HEADER_REMOVE)
1450  {
1451  struct ListNode *removed = header_find(&env->userhdrs, event->header);
1452  if (removed)
1453  {
1454  header_free(&env->userhdrs, removed);
1455  mutt_window_reflow(dlg);
1456  }
1457  return 0;
1458  }
1459 
1460  return -1;
1461 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_compose_menu()

int mutt_compose_menu ( struct Email e,
struct Buffer fcc,
struct Email e_cur,
uint8_t  flags,
struct ConfigSubset sub 
)

Allow the user to edit the message envelope.

Parameters
eEmail to fill
fccBuffer to save FCC
e_curCurrent message
flagsFlags, e.g. MUTT_COMPOSE_NOFREEHEADER
subConfigSubset
Return values
1Message should be postponed
0Normal exit
-1Abort message

Definition at line 1474 of file compose.c.

1476 {
1477  char buf[PATH_MAX];
1478  int rc = -1;
1479  bool loop = true;
1480  bool fcc_set = false; /* has the user edited the Fcc: field ? */
1481  struct ComposeRedrawData redraw = { 0 };
1482 
1483  STAILQ_INIT(&redraw.to_list);
1484  STAILQ_INIT(&redraw.cc_list);
1485  STAILQ_INIT(&redraw.bcc_list);
1486 
1487  struct ComposeRedrawData *rd = &redraw;
1488 #ifdef USE_NNTP
1489  bool news = OptNewsSend; /* is it a news article ? */
1490 #endif
1491 
1493 
1494  struct MuttWindow *dlg =
1497 
1498  struct MuttWindow *envelope =
1501 
1502  struct MuttWindow *abar =
1505 
1506  struct MuttWindow *attach =
1509 
1510  struct MuttWindow *ebar =
1513 
1514  rd->email = e;
1515  rd->fcc = fcc;
1516  rd->win_envelope = envelope;
1517  rd->win_cbar = ebar;
1518  rd->win_attach = attach;
1519  rd->win_abar = abar;
1520  rd->sub = sub;
1521 
1522  const bool c_status_on_top = cs_subset_bool(sub, "status_on_top");
1523  if (c_status_on_top)
1524  {
1525  mutt_window_add_child(dlg, ebar);
1526  mutt_window_add_child(dlg, envelope);
1527  mutt_window_add_child(dlg, abar);
1528  mutt_window_add_child(dlg, attach);
1529  }
1530  else
1531  {
1532  mutt_window_add_child(dlg, envelope);
1533  mutt_window_add_child(dlg, abar);
1534  mutt_window_add_child(dlg, attach);
1535  mutt_window_add_child(dlg, ebar);
1536  }
1537 
1540  dialog_push(dlg);
1541 
1542 #ifdef USE_NNTP
1543  if (news)
1544  dlg->help_data = ComposeNewsHelp;
1545  else
1546 #endif
1547  dlg->help_data = ComposeHelp;
1548  dlg->help_menu = MENU_COMPOSE;
1549 
1550  envelope->req_rows = calc_envelope(rd);
1551  mutt_window_reflow(dlg);
1552 
1553  struct Menu *menu = mutt_menu_new(MENU_COMPOSE);
1554 
1555  menu->pagelen = attach->state.rows;
1556  menu->win_index = attach;
1557  menu->win_ibar = ebar;
1558 
1559  menu->make_entry = snd_make_entry;
1560  menu->tag = attach_tag;
1562  menu->redraw_data = rd;
1563  mutt_menu_push_current(menu);
1564 
1565  struct AttachCtx *actx = mutt_actx_new();
1566  actx->email = e;
1567  mutt_update_compose_menu(actx, menu, true);
1568 
1569  update_crypt_info(rd);
1570 
1571  /* Since this is rather long lived, we don't use the pool */
1572  struct Buffer fname = mutt_buffer_make(PATH_MAX);
1573 
1574  bool redraw_env = false;
1575  while (loop)
1576  {
1577  if (redraw_env)
1578  {
1579  redraw_env = false;
1580  envelope->req_rows = calc_envelope(rd);
1581  mutt_window_reflow(dlg);
1582  }
1583 
1584 #ifdef USE_NNTP
1585  OptNews = false; /* for any case */
1586 #endif
1587  const int op = mutt_menu_loop(menu);
1588  if (op >= 0)
1589  mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", OpStrings[op][0], op);
1590  switch (op)
1591  {
1592  case OP_COMPOSE_EDIT_FROM:
1593  if (edit_address_list(HDR_FROM, &e->env->from))
1594  {
1595  update_crypt_info(rd);
1597  redraw_env = true;
1598  }
1599  break;
1600 
1601  case OP_COMPOSE_EDIT_TO:
1602  {
1603 #ifdef USE_NNTP
1604  if (news)
1605  break;
1606 #endif
1607  if (edit_address_list(HDR_TO, &e->env->to))
1608  {
1609  update_crypt_info(rd);
1611  redraw_env = true;
1612  }
1613  break;
1614  }
1615 
1616  case OP_COMPOSE_EDIT_BCC:
1617  {
1618 #ifdef USE_NNTP
1619  if (news)
1620  break;
1621 #endif
1622  if (edit_address_list(HDR_BCC, &e->env->bcc))
1623  {
1624  update_crypt_info(rd);
1626  redraw_env = true;
1627  }
1628  break;
1629  }
1630 
1631  case OP_COMPOSE_EDIT_CC:
1632  {
1633 #ifdef USE_NNTP
1634  if (news)
1635  break;
1636 #endif
1637  if (edit_address_list(HDR_CC, &e->env->cc))
1638  {
1639  update_crypt_info(rd);
1641  redraw_env = true;
1642  }
1643  break;
1644  }
1645 
1646 #ifdef USE_NNTP
1647  case OP_COMPOSE_EDIT_NEWSGROUPS:
1648  if (!news)
1649  break;
1650  mutt_str_copy(buf, e->env->newsgroups, sizeof(buf));
1651  if (mutt_get_field(Prompts[HDR_NEWSGROUPS], buf, sizeof(buf),
1652  MUTT_COMP_NO_FLAGS, false, NULL, NULL) == 0)
1653  {
1654  mutt_str_replace(&e->env->newsgroups, buf);
1655  redraw_env = true;
1656  }
1657  break;
1658 
1659  case OP_COMPOSE_EDIT_FOLLOWUP_TO:
1660  if (!news)
1661  break;
1662  mutt_str_copy(buf, e->env->followup_to, sizeof(buf));
1663  if (mutt_get_field(Prompts[HDR_FOLLOWUPTO], buf, sizeof(buf),
1664  MUTT_COMP_NO_FLAGS, false, NULL, NULL) == 0)
1665  {
1666  mutt_str_replace(&e->env->followup_to, buf);
1667  redraw_env = true;
1668  }
1669  break;
1670 
1671  case OP_COMPOSE_EDIT_X_COMMENT_TO:
1672  {
1673  const bool c_x_comment_to = cs_subset_bool(sub, "x_comment_to");
1674  if (!(news && c_x_comment_to))
1675  break;
1676  mutt_str_copy(buf, e->env->x_comment_to, sizeof(buf));
1677  if (mutt_get_field(Prompts[HDR_XCOMMENTTO], buf, sizeof(buf),
1678  MUTT_COMP_NO_FLAGS, false, NULL, NULL) == 0)
1679  {
1680  mutt_str_replace(&e->env->x_comment_to, buf);
1681  redraw_env = true;
1682  }
1683  break;
1684  }
1685 #endif
1686 
1687  case OP_COMPOSE_EDIT_SUBJECT:
1688  mutt_str_copy(buf, e->env->subject, sizeof(buf));
1689  if (mutt_get_field(Prompts[HDR_SUBJECT], buf, sizeof(buf),
1690  MUTT_COMP_NO_FLAGS, false, NULL, NULL) == 0)
1691  {
1692  if (!mutt_str_equal(e->env->subject, buf))
1693  {
1694  mutt_str_replace(&e->env->subject, buf);
1695  redraw_env = true;
1697  }
1698  }
1699  break;
1700 
1701  case OP_COMPOSE_EDIT_REPLY_TO:
1703  {
1705  redraw_env = true;
1706  }
1707  break;
1708 
1709  case OP_COMPOSE_EDIT_FCC:
1710  mutt_buffer_copy(&fname, fcc);
1712  false, NULL, NULL, NULL) == 0)
1713  {
1714  if (!mutt_str_equal(fcc->data, fname.data))
1715  {
1716  mutt_buffer_copy(fcc, &fname);
1718  fcc_set = true;
1719  redraw_env = true;
1721  }
1722  }
1723  break;
1724 
1725  case OP_COMPOSE_EDIT_MESSAGE:
1726  {
1727  const bool c_edit_headers = cs_subset_bool(sub, "edit_headers");
1728  if (!c_edit_headers)
1729  {
1731  const char *c_editor = cs_subset_string(sub, "editor");
1732  mutt_edit_file(c_editor, e->body->filename);
1734  mutt_update_encoding(e->body, sub);
1735  menu->redraw = REDRAW_FULL;
1736  /* Unconditional hook since editor was invoked */
1738  break;
1739  }
1740  }
1741  /* fallthrough */
1742 
1743  case OP_COMPOSE_EDIT_HEADERS:
1744  {
1746  const char *tag = NULL;
1747  char *err = NULL;
1748  mutt_env_to_local(e->env);
1749  const char *c_editor = cs_subset_string(sub, "editor");
1750  mutt_edit_headers(NONULL(c_editor), e->body->filename, e, fcc);
1751  if (mutt_env_to_intl(e->env, &tag, &err))
1752  {
1753  mutt_error(_("Bad IDN in '%s': '%s'"), tag, err);
1754  FREE(&err);
1755  }
1756  update_crypt_info(rd);
1757  redraw_env = true;
1758 
1760  mutt_update_encoding(e->body, sub);
1761 
1762  /* attachments may have been added */
1763  if (actx->idxlen && actx->idx[actx->idxlen - 1]->body->next)
1764  {
1765  mutt_actx_entries_free(actx);
1766  mutt_update_compose_menu(actx, menu, true);
1767  }
1768 
1769  menu->redraw = REDRAW_FULL;
1770  /* Unconditional hook since editor was invoked */
1772  break;
1773  }
1774 
1775  case OP_COMPOSE_ATTACH_KEY:
1776  {
1777  if (!(WithCrypto & APPLICATION_PGP))
1778  break;
1779  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1781  if (ap->body)
1782  {
1783  update_idx(menu, actx, ap);
1784  menu->redraw |= REDRAW_INDEX;
1786  }
1787  else
1788  FREE(&ap);
1789 
1790  menu->redraw |= REDRAW_STATUS;
1791  break;
1792  }
1793 
1794  case OP_COMPOSE_MOVE_UP:
1795  if (menu->current == 0)
1796  {
1797  mutt_error(_("Attachment is already at top"));
1798  break;
1799  }
1800  if (menu->current == 1)
1801  {
1802  mutt_error(_("The fundamental part can't be moved"));
1803  break;
1804  }
1805  compose_attach_swap(e->body, actx->idx, menu->current - 1);
1806  menu->redraw |= REDRAW_INDEX;
1807  menu->current--;
1808  break;
1809 
1810  case OP_COMPOSE_MOVE_DOWN:
1811  if (menu->current == (actx->idxlen - 1))
1812  {
1813  mutt_error(_("Attachment is already at bottom"));
1814  break;
1815  }
1816  if (menu->current == 0)
1817  {
1818  mutt_error(_("The fundamental part can't be moved"));
1819  break;
1820  }
1821  compose_attach_swap(e->body, actx->idx, menu->current);
1822  menu->redraw |= REDRAW_INDEX;
1823  menu->current++;
1824  break;
1825 
1826  case OP_COMPOSE_GROUP_ALTS:
1827  {
1828  if (menu->tagged < 2)
1829  {
1830  mutt_error(
1831  _("Grouping 'alternatives' requires at least 2 tagged messages"));
1832  break;
1833  }
1834 
1835  struct Body *group = mutt_body_new();
1836  group->type = TYPE_MULTIPART;
1837  group->subtype = mutt_str_dup("alternative");
1838  group->disposition = DISP_INLINE;
1839 
1840  struct Body *alts = NULL;
1841  /* group tagged message into a multipart/alternative */
1842  struct Body *bptr = e->body;
1843  for (int i = 0; bptr;)
1844  {
1845  if (bptr->tagged)
1846  {
1847  bptr->tagged = false;
1848  bptr->disposition = DISP_INLINE;
1849 
1850  /* for first match, set group desc according to match */
1851 #define ALTS_TAG "Alternatives for \"%s\""
1852  if (!group->description)
1853  {
1854  char *p = bptr->description ? bptr->description : bptr->filename;
1855  if (p)
1856  {
1857  group->description =
1858  mutt_mem_calloc(1, strlen(p) + strlen(ALTS_TAG) + 1);
1859  sprintf(group->description, ALTS_TAG, p);
1860  }
1861  }
1862 
1863  // append bptr to the alts list, and remove from the e->body list
1864  if (alts)
1865  {
1866  alts->next = bptr;
1867  bptr = bptr->next;
1868  alts = alts->next;
1869  alts->next = NULL;
1870  }
1871  else
1872  {
1873  group->parts = bptr;
1874  alts = bptr;
1875  bptr = bptr->next;
1876  alts->next = NULL;
1877  }
1878 
1879  for (int j = i; j < actx->idxlen - 1; j++)
1880  {
1881  actx->idx[j] = actx->idx[j + 1];
1882  actx->idx[j + 1] = NULL; /* for debug reason */
1883  }
1884  actx->idxlen--;
1885  }
1886  else
1887  {
1888  bptr = bptr->next;
1889  i++;
1890  }
1891  }
1892 
1893  group->next = NULL;
1895 
1896  /* if no group desc yet, make one up */
1897  if (!group->description)
1898  group->description = mutt_str_dup("unknown alternative group");
1899 
1900  struct AttachPtr *gptr = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1901  gptr->body = group;
1902  update_idx(menu, actx, gptr);
1903  menu->redraw |= REDRAW_INDEX;
1904  break;
1905  }
1906 
1907  case OP_COMPOSE_GROUP_LINGUAL:
1908  {
1909  if (menu->tagged < 2)
1910  {
1911  mutt_error(
1912  _("Grouping 'multilingual' requires at least 2 tagged messages"));
1913  break;
1914  }
1915 
1916  /* traverse to see whether all the parts have Content-Language: set */
1917  int tagged_with_lang_num = 0;
1918  for (struct Body *b = e->body; b; b = b->next)
1919  if (b->tagged && b->language && *b->language)
1920  tagged_with_lang_num++;
1921 
1922  if (menu->tagged != tagged_with_lang_num)
1923  {
1924  if (mutt_yesorno(
1925  _("Not all parts have 'Content-Language' set, continue?"), MUTT_YES) != MUTT_YES)
1926  {
1927  mutt_message(_("Not sending this message"));
1928  break;
1929  }
1930  }
1931 
1932  struct Body *group = mutt_body_new();
1933  group->type = TYPE_MULTIPART;
1934  group->subtype = mutt_str_dup("multilingual");
1935  group->disposition = DISP_INLINE;
1936 
1937  struct Body *alts = NULL;
1938  /* group tagged message into a multipart/multilingual */
1939  struct Body *bptr = e->body;
1940  for (int i = 0; bptr;)
1941  {
1942  if (bptr->tagged)
1943  {
1944  bptr->tagged = false;
1945  bptr->disposition = DISP_INLINE;
1946 
1947  /* for first match, set group desc according to match */
1948 #define LINGUAL_TAG "Multilingual part for \"%s\""
1949  if (!group->description)
1950  {
1951  char *p = bptr->description ? bptr->description : bptr->filename;
1952  if (p)
1953  {
1954  group->description =
1955  mutt_mem_calloc(1, strlen(p) + strlen(LINGUAL_TAG) + 1);
1956  sprintf(group->description, LINGUAL_TAG, p);
1957  }
1958  }
1959 
1960  // append bptr to the alts list, and remove from the e->body list
1961  if (alts)
1962  {
1963  alts->next = bptr;
1964  bptr = bptr->next;
1965  alts = alts->next;
1966  alts->next = NULL;
1967  }
1968  else
1969  {
1970  group->parts = bptr;
1971  alts = bptr;
1972  bptr = bptr->next;
1973  alts->next = NULL;
1974  }
1975 
1976  for (int j = i; j < actx->idxlen - 1; j++)
1977  {
1978  actx->idx[j] = actx->idx[j + 1];
1979  actx->idx[j + 1] = NULL; /* for debug reason */
1980  }
1981  actx->idxlen--;
1982  }
1983  else
1984  {
1985  bptr = bptr->next;
1986  i++;
1987  }
1988  }
1989 
1990  group->next = NULL;
1992 
1993  /* if no group desc yet, make one up */
1994  if (!group->description)
1995  group->description = mutt_str_dup("unknown multilingual group");
1996 
1997  struct AttachPtr *gptr = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1998  gptr->body = group;
1999  update_idx(menu, actx, gptr);
2000  menu->redraw |= REDRAW_INDEX;
2001  break;
2002  }
2003 
2004  case OP_COMPOSE_ATTACH_FILE:
2005  {
2006  char *prompt = _("Attach file");
2007  int numfiles = 0;
2008  char **files = NULL;
2009 
2010  mutt_buffer_reset(&fname);
2011  if ((mutt_buffer_enter_fname(prompt, &fname, false, NULL, true, &files,
2012  &numfiles, MUTT_SEL_MULTI) == -1) ||
2013  mutt_buffer_is_empty(&fname))
2014  {
2015  for (int i = 0; i < numfiles; i++)
2016  FREE(&files[i]);
2017 
2018  FREE(&files);
2019  break;
2020  }
2021 
2022  bool error = false;
2023  bool added_attachment = false;
2024  if (numfiles > 1)
2025  {
2026  mutt_message(ngettext("Attaching selected file...",
2027  "Attaching selected files...", numfiles));
2028  }
2029  for (int i = 0; i < numfiles; i++)
2030  {
2031  char *att = files[i];
2032  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
2033  ap->unowned = true;
2034  ap->body = mutt_make_file_attach(att, sub);
2035  if (ap->body)
2036  {
2037  added_attachment = true;
2038  update_idx(menu, actx, ap);
2039  }
2040  else
2041  {
2042  error = true;
2043  mutt_error(_("Unable to attach %s"), att);
2044  FREE(&ap);
2045  }
2046  FREE(&files[i]);
2047  }
2048 
2049  FREE(&files);
2050  if (!error)
2051  mutt_clear_error();
2052 
2053  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
2054  if (added_attachment)
2056  break;
2057  }
2058 
2059  case OP_COMPOSE_ATTACH_MESSAGE:
2060 #ifdef USE_NNTP
2061  case OP_COMPOSE_ATTACH_NEWS_MESSAGE:
2062 #endif
2063  {
2064  mutt_buffer_reset(&fname);
2065  char *prompt = _("Open mailbox to attach message from");
2066 
2067 #ifdef USE_NNTP
2068  OptNews = false;
2069  if (Context && (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE))
2070  {
2071  const char *c_news_server = cs_subset_string(sub, "news_server");
2072  CurrentNewsSrv = nntp_select_server(Context->mailbox, c_news_server, false);
2073  if (!CurrentNewsSrv)
2074  break;
2075 
2076  prompt = _("Open newsgroup to attach message from");
2077  OptNews = true;
2078  }
2079 #endif
2080 
2081  if (Context)
2082  {
2083 #ifdef USE_NNTP
2084  if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->mailbox->type == MUTT_NNTP))
2085 #endif
2086  {
2089  }
2090  }
2091 
2092  if ((mutt_buffer_enter_fname(prompt, &fname, true, ctx_mailbox(Context),
2093  false, NULL, NULL, MUTT_SEL_NO_FLAGS) == -1) ||
2094  mutt_buffer_is_empty(&fname))
2095  {
2096  break;
2097  }
2098 
2099 #ifdef USE_NNTP
2100  if (OptNews)
2102  else
2103 #endif
2104  mutt_buffer_expand_path(&fname);
2105 #ifdef USE_IMAP
2106  if (imap_path_probe(mutt_buffer_string(&fname), NULL) != MUTT_IMAP)
2107 #endif
2108 #ifdef USE_POP
2109  if (pop_path_probe(mutt_buffer_string(&fname), NULL) != MUTT_POP)
2110 #endif
2111 #ifdef USE_NNTP
2112  if (!OptNews && (nntp_path_probe(mutt_buffer_string(&fname), NULL) != MUTT_NNTP))
2113 #endif
2115  {
2116  /* check to make sure the file exists and is readable */
2117  if (access(mutt_buffer_string(&fname), R_OK) == -1)
2118  {
2120  break;
2121  }
2122  }
2123 
2124  menu->redraw = REDRAW_FULL;
2125 
2126  struct Mailbox *m = mx_path_resolve(mutt_buffer_string(&fname));
2127  bool old_readonly = m->readonly;
2128  struct Context *ctx = mx_mbox_open(m, MUTT_READONLY);
2129  if (!ctx)
2130  {
2131  mutt_error(_("Unable to open mailbox %s"), mutt_buffer_string(&fname));
2133  m = NULL;
2134  break;
2135  }
2136 
2137  if (ctx->mailbox->msg_count == 0)
2138  {
2139  mx_mbox_close(&ctx);
2140  mutt_error(_("No messages in that folder"));
2141  break;
2142  }
2143 
2144  struct Context *ctx_cur = Context; /* remember current folder and sort methods */
2145  const enum SortType old_sort = cs_subset_sort(sub, "sort"); /* `$sort`, `$sort_aux` could be changed in mutt_index_menu() */
2146  const enum SortType old_sort_aux = cs_subset_sort(sub, "sort_aux");
2147 
2148  Context = ctx;
2149  OptAttachMsg = true;
2150  mutt_message(_("Tag the messages you want to attach"));
2151  struct MuttWindow *dlgindex = index_pager_init();
2152  dialog_push(dlgindex);
2153  mutt_index_menu(dlgindex);
2154  dialog_pop();
2155  index_pager_shutdown(dlgindex);
2156  mutt_window_free(&dlgindex);
2157  OptAttachMsg = false;
2158 
2159  if (!Context)
2160  {
2161  /* go back to the folder we started from */
2162  Context = ctx_cur;
2163  /* Restore old $sort and $sort_aux */
2164  if (old_sort != cs_subset_sort(sub, "sort"))
2165  cs_subset_str_native_set(sub, "sort", old_sort, NULL);
2166  if (old_sort_aux != cs_subset_sort(sub, "sort_aux"))
2167  cs_subset_str_native_set(sub, "sort_aux", old_sort_aux, NULL);
2168  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
2169  break;
2170  }
2171 
2172  bool added_attachment = false;
2173  for (int i = 0; i < Context->mailbox->msg_count; i++)
2174  {
2175  if (!Context->mailbox->emails[i])
2176  break;
2178  continue;
2179 
2180  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
2182  Context->mailbox->emails[i], true, sub);
2183  if (ap->body)
2184  {
2185  added_attachment = true;
2186  update_idx(menu, actx, ap);
2187  }
2188  else
2189  {
2190  mutt_error(_("Unable to attach"));
2191  FREE(&ap);
2192  }
2193  }
2194  menu->redraw |= REDRAW_FULL;
2195 
2196  Context->mailbox->readonly = old_readonly;
2198  ctx_free(&Context);
2199 
2200  /* go back to the folder we started from */
2201  Context = ctx_cur;
2202  /* Restore old $sort and $sort_aux */
2203  if (old_sort != cs_subset_sort(sub, "sort"))
2204  cs_subset_str_native_set(sub, "sort", old_sort, NULL);
2205  if (old_sort_aux != cs_subset_sort(sub, "sort_aux"))
2206  cs_subset_str_native_set(sub, "sort_aux", old_sort_aux, NULL);
2207  if (added_attachment)
2209  break;
2210  }
2211 
2212  case OP_DELETE:
2213  CHECK_COUNT;
2214  if (CUR_ATTACH->unowned)
2215  CUR_ATTACH->body->unlink = false;
2216  if (delete_attachment(actx, menu->current) == -1)
2217  break;
2218  mutt_update_compose_menu(actx, menu, false);
2219  if (menu->current == 0)
2220  e->body = actx->idx[0]->body;
2221 
2223  break;
2224 
2225  case OP_COMPOSE_TOGGLE_RECODE:
2226  {
2227  CHECK_COUNT;
2228  if (!mutt_is_text_part(CUR_ATTACH->body))
2229  {
2230  mutt_error(_("Recoding only affects text attachments"));
2231  break;
2232  }
2233  CUR_ATTACH->body->noconv = !CUR_ATTACH->body->noconv;
2234  if (CUR_ATTACH->body->noconv)
2235  mutt_message(_("The current attachment won't be converted"));
2236  else
2237  mutt_message(_("The current attachment will be converted"));
2238  menu->redraw |= REDRAW_CURRENT;
2240  break;
2241  }
2242 
2243  case OP_COMPOSE_EDIT_DESCRIPTION:
2244  CHECK_COUNT;
2245  mutt_str_copy(buf, CUR_ATTACH->body->description, sizeof(buf));
2246  /* header names should not be translated */
2247  if (mutt_get_field("Description: ", buf, sizeof(buf),
2248  MUTT_COMP_NO_FLAGS, false, NULL, NULL) == 0)
2249  {
2250  if (!mutt_str_equal(CUR_ATTACH->body->description, buf))
2251  {
2252  mutt_str_replace(&CUR_ATTACH->body->description, buf);
2253  menu->redraw |= REDRAW_CURRENT;
2255  }
2256  }
2257  break;
2258 
2259  case OP_COMPOSE_UPDATE_ENCODING:
2260  {
2261  CHECK_COUNT;
2262  bool encoding_updated = false;
2263  if (menu->tagprefix)
2264  {
2265  struct Body *top = NULL;
2266  for (top = e->body; top; top = top->next)
2267  {
2268  if (top->tagged)
2269  {
2270  encoding_updated = true;
2271  mutt_update_encoding(top, sub);
2272  }
2273  }
2274  menu->redraw = REDRAW_FULL;
2275  }
2276  else
2277  {
2278  mutt_update_encoding(CUR_ATTACH->body, sub);
2279  encoding_updated = true;
2280  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2281  }
2282  if (encoding_updated)
2284  break;
2285  }
2286 
2287  case OP_COMPOSE_TOGGLE_DISPOSITION:
2288  /* toggle the content-disposition between inline/attachment */
2289  CUR_ATTACH->body->disposition =
2290  (CUR_ATTACH->body->disposition == DISP_INLINE) ? DISP_ATTACH : DISP_INLINE;
2291  menu->redraw |= REDRAW_CURRENT;
2292  break;
2293 
2294  case OP_EDIT_TYPE:
2295  CHECK_COUNT;
2296  {
2297  if (mutt_edit_content_type(NULL, CUR_ATTACH->body, NULL))
2298  {
2299  /* this may have been a change to text/something */
2300  mutt_update_encoding(CUR_ATTACH->body, sub);
2301  menu->redraw |= REDRAW_CURRENT;
2303  }
2304  }
2305  break;
2306 
2307  case OP_COMPOSE_EDIT_LANGUAGE:
2308  CHECK_COUNT;
2309  mutt_str_copy(buf, CUR_ATTACH->body->language, sizeof(buf));
2310  if (mutt_get_field("Content-Language: ", buf, sizeof(buf),
2311  MUTT_COMP_NO_FLAGS, false, NULL, NULL) == 0)
2312  {
2313  if (!mutt_str_equal(CUR_ATTACH->body->language, buf))
2314  {
2315  CUR_ATTACH->body->language = mutt_str_dup(buf);
2316  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2318  }
2319  mutt_clear_error();
2320  }
2321  else
2322  mutt_warning(_("Empty 'Content-Language'"));
2323  break;
2324 
2325  case OP_COMPOSE_EDIT_ENCODING:
2326  CHECK_COUNT;
2327  mutt_str_copy(buf, ENCODING(CUR_ATTACH->body->encoding), sizeof(buf));
2328  if ((mutt_get_field("Content-Transfer-Encoding: ", buf, sizeof(buf),
2329  MUTT_COMP_NO_FLAGS, false, NULL, NULL) == 0) &&
2330  (buf[0] != '\0'))
2331  {
2332  int enc = mutt_check_encoding(buf);
2333  if ((enc != ENC_OTHER) && (enc != ENC_UUENCODED))
2334  {
2335  if (enc != CUR_ATTACH->body->encoding)
2336  {
2337  CUR_ATTACH->body->encoding = enc;
2338  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2339  mutt_clear_error();
2341  }
2342  }
2343  else
2344  mutt_error(_("Invalid encoding"));
2345  }
2346  break;
2347 
2348  case OP_COMPOSE_SEND_MESSAGE:
2349  /* Note: We don't invoke send2-hook here, since we want to leave
2350  * users an opportunity to change settings from the ":" prompt. */
2351  if (check_attachments(actx, sub) != 0)
2352  {
2353  menu->redraw = REDRAW_FULL;
2354  break;
2355  }
2356 
2357 #ifdef MIXMASTER
2358  if (!STAILQ_EMPTY(&e->chain) && (mix_check_message(e) != 0))
2359  break;
2360 #endif
2361 
2362  if (!fcc_set && !mutt_buffer_is_empty(fcc))
2363  {
2364  const enum QuadOption c_copy = cs_subset_quad(sub, "copy");
2365  enum QuadOption ans =
2366  query_quadoption(c_copy, _("Save a copy of this message?"));
2367  if (ans == MUTT_ABORT)
2368  break;
2369  else if (ans == MUTT_NO)
2370  mutt_buffer_reset(fcc);
2371  }
2372 
2373  loop = false;
2374  rc = 0;
2375  break;
2376 
2377  case OP_COMPOSE_EDIT_FILE:
2378  {
2379  CHECK_COUNT;
2380  const char *c_editor = cs_subset_string(sub, "editor");
2381  mutt_edit_file(NONULL(c_editor), CUR_ATTACH->body->filename);
2382  mutt_update_encoding(CUR_ATTACH->body, sub);
2383  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2384  /* Unconditional hook since editor was invoked */
2386  break;
2387  }
2388 
2389  case OP_COMPOSE_TOGGLE_UNLINK:
2390  CHECK_COUNT;
2391  CUR_ATTACH->body->unlink = !CUR_ATTACH->body->unlink;
2392 
2393  menu->redraw |= REDRAW_INDEX;
2394  /* No send2hook since this doesn't change the message. */
2395  break;
2396 
2397  case OP_COMPOSE_GET_ATTACHMENT:
2398  CHECK_COUNT;
2399  if (menu->tagprefix)
2400  {
2401  for (struct Body *top = e->body; top; top = top->next)
2402  {
2403  if (top->tagged)
2405  }
2406  menu->redraw |= REDRAW_FULL;
2407  }
2408  else if (mutt_get_tmp_attachment(CUR_ATTACH->body) == 0)
2409  menu->redraw |= REDRAW_CURRENT;
2410 
2411  /* No send2hook since this doesn't change the message. */
2412  break;
2413 
2414  case OP_COMPOSE_RENAME_ATTACHMENT:
2415  {
2416  CHECK_COUNT;
2417  char *src = NULL;
2418  if (CUR_ATTACH->body->d_filename)
2419  src = CUR_ATTACH->body->d_filename;
2420  else
2421  src = CUR_ATTACH->body->filename;
2423  int ret = mutt_buffer_get_field(_("Send attachment with name: "), &fname,
2424  MUTT_FILE, false, NULL, NULL, NULL);
2425  if (ret == 0)
2426  {
2427  /* As opposed to RENAME_FILE, we don't check buf[0] because it's
2428  * valid to set an empty string here, to erase what was set */
2429  mutt_str_replace(&CUR_ATTACH->body->d_filename, mutt_buffer_string(&fname));
2430  menu->redraw |= REDRAW_CURRENT;
2431  }
2432  break;
2433  }
2434 
2435  case OP_COMPOSE_RENAME_FILE:
2436  CHECK_COUNT;
2437  mutt_buffer_strcpy(&fname, CUR_ATTACH->body->filename);
2439  if ((mutt_buffer_get_field(_("Rename to: "), &fname, MUTT_FILE, false,
2440  NULL, NULL, NULL) == 0) &&
2441  !mutt_buffer_is_empty(&fname))
2442  {
2443  struct stat st;
2444  if (stat(CUR_ATTACH->body->filename, &st) == -1)
2445  {
2446  /* L10N: "stat" is a system call. Do "man 2 stat" for more information. */
2447  mutt_error(_("Can't stat %s: %s"), mutt_buffer_string(&fname), strerror(errno));
2448  break;
2449  }
2450 
2451  mutt_buffer_expand_path(&fname);
2452  if (mutt_file_rename(CUR_ATTACH->body->filename, mutt_buffer_string(&fname)))
2453  break;
2454 
2455  mutt_str_replace(&CUR_ATTACH->body->filename, mutt_buffer_string(&fname));
2456  menu->redraw |= REDRAW_CURRENT;
2457 
2458  if (CUR_ATTACH->body->stamp >= st.st_mtime)
2461  }
2462  break;
2463 
2464  case OP_COMPOSE_NEW_MIME:
2465  {
2466  mutt_buffer_reset(&fname);
2467  if ((mutt_buffer_get_field(_("New file: "), &fname, MUTT_FILE, false,
2468  NULL, NULL, NULL) != 0) ||
2469  mutt_buffer_is_empty(&fname))
2470  {
2471  continue;
2472  }
2473  mutt_buffer_expand_path(&fname);
2474 
2475  /* Call to lookup_mime_type () ? maybe later */
2476  char type[256] = { 0 };
2477  if ((mutt_get_field("Content-Type: ", type, sizeof(type),
2478  MUTT_COMP_NO_FLAGS, false, NULL, NULL) != 0) ||
2479  (type[0] == '\0'))
2480  {
2481  continue;
2482  }
2483 
2484  char *p = strchr(type, '/');
2485  if (!p)
2486  {
2487  mutt_error(_("Content-Type is of the form base/sub"));
2488  continue;
2489  }
2490  *p++ = 0;
2491  enum ContentType itype = mutt_check_mime_type(type);
2492  if (itype == TYPE_OTHER)
2493  {
2494  mutt_error(_("Unknown Content-Type %s"), type);
2495  continue;
2496  }
2497  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
2498  /* Touch the file */
2499  FILE *fp = mutt_file_fopen(mutt_buffer_string(&fname), "w");
2500  if (!fp)
2501  {
2502  mutt_error(_("Can't create file %s"), mutt_buffer_string(&fname));
2503  FREE(&ap);
2504  continue;
2505  }
2506  mutt_file_fclose(&fp);
2507 
2508  ap->body = mutt_make_file_attach(mutt_buffer_string(&fname), sub);
2509  if (!ap->body)
2510  {
2511  mutt_error(_("What we have here is a failure to make an attachment"));
2512  FREE(&ap);
2513  continue;
2514  }
2515  update_idx(menu, actx, ap);
2516 
2517  CUR_ATTACH->body->type = itype;
2518  mutt_str_replace(&CUR_ATTACH->body->subtype, p);
2519  CUR_ATTACH->body->unlink = true;
2520  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
2521 
2523  {
2524  mutt_update_encoding(CUR_ATTACH->body, sub);
2525  menu->redraw = REDRAW_FULL;
2526  }
2528  break;
2529  }
2530 
2531  case OP_COMPOSE_EDIT_MIME:
2532  CHECK_COUNT;
2533  if (mutt_edit_attachment(CUR_ATTACH->body))
2534  {
2535  mutt_update_encoding(CUR_ATTACH->body, sub);
2536  menu->redraw = REDRAW_FULL;
2538  }
2539  break;
2540 
2541  case OP_VIEW_ATTACH:
2542  case OP_DISPLAY_HEADERS:
2543  CHECK_COUNT;
2544  mutt_attach_display_loop(menu, op, NULL, actx, false);
2545  menu->redraw = REDRAW_FULL;
2546  /* no send2hook, since this doesn't modify the message */
2547  break;
2548 
2549  case OP_SAVE:
2550  CHECK_COUNT;
2551  mutt_save_attachment_list(actx, NULL, menu->tagprefix, CUR_ATTACH->body, NULL, menu);
2552  /* no send2hook, since this doesn't modify the message */
2553  break;
2554 
2555  case OP_PRINT:
2556  CHECK_COUNT;
2557  mutt_print_attachment_list(actx, NULL, menu->tagprefix, CUR_ATTACH->body);
2558  /* no send2hook, since this doesn't modify the message */
2559  break;
2560 
2561  case OP_PIPE:
2562  case OP_FILTER:
2563  CHECK_COUNT;
2564  mutt_pipe_attachment_list(actx, NULL, menu->tagprefix, CUR_ATTACH->body,
2565  (op == OP_FILTER));
2566  if (op == OP_FILTER) /* cte might have changed */
2567  menu->redraw |= menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT;
2568  menu->redraw |= REDRAW_STATUS;
2570  break;
2571 
2572  case OP_EXIT:
2573  {
2574  const enum QuadOption c_postpone = cs_subset_quad(sub, "postpone");
2575  enum QuadOption ans =
2576  query_quadoption(c_postpone, _("Save (postpone) draft message?"));
2577  if (ans == MUTT_NO)
2578  {
2579  for (int i = 0; i < actx->idxlen; i++)
2580  if (actx->idx[i]->unowned)
2581  actx->idx[i]->body->unlink = false;
2582 
2583  if (!(flags & MUTT_COMPOSE_NOFREEHEADER))
2584  {
2585  for (int i = 0; i < actx->idxlen; i++)
2586  {
2587  /* avoid freeing other attachments */
2588  actx->idx[i]->body->next = NULL;
2589  /* See the comment in delete_attachment() */
2590  if (!actx->idx[i]->body->email)
2591  actx->idx[i]->body->parts = NULL;
2592  mutt_body_free(&actx->idx[i]->body);
2593  }
2594  }
2595  rc = -1;
2596  loop = false;
2597  break;
2598  }
2599  else if (ans == MUTT_ABORT)
2600  break; /* abort */
2601  }
2602  /* fallthrough */
2603 
2604  case OP_COMPOSE_POSTPONE_MESSAGE:
2605  if (check_attachments(actx, sub) != 0)
2606  {
2607  menu->redraw = REDRAW_FULL;
2608  break;
2609  }
2610 
2611  loop = false;
2612  rc = 1;
2613  break;
2614 
2615  case OP_COMPOSE_ISPELL:
2616  {
2617  endwin();
2618  const char *c_ispell = cs_subset_string(sub, "ispell");
2619  snprintf(buf, sizeof(buf), "%s -x %s", NONULL(c_ispell), e->body->filename);
2620  if (mutt_system(buf) == -1)
2621  mutt_error(_("Error running \"%s\""), buf);
2622  else
2623  {
2624  mutt_update_encoding(e->body, sub);
2625  menu->redraw |= REDRAW_STATUS;
2626  }
2627  break;
2628  }
2629 
2630  case OP_COMPOSE_WRITE_MESSAGE:
2631  mutt_buffer_reset(&fname);
2632  if (Context)
2633  {
2636  }
2637  if (actx->idxlen)
2638  e->body = actx->idx[0]->body;
2639  if ((mutt_buffer_enter_fname(_("Write message to mailbox"), &fname,
2640  true, ctx_mailbox(Context), false, NULL,
2641  NULL, MUTT_SEL_NO_FLAGS) != -1) &&
2642  !mutt_buffer_is_empty(&fname))
2643  {
2644  mutt_message(_("Writing message to %s ..."), mutt_buffer_string(&fname));
2645  mutt_buffer_expand_path(&fname);
2646 
2647  if (e->body->next)
2648  e->body = mutt_make_multipart(e->body);
2649 
2650  if (mutt_write_fcc(mutt_buffer_string(&fname), e, NULL, false, NULL, NULL, sub) == 0)
2651  mutt_message(_("Message written"));
2652 
2653  e->body = mutt_remove_multipart(e->body);
2654  }
2655  break;
2656 
2657  case OP_COMPOSE_PGP_MENU:
2658  {
2659  const SecurityFlags old_flags = e->security;
2660  if (!(WithCrypto & APPLICATION_PGP))
2661  break;
2663  {
2664  mutt_error(_("No PGP backend configured"));
2665  break;
2666  }
2667  if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME))
2668  {
2669  if (e->security & (SEC_ENCRYPT | SEC_SIGN))
2670  {
2671  if (mutt_yesorno(_("S/MIME already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
2672  {
2673  mutt_clear_error();
2674  break;
2675  }
2676  e->security &= ~(SEC_ENCRYPT | SEC_SIGN);
2677  }
2678  e->security &= ~APPLICATION_SMIME;
2679  e->security |= APPLICATION_PGP;
2680  update_crypt_info(rd);
2681  }
2682  e->security = crypt_pgp_send_menu(e);
2683  update_crypt_info(rd);
2684  if (old_flags != e->security)
2685  {
2687  redraw_env = true;
2688  }
2689  break;
2690  }
2691 
2692  case OP_FORGET_PASSPHRASE:
2694  break;
2695 
2696  case OP_COMPOSE_SMIME_MENU:
2697  {
2698  const SecurityFlags old_flags = e->security;
2699  if (!(WithCrypto & APPLICATION_SMIME))
2700  break;
2702  {
2703  mutt_error(_("No S/MIME backend configured"));
2704  break;
2705  }
2706 
2707  if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & APPLICATION_PGP))
2708  {
2709  if (e->security & (SEC_ENCRYPT | SEC_SIGN))
2710  {
2711  if (mutt_yesorno(_("PGP already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
2712  {
2713  mutt_clear_error();
2714  break;
2715  }
2716  e->security &= ~(SEC_ENCRYPT | SEC_SIGN);
2717  }
2718  e->security &= ~APPLICATION_PGP;
2720  update_crypt_info(rd);
2721  }
2723  update_crypt_info(rd);
2724  if (old_flags != e->security)
2725  {
2727  redraw_env = true;
2728  }
2729  break;
2730  }
2731 
2732 #ifdef MIXMASTER
2733  case OP_COMPOSE_MIX:
2735  rd->win_envelope->state.cols);
2737  redraw_env = true;
2738  break;
2739 #endif
2740 
2741 #ifdef USE_AUTOCRYPT
2742  case OP_COMPOSE_AUTOCRYPT_MENU:
2743  {
2744  const SecurityFlags old_flags = e->security;
2745  const bool c_autocrypt = cs_subset_bool(sub, "autocrypt");
2746  if (!c_autocrypt)
2747  break;
2748 
2750  {
2751  if (e->security & (SEC_ENCRYPT | SEC_SIGN))
2752  {
2753  if (mutt_yesorno(_("S/MIME already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
2754  {
2755  mutt_clear_error();
2756  break;
2757  }
2758  e->security &= ~(SEC_ENCRYPT | SEC_SIGN);
2759  }
2760  e->security &= ~APPLICATION_SMIME;
2761  e->security |= APPLICATION_PGP;
2762  update_crypt_info(rd);
2763  }
2764  autocrypt_compose_menu(e, sub);
2765  update_crypt_info(rd);
2766  if (old_flags != e->security)
2767  {
2769  redraw_env = true;
2770  }
2771  break;
2772  }
2773 #endif
2774  }
2775  }
2776 
2777  mutt_buffer_dealloc(&fname);
2778 
2779 #ifdef USE_AUTOCRYPT
2780  /* This is a fail-safe to make sure the bit isn't somehow turned
2781  * on. The user could have disabled the option after setting SEC_AUTOCRYPT,
2782  * or perhaps resuming or replying to an autocrypt message. */
2783  const bool c_autocrypt = cs_subset_bool(sub, "autocrypt");
2784  if (!c_autocrypt)
2785  e->security &= ~SEC_AUTOCRYPT;
2786 #endif
2787 
2788  mutt_menu_pop_current(menu);
2789  mutt_menu_free(&menu);
2790  dialog_pop();
2793  mutt_window_free(&dlg);
2794 
2795  if (actx->idxlen)
2796  e->body = actx->idx[0]->body;
2797  else
2798  e->body = NULL;
2799 
2800  mutt_actx_free(&actx);
2801 
2802  mutt_list_free(&redraw.to_list);
2803  mutt_list_free(&redraw.cc_list);
2804  mutt_list_free(&redraw.bcc_list);
2805  return rc;
2806 }
+ Here is the caller graph for this function:

Variable Documentation

◆ There_are_no_attachments

const char* There_are_no_attachments = N_("There are no attachments")
static

Definition at line 99 of file compose.c.

◆ HeaderPadding

int HeaderPadding[HDR_ATTACH_TITLE] = { 0 }
static

Definition at line 173 of file compose.c.

◆ MaxHeaderWidth

int MaxHeaderWidth = 0
static

Definition at line 174 of file compose.c.

◆ Prompts

const char* const Prompts[]
static

Definition at line 176 of file compose.c.

◆ ComposeHelp

const struct Mapping ComposeHelp[]
static
Initial value:
= {
{ N_("Send"), OP_COMPOSE_SEND_MESSAGE },
{ N_("Abort"), OP_EXIT },
{ N_("To"), OP_COMPOSE_EDIT_TO },
{ N_("CC"), OP_COMPOSE_EDIT_CC },
{ N_("Subj"), OP_COMPOSE_EDIT_SUBJECT },
{ N_("Attach file"), OP_COMPOSE_ATTACH_FILE },
{ N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the Compose dialog.

Definition at line 219 of file compose.c.

◆ ComposeNewsHelp

const struct Mapping ComposeNewsHelp[]
static
Initial value:
= {
{ N_("Send"), OP_COMPOSE_SEND_MESSAGE },
{ N_("Abort"), OP_EXIT },
{ N_("Newsgroups"), OP_COMPOSE_EDIT_NEWSGROUPS },
{ N_("Subj"), OP_COMPOSE_EDIT_SUBJECT },
{ N_("Attach file"), OP_COMPOSE_ATTACH_FILE },
{ N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the News Compose dialog.

Definition at line 238 of file compose.c.

◆ AutocryptRecUiFlags

const char* AutocryptRecUiFlags[]
static
Initial value:
= {
N_("Off"),
N_("No"),
N_("Discouraged"),
N_("Available"),
N_("Yes"),
}

Definition at line 253 of file compose.c.

ctx_free
void ctx_free(struct Context **ptr)
Free a Context.
Definition: context.c:50
Envelope
The header of an Email.
Definition: envelope.h:54
There_are_no_attachments
static const char * There_are_no_attachments
Definition: compose.c:99
Envelope::subject
char * subject
Email's subject.
Definition: envelope.h:66
AttachCtx
A set of attachments.
Definition: attach.h:49
ComposeNewsHelp
static const struct Mapping ComposeNewsHelp[]
Help Bar for the News Compose dialog.
Definition: compose.c:238
MT_COLOR_COMPOSE_HEADER
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:65
ComposeRedrawData::win_attach
struct MuttWindow * win_attach
List of Attachments.
Definition: compose.c:127
mutt_generate_boundary
void mutt_generate_boundary(struct ParameterList *pl)
Create a unique boundary id for a MIME part.
Definition: multipart.c:86
Envelope::bcc
struct AddressList bcc
Email's 'Bcc' list.
Definition: envelope.h:60
STAILQ_INIT
#define STAILQ_INIT(head)
Definition: queue.h:369
HDR_CC
@ HDR_CC
"Cc:" field
Definition: compose.c:151
CHECK_COUNT
#define CHECK_COUNT
Definition: compose.c:133
WT_CUSTOM
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:92
ENC_QUOTED_PRINTABLE
@ ENC_QUOTED_PRINTABLE
Quoted-printable text.
Definition: mime.h:51
dialog_pop
void dialog_pop(void)
Hide a Window from the user.
Definition: dialog.c:98
crypt_pgp_make_key_attachment
struct Body * crypt_pgp_make_key_attachment(void)
Wrapper for CryptModuleSpecs::pgp_make_key_attachment()
Definition: cryptglue.c:305
mutt_window_clrtoeol
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:244
snd_make_entry
static void snd_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the attachment list - Implements Menu::make_entry()
Definition: compose.c:333
mutt_message_hook
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:574
MUTT_READONLY
#define MUTT_READONLY
Open in read-only mode.
Definition: mx.h:54
update_crypt_info
static void update_crypt_info(struct ComposeRedrawData *rd)
Update the crypto info.
Definition: compose.c:680
QuadOption
QuadOption
Possible values for a quad-option.
Definition: quad.h:36
header_find
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Definition: email.c:172
STAILQ_FOREACH_FROM
#define STAILQ_FOREACH_FROM(var, head, field)
Definition: queue.h:354
Envelope::followup_to
char * followup_to
List of 'followup-to' fields.
Definition: envelope.h:77
ComposeRedrawData::win_abar
struct MuttWindow * win_abar
Attachments label.
Definition: compose.c:126
mutt_window_move
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:382
delete_attachment
static int delete_attachment(struct AttachCtx *actx, int x)
Delete an attachment.
Definition: compose.c:1073
attach_tag
int attach_tag(struct Menu *menu, int sel, int act)
Tag an attachment - Implements Menu::tag()
Definition: recvattach.c:458
redraw_mix_line
static void redraw_mix_line(struct ListHead *chain, struct ComposeRedrawData *rd, int row)
Redraw the Mixmaster chain.
Definition: compose.c:725
mutt_actx_new
struct AttachCtx * mutt_actx_new(void)
Create a new Attachment Context.
Definition: attach.c:131
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
mutt_stamp_attachment
void mutt_stamp_attachment(struct Body *a)
Timestamp an Attachment.
Definition: sendlib.c:893
_
#define _(a)
Definition: message.h:28
NONULL
#define NONULL(x)
Definition: string2.h:37
mutt_window_printf
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:550
Mailbox
A mailbox.
Definition: mailbox.h:81
compose_custom_redraw
static void compose_custom_redraw(struct Menu *menu)
Redraw the compose menu - Implements Menu::custom_redraw()
Definition: compose.c:1202
AttachCtx::vcount
short vcount
The number of virtual attachments.
Definition: attach.h:59
mutt_actx_entries_free
void mutt_actx_entries_free(struct AttachCtx *actx)
Free entries in an Attachment Context.
Definition: attach.c:103
ENC_UUENCODED
@ ENC_UUENCODED
UUEncoded text.
Definition: mime.h:54
APPLICATION_SMIME
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:98
mutt_window_mvprintw
int mutt_window_mvprintw(struct MuttWindow *win, int col, int row, const char *fmt,...)
Move the cursor and write a formatted string to a Window.
Definition: mutt_window.c:415
MUTT_SEND2_HOOK
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
Definition: hook.h:56
Mailbox::emails
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
Body::content
struct Content * content
Detailed info about the content of the attachment.
Definition: body.h:51
mutt_window_clear
void mutt_window_clear(struct MuttWindow *win)
Clear a Window.
Definition: mutt_window.c:806
mutt_system
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:51
ComposeRedrawData::to_list
struct ListHead to_list
Definition: compose.c:112
nntp_expand_path
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition: newsrc.c:560
NT_CONFIG
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:37
MT_COLOR_STATUS
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:94
mutt_env_to_intl
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:309
ListNode
A List node for strings.
Definition: list.h:34
Buffer
String manipulation buffer.
Definition: buffer.h:33
menu_redraw_index
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: menu.c:381
LL_DEBUG3
@ LL_DEBUG3
Log at debug level 3.
Definition: logging.h:42
mutt_addrlist_to_intl
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1304
HDR_FCC
@ HDR_FCC
"Fcc:" (save folder) field
Definition: compose.c:155
Connection::account
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
draw_envelope_addr
static int draw_envelope_addr(int field, struct AddressList *al, struct MuttWindow *win, int row, size_t max_lines)
Write addresses to the compose window.
Definition: compose.c:830
ctx_mailbox
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
Definition: context.c:429
mutt_update_encoding
void mutt_update_encoding(struct Body *a, struct ConfigSubset *sub)
Update the encoding type.
Definition: sendlib.c:905
mutt_gen_compose_attach_list
static void mutt_gen_compose_attach_list(struct AttachCtx *actx, struct Body *m, int parent_type, int level)
Generate the attachment list for the compose screen.
Definition: compose.c:1129
SEC_OPPENCRYPT
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
Definition: lib.h:93
mutt_file_fclose
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:153
mutt_buffer_pretty_mailbox
void mutt_buffer_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition: muttlib.c:599
SEC_AUTOCRYPT_OVERRIDE
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
Definition: lib.h:95
crypt_smime_send_menu
SecurityFlags crypt_smime_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu()
Definition: cryptglue.c:531
Body::next
struct Body * next
next attachment in the list
Definition: body.h:53
mutt_buffer_is_empty
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
MaxHeaderWidth
static int MaxHeaderWidth
Definition: compose.c:174
index_pager_init
struct MuttWindow * index_pager_init(void)
Allocate the Windows for the Index/Pager.
Definition: index.c:4187
mutt_buffer_dealloc
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
Body
The body of an email.
Definition: body.h:34
NT_HEADER_CHANGE
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:160
SEC_ENCRYPT
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:85
dialog_push
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: dialog.c:66
mutt_check_encoding
int mutt_check_encoding(const char *c)
Check the encoding type.
Definition: parse.c:398
AttachPtr::fp
FILE * fp
Used in the recvattach menu.
Definition: attach.h:37
MUTT_FORMAT_ARROWCURSOR
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
mutt_remove_multipart
struct Body * mutt_remove_multipart(struct Body *b)
Extract the multipart body if it exists.
Definition: multipart.c:126
ComposeRedrawData::email
struct Email * email
Definition: compose.c:109
SEC_SIGN
#define SEC_SIGN
Email is signed.
Definition: lib.h:86
MAX_ADDR_ROWS
#define MAX_ADDR_ROWS
Maximum number of rows to use for the To:, Cc:, Bcc: fields.
Definition: compose.c:94
mutt_addrlist_write
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
dialog_find
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:46
MUTT_SEL_NO_FLAGS
#define MUTT_SEL_NO_FLAGS
No flags are set.
Definition: browser.h:41
CUR_ATTACH
#define CUR_ATTACH
Definition: compose.c:140
MUTT_POP
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:55
NeoMutt::notify
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
message_is_tagged
bool message_is_tagged(struct Context *ctx, struct Email *e)
Is a message in the index tagged (and within limit)
Definition: context.c:335
AttachPtr
An email to which things will be attached.
Definition: attach.h:34
MuttWindow
A division of the screen.
Definition: mutt_window.h:115
mutt_multi_choice
int mutt_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question.
Definition: curs_lib.c:937
MAX_USER_HDR_ROWS
#define MAX_USER_HDR_ROWS
Maximum number of rows to use for the Headers: field.
Definition: compose.c:97
cs_subset_bool
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:69
SortType
SortType
Methods for sorting.
Definition: sort2.h:43
crypt_has_module_backend
bool crypt_has_module_backend(SecurityFlags type)
Is there a crypto backend for a given type?
Definition: cryptglue.c:169
menu_redraw_current
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition: menu.c:494
mutt_make_multipart
struct Body * mutt_make_multipart(struct Body *b)
Create a multipart email.
Definition: multipart.c:100
MUTT_YES
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition: quad.h:40
mutt_expand_aliases
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
Definition: alias.c:294
Context
The "current" mailbox.
Definition: context.h:38
HDR_REPLYTO
@ HDR_REPLYTO
"Reply-To:" field
Definition: compose.c:154
mutt_str_dup
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
MT_COLOR_BOLD
@ MT_COLOR_BOLD
Bold text.
Definition: color.h:64
mutt_file_fopen
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:589
LL_DEBUG1
@ LL_DEBUG1
Log at debug level 1.
Definition: logging.h:40
draw_floating
static void draw_floating(struct MuttWindow *win, int col, int row, const char *text)
Draw a floating label.
Definition: compose.c:397
mutt_strwidth
int mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:1363
Envelope::x_comment_to
char * x_comment_to
List of 'X-comment-to' fields.
Definition: envelope.h:78
mutt_check_mime_type
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
Definition: parse.c:325
ComposeRedrawData::win_envelope
struct MuttWindow * win_envelope
Envelope: From, To, etc.
Definition: compose.c:125
mix_check_message
int mix_check_message(struct Email *e)
Safety-check the message before passing it to mixmaster.
Definition: remailer.c:794
FREE
#define FREE(x)
Definition: memory.h:40
draw_envelope
static void draw_envelope(struct ComposeRedrawData *rd)
Write the email headers to the compose window.
Definition: compose.c:976
Content::hibin
long hibin
8-bit characters
Definition: content.h:35
STAILQ_FIRST
#define STAILQ_FIRST(head)
Definition: queue.h:347
Body::disposition
unsigned int disposition
content-disposition, ContentDisposition
Definition: body.h:67
mutt_perror
#define mutt_perror(...)
Definition: logging.h:85
mutt_draw_statusline
void mutt_draw_statusline(int cols, const char *buf, size_t buflen)
Draw a highlighted status bar.
Definition: index.c:974
TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:802
AUTOCRYPT_REC_YES
@ AUTOCRYPT_REC_YES
Autocrypt should be used.
Definition: lib.h:161
ContentType
ContentType
Content-Type.
Definition: mime.h:29
mutt_menu_new
struct Menu * mutt_menu_new(enum MenuType type)
Create a new Menu.
Definition: menu.c:956
Body::encoding
unsigned int encoding
content-transfer-encoding, ContentEncoding
Definition: body.h:66
Buffer::dsize
size_t dsize
Length of data.
Definition: buffer.h:37
DISP_ATTACH
@ DISP_ATTACH
Content is attached.
Definition: mime.h:63
Content::lobin
long lobin
Unprintable 7-bit chars (eg., control chars)
Definition: content.h:36
MuttWindow::help_menu
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: mutt_window.h:134
SecurityFlags
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
Definition: lib.h:83
HDR_TO
@ HDR_TO
"To:" field
Definition: compose.c:150
REDRAW_MOTION_RESYNC
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:42
PATH_MAX
#define PATH_MAX
Definition: mutt.h:44
HDR_ATTACH_TITLE
@ HDR_ATTACH_TITLE
The "-- Attachments" line.
Definition: compose.c:170
MUTT_ABORT
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
Definition: quad.h:38
Menu::make_entry
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Format a item for a menu.
Definition: mutt_menu.h:88
mutt_buffer_reset
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
header_set
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:225
mutt_buffer_pool_release
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
STAILQ_EMPTY
#define STAILQ_EMPTY(head)
Definition: queue.h:345
MUTT_FORMAT_NO_FLAGS
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: format_flags.h:30
HDR_CRYPTINFO
@ HDR_CRYPTINFO
"Sign as:" field (encryption/signing info)
Definition: compose.c:160
Body::tagged
bool tagged
This attachment is tagged.
Definition: body.h:70
mx_path_probe
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1335
MUTT_WIN_SIZE_MAXIMISE
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
Definition: mutt_window.h:45
Context
WHERE struct Context * Context
Definition: mutt_globals.h:42
mutt_body_free
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition: body.c:57
Menu::win_ibar
struct MuttWindow * win_ibar
Definition: mutt_menu.h:64
Body::subtype
char * subtype
content-type subtype
Definition: body.h:37
mx_path_resolve
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
Definition: mx.c:1681
WT_DLG_COMPOSE
@ WT_DLG_COMPOSE
Compose Dialog, mutt_compose_menu()
Definition: mutt_window.h:79
STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
mutt_write_fcc
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:1510
cs_subset_str_native_set
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:292
MT_COLOR_NORMAL
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:77
check_attachments
static int check_attachments(struct AttachCtx *actx, struct ConfigSubset *sub)
Check if any attachments have changed or been deleted.
Definition: compose.c:765
NntpAccountData::conn
struct Connection * conn
Definition: adata.h:60
ComposeRedrawData::cc_rows
short cc_rows
Definition: compose.c:117
ComposeRedrawData::bcc_list
struct ListHead bcc_list
Definition: compose.c:114
calc_header_width_padding
static void calc_header_width_padding(int idx, const char *header, bool calc_max)
Calculate the width needed for the compose labels.
Definition: compose.c:283
mutt_edit_headers
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:170
attach_format_str
const char * attach_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Format a string for the attachment menu - Implements format_t.
Definition: recvattach.c:217
mutt_str_equal
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
autocrypt_compose_menu
static void autocrypt_compose_menu(struct Email *e, const struct ConfigSubset *sub)
Autocrypt compose settings.
Definition: compose.c:352
draw_header_content
static void draw_header_content(struct MuttWindow *win, int row, enum HeaderField field, const char *content)
Draw content on a separate line aligned to header prompt.
Definition: compose.c:426
MUTT_ALIAS
#define MUTT_ALIAS
Do alias "completion" by calling up the alias-menu.
Definition: mutt.h:57
Envelope::reply_to
struct AddressList reply_to
Email's 'reply-to'.
Definition: envelope.h:62
Menu::redraw_data
void * redraw_data
Definition: mutt_menu.h:124
MUTT_FILE
#define MUTT_FILE
Do file completion.
Definition: mutt.h:58
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
calc_envelope
static int calc_envelope(struct ComposeRedrawData *rd)
Calculate how many rows the envelope will need.
Definition: compose.c:528
EventHeader
An event that happened to a header.
Definition: email.h:167
MUTT_FORMAT_STAT_FILE
#define MUTT_FORMAT_STAT_FILE
Used by attach_format_str.
Definition: format_flags.h:34
mutt_str_pretty_size
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1663
Envelope::cc
struct AddressList cc
Email's 'Cc' list.
Definition: envelope.h:59
query_quadoption
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
Definition: curs_lib.c:518
HDR_XCOMMENTTO
@ HDR_XCOMMENTTO
"X-Comment-To:" field
Definition: compose.c:167
mutt_menu_push_current
void mutt_menu_push_current(struct Menu *menu)
Add a new Menu to the stack.
Definition: menu.c:1015
mutt_body_new
struct Body * mutt_body_new(void)
Create a new Body.
Definition: body.c:43
mutt_buffer_pool_get
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
mutt_path_basename
const char * mutt_path_basename(const char *f)
Find the last component for a pathname.
Definition: path.c:329
MUTT_NNTP
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:52
HDR_AUTOCRYPT
@ HDR_AUTOCRYPT
"Autocrypt:" and "Recommendation:" fields
Definition: compose.c:162
MT_COLOR_COMPOSE_SECURITY_NONE
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition: color.h:68
nntp_path_probe
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe()
Definition: nntp.c:2685
NT_HEADER
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition: notify_type.h:41
mutt_edit_file
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
Definition: curs_lib.c:356
HDR_SUBJECT
@ HDR_SUBJECT
"Subject:" field
Definition: compose.c:153
Mailbox::type
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
menu_check_recenter
void menu_check_recenter(struct Menu *menu)
Recentre the menu on screen.
Definition: menu.c:544
mutt_paddstr
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1270
mutt_edit_content_type
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
Definition: commands.c:1324
MT_COLOR_COMPOSE_SECURITY_SIGN
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:69
HDR_FROM
@ HDR_FROM
"From:" field
Definition: compose.c:149
mutt_buffer_copy
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:445
MUTT_WIN_ORIENT_VERTICAL
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
Definition: mutt_window.h:35
mutt_make_file_attach
struct Body * mutt_make_file_attach(const char *path, struct ConfigSubset *sub)
Create a file attachment.
Definition: sendlib.c:1083
mutt_pipe_attachment_list
void mutt_pipe_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, bool filter)
Pipe a list of attachments to a command.
Definition: recvattach.c:1011
mutt_is_multipart_encrypted
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
Definition: crypt.c:449
AttachPtr::level
int level
Nesting depth of attachment.
Definition: attach.h:40
mx_mbox_close
enum MxStatus mx_mbox_close(struct Context **ptr)
Save changes and close mailbox.
Definition: mx.c:632
notify_observer_remove
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:207
OptAttachMsg
WHERE bool OptAttachMsg
(pseudo) used by attach-message
Definition: options.h:31
MENU_COMPOSE
@ MENU_COMPOSE
Compose an email.
Definition: keymap.h:76
OpStrings
const char * OpStrings[][2]
Definition: opcodes.c:28
APPLICATION_PGP
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:97
mutt_rfc3676_space_unstuff
void mutt_rfc3676_space_unstuff(struct Email *e)
Remove RFC3676 space stuffing.
Definition: rfc3676.c:492
ComposeRedrawData::autocrypt_rec
enum AutocryptRec autocrypt_rec
Definition: compose.c:122
REDRAW_FULL
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
ComposeRedrawData::cc_list
struct ListHead cc_list
Definition: compose.c:113
compose_attach_swap
static void compose_attach_swap(struct Body *msg, struct AttachPtr **idx, short first)
Swap two adjacent entries in the attachment list.
Definition: compose.c:1251
HDR_MIX
@ HDR_MIX
"Mix:" field (Mixmaster chain)
Definition: compose.c:157
calc_security
static int calc_security(struct Email *e, short *rows, const struct ConfigSubset *sub)
Calculate how many rows the security info will need.
Definition: compose.c:487
Mailbox::msg_count
int msg_count
Total number of messages.
Definition: mailbox.h:91
mutt_compose_attachment
int mutt_compose_attachment(struct Body *a)
Create an attachment.
Definition: mutt_attach.c:119
mutt_make_message_attach
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:937
mutt_clear_error
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
compose_status_line
static void compose_status_line(char *buf, size_t buflen, size_t col, int cols, struct Menu *menu, const char *p)
Compose the string for the status bar.
Definition: compose.c:1391
mutt_env_to_local
void mutt_env_to_local(struct Envelope *env)
Convert an Envelope's Address fields to local format.
Definition: envelope.c:271
mutt_addrlist_clear
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1468
mutt_window_find
struct MuttWindow * mutt_window_find(struct MuttWindow *root, enum WindowType type)
Find a Window of a given type.
Definition: mutt_window.c:678
MUTT_SEL_MULTI
#define MUTT_SEL_MULTI
Multi-selection is enabled.
Definition: browser.h:43
mutt_window_new
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
Definition: mutt_window.c:166
Body::description
char * description
content-description
Definition: body.h:40
NotifyCallback::global_data
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
Menu::pagelen
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:60
mutt_addrlist_parse2
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:616
Menu::tagprefix
bool tagprefix
Definition: mutt_menu.h:61
ComposeRedrawData::win_cbar
struct MuttWindow * win_cbar
Compose bar.
Definition: compose.c:128
draw_envelope_user_hdrs
static int draw_envelope_user_hdrs(const struct ComposeRedrawData *rd, int row)
Write user-defined headers to the compose window.
Definition: compose.c:936
MUTT_NOTMUCH
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:54
MUTT_IMAP
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:53
HDR_FOLLOWUPTO
@ HDR_FOLLOWUPTO
"Followup-To:" field
Definition: compose.c:166
Envelope::to
struct AddressList to
Email's 'To' list.
Definition: envelope.h:58
Body::parts
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
AttachPtr::body
struct Body * body
Attachment.
Definition: attach.h:36
Context::mailbox
struct Mailbox * mailbox
Definition: context.h:50
update_idx
static void update_idx(struct Menu *menu, struct AttachCtx *actx, struct AttachPtr *ap)
Add a new attchment to the message.
Definition: compose.c:1188
compose_format_str
static const char * compose_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Create the status bar string for compose mode - Implements format_t.
Definition: compose.c:1333
Email::env
struct Envelope * env
Envelope information.
Definition: email.h:90
Content::ascii
long ascii
Number of ascii chars.
Definition: content.h:39
compose_config_observer
static int compose_config_observer(struct NotifyCallback *nc)
Listen for config changes affecting the Compose menu - Implements observer_t.
Definition: compose.c:1401
mutt_debug
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
MUTT_WIN_SIZE_UNLIMITED
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:49
MUTT_NO
@ MUTT_NO
User answered 'No', or assume 'No'.
Definition: quad.h:39
Menu::tag
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:107
notify_observer_add
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:169
NT_HEADER_REMOVE
@ NT_HEADER_REMOVE
A header is about to be removed.
Definition: email.h:161
mutt_update_tree
void mutt_update_tree(struct AttachCtx *actx)
Refresh the list of attachments.
Definition: recvattach.c:151
mutt_buffer_expand_path
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:323
REDRAW_INDEX
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
nntp_select_server
struct NntpAccountData * nntp_select_server(struct Mailbox *m, const char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition: newsrc.c:1012
mutt_buffer_get_field
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: curs_lib.c:260
mutt_str_len
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:631
mutt_buffer_string
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
CurrentNewsSrv
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:79
WindowState::rows
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
MuttWindow::parent
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:128
Email::chain
struct ListHead chain
Mixmaster chain.
Definition: email.h:102
Email::security
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:39
pop_path_probe
enum MailboxType pop_path_probe(const char *path, const struct stat *st)
Is this a POP Mailbox? - Implements MxOps::path_probe()
Definition: pop.c:1149
EventConfig
A config-change event.
Definition: subset.h:70
cs_subset_quad
enum QuadOption cs_subset_quad(const struct ConfigSubset *sub, const char *name)
Get a quad-value config item by name.
Definition: helpers.c:154
MuttWindow::help_data
const struct Mapping * help_data
Data for the Help Bar.
Definition: mutt_window.h:135
mutt_str_replace
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:446
NotifyCallback::event_data
void * event_data
Data from notify_send()
Definition: observer.h:44
MUTT_FORMAT_OPTIONAL
#define MUTT_FORMAT_OPTIONAL
Allow optional field processing.
Definition: format_flags.h:33
cs_subset_sort
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:219
WithCrypto
#define WithCrypto
Definition: lib.h:123
draw_header
static void draw_header(struct MuttWindow *win, int row, enum HeaderField field)
Draw an aligned label.
Definition: compose.c:410
NT_HEADER_ADD
@ NT_HEADER_ADD
A new header has been added.
Definition: email.h:159
mutt_menu_loop
int mutt_menu_loop(struct Menu *menu)
Menu event loop.
Definition: menu.c:1309
MuttWindow::state
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:120
Envelope::newsgroups
char * newsgroups
List of newsgroups.
Definition: envelope.h:75
mutt_edit_attachment
int mutt_edit_attachment(struct Body *a)
Edit an attachment.
Definition: mutt_attach.c:259
ComposeHelp
static const struct Mapping ComposeHelp[]
Help Bar for the Compose dialog.
Definition: compose.c:219
mutt_menu_pop_current
void mutt_menu_pop_current(struct Menu *menu)
Remove a Menu from the stack.
Definition: menu.c:1027
WT_INDEX
@ WT_INDEX
An Index Window containing a selection list.
Definition: mutt_window.h:94
menu_redraw_motion
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: menu.c:434
ComposeRedrawData
Keep track when the compose screen needs redrawing.
Definition: compose.c:107
crypt_forget_passphrase
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition: crypt.c:93
MuttWindow::req_rows
short req_rows
Number of rows required.
Definition: mutt_window.h:118
STAILQ_HEAD_INITIALIZER
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:321
cs_subset_string
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:241
ENCODING
#define ENCODING(x)
Definition: mime.h:92
Mailbox::readonly
bool readonly
Don't allow changes to the mailbox.
Definition: mailbox.h:119
ALTS_TAG
#define ALTS_TAG
MT_COLOR_COMPOSE_SECURITY_ENCRYPT
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition: color.h:67
Envelope::userhdrs
struct ListHead userhdrs
user defined headers
Definition: envelope.h:83
Envelope::from
struct AddressList from
Email's 'From' list.
Definition: envelope.h:57
HDR_NEWSGROUPS
@ HDR_NEWSGROUPS
"Newsgroups:" field
Definition: compose.c:165
init_header_padding
static void init_header_padding(void)
Calculate how much padding the compose table will need.
Definition: compose.c:302
cum_attachs_size
static unsigned long cum_attachs_size(struct Menu *menu)
Cumulative Attachments Size.
Definition: compose.c:1285
Content::crlf
long crlf
\r and \n characters
Definition: content.h:38
Body::stamp
time_t stamp
Time stamp of last encoding update.
Definition: body.h:61
Menu::mdata
void * mdata
Extra data for the current menu.
Definition: mutt_menu.h:55
Body::aptr
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition: body.h:57
Menu::tagged
int tagged
Number of tagged entries.
Definition: mutt_menu.h:78
mutt_expando_format
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:774
calc_address
static int calc_address(struct AddressList *al, struct ListHead *slist, short cols, short *srows)
Calculate how many rows an AddressList will need.
Definition: compose.c:443
ENC_BASE64
@ ENC_BASE64
Base-64 encoded text.
Definition: mime.h:52
Menu::custom_redraw
void(* custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:122
WT_INDEX_BAR
@ WT_INDEX_BAR
Index Bar containing status info about the Index.
Definition: mutt_window.h:95
Menu::max
int max
Number of entries in the menu.
Definition: mutt_menu.h:57
ShortHostname
WHERE char * ShortHostname
Short version of the hostname.
Definition: mutt_globals.h:50
ComposeRedrawData::sub
struct ConfigSubset * sub
Inherited config items.
Definition: compose.c:130
ComposeRedrawData::fcc
struct Buffer * fcc
Definition: compose.c:110
EventConfig::sub
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:72
edit_address_list
static bool edit_address_list(int field, struct AddressList *al)
Let the user edit the address list.
Definition: compose.c:1040
EventConfig::name
const char * name
Name of config item that changed.
Definition: subset.h:73
MUTT_COMPOSE_NOFREEHEADER
#define MUTT_COMPOSE_NOFREEHEADER
Definition: lib.h:43
NeoMutt
Container for Accounts, Notifications.
Definition: neomutt.h:36
DISP_INLINE
@ DISP_INLINE
Content is inline.
Definition: mime.h:62
SEC_INLINE
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:92
crypt_opportunistic_encrypt
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
Definition: crypt.c:1024
LINGUAL_TAG
#define LINGUAL_TAG
AttachCtx::email
struct Email * email
Used by recvattach for updating.
Definition: attach.h:51
AutocryptRecUiFlags
static const char * AutocryptRecUiFlags[]
Definition: compose.c:253
Content
Info about an attachment.
Definition: content.h:33
Body::type
unsigned int type
content-type primary type, ContentType
Definition: body.h:65
ENC_OTHER
@ ENC_OTHER
Encoding unknown.
Definition: mime.h:48
header_free
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:237
mx_mbox_open
struct Context * mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:309
TYPE_OTHER
@ TYPE_OTHER
Unknown Content-Type.
Definition: mime.h:31
mutt_file_rename
int mutt_file_rename(const char *oldfile, const char *newfile)
Rename a file.
Definition: file.c:1347
mutt_attach_display_loop
int mutt_attach_display_loop(struct Menu *menu, int op, struct Email *e, struct AttachCtx *actx, bool recv)
Event loop for the Attachment menu.
Definition: recvattach.c:1285
mutt_curses_set_color
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:57
Menu::redraw
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:58
imap_path_probe
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe()
Definition: imap.c:2372
AttachPtr::tree
char * tree
Tree characters to display.
Definition: attach.h:39
mutt_actx_free
void mutt_actx_free(struct AttachCtx **ptr)
Free an Attachment Context.
Definition: attach.c:140
AttachCtx::v2r
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:58
compose_header_observer
static int compose_header_observer(struct NotifyCallback *nc)
Listen for header changes - Implements observer_t.
Definition: compose.c:1433
mutt_update_compose_menu
static void mutt_update_compose_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Redraw the compose window.
Definition: compose.c:1159
REDRAW_CURRENT
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:43
ListNode::data
char * data
String.
Definition: list.h:36
MUTT_WIN_SIZE_FIXED
@ MUTT_WIN_SIZE_FIXED
Window has a fixed size.
Definition: mutt_window.h:44
MUTT_CLEAR
#define MUTT_CLEAR
Clear input if printable character is pressed.
Definition: mutt.h:62
mutt_refresh
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:108
AttachCtx::idx
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
ComposeRedrawData::sec_rows
short sec_rows
Definition: compose.c:119
Prompts
static const char *const Prompts[]
Definition: compose.c:176
HDR_CRYPT
@ HDR_CRYPT
"Security:" field (encryption/signing info)
Definition: compose.c:159
mutt_get_tmp_attachment
int mutt_get_tmp_attachment(struct Body *a)
Get a temporary copy of an attachment.
Definition: mutt_attach.c:69
mutt_is_text_part
bool mutt_is_text_part(struct Body *b)
Is this part of an email in plain text?
Definition: muttlib.c:433
mutt_window_mvaddstr
int mutt_window_mvaddstr(struct MuttWindow *win, int col, int row, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:396
STAILQ_NEXT
#define STAILQ_NEXT(elm, field)
Definition: queue.h:397
OptNewsSend
WHERE bool OptNewsSend
(pseudo) used to change behavior when posting
Definition: options.h:46
mutt_addrlist_to_local
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
Definition: address.c:1386
mutt_get_field
int mutt_get_field(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles)
Ask the user for a string.
Definition: curs_lib.c:311
Body::email
struct Email * email
header information for message/rfc822
Definition: body.h:55
mutt_rfc3676_space_stuff
void mutt_rfc3676_space_stuff(struct Email *e)
Perform RFC3676 space stuffing on an Email.
Definition: rfc3676.c:479
WindowState::cols
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
menu_redraw_full
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: menu.c:348
Body::unlink
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
Definition: body.h:69
mailbox_path
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:206
mutt_buffer_enter_fname
int mutt_buffer_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:772
AttachPtr::parent_type
int parent_type
Type of parent attachment, e.g. TYPE_MULTIPART.
Definition: attach.h:38
NotifyCallback::event_subtype
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
Menu::current
int current
Current entry.
Definition: mutt_menu.h:56
mx_fastclose_mailbox
void mx_fastclose_mailbox(struct Mailbox *m)
free up memory associated with the Mailbox
Definition: mx.c:451
TAILQ_INSERT_HEAD
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:789
NotifyCallback::event_type
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
mutt_addrlist_write_list
size_t mutt_addrlist_write_list(const struct AddressList *al, struct ListHead *list)
Write Addresses to a List.
Definition: address.c:1201
mutt_window_add_child
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:565
Body::parameter
struct ParameterList parameter
parameters of the content-type
Definition: body.h:39
REDRAW_NO_FLAGS
#define REDRAW_NO_FLAGS
No flags are set.
Definition: mutt_menu.h:39
mutt_autocrypt_ui_recommendation
enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Mailbox *m, struct Email *e, char **keylist)
Get the recommended action for an Email.
Definition: autocrypt.c:561
ConfigSubset
A set of inherited config items.
Definition: subset.h:46
mutt_window_addstr
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:522
MuttWindow::children
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:129
mutt_yesorno
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:380
Buffer::data
char * data
Pointer to data.
Definition: buffer.h:35
TYPE_MULTIPART
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition: mime.h:37
Email
The envelope/body of an email.
Definition: email.h:37
mutt_attach_init
void mutt_attach_init(struct AttachCtx *actx)
Create a new Attachment context.
Definition: recvattach.c:1469
MT_COLOR_COMPOSE_SECURITY_BOTH
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition: color.h:66
mutt_save_attachment_list
void mutt_save_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, struct Email *e, struct Menu *menu)
Save a list of attachments.
Definition: recvattach.c:724
mutt_actx_add_attach
void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach)
Add an Attachment to an Attachment Context.
Definition: attach.c:40
REDRAW_MOTION
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:41
mutt_message
#define mutt_message(...)
Definition: logging.h:83
mutt_print_attachment_list
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top)
Print a list of Attachments.
Definition: recvattach.c:1166
mutt_buffer_printf
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
mutt_make_version
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1462
Menu::win_index
struct MuttWindow * win_index
Definition: mutt_menu.h:63
redraw_crypt_lines
static int redraw_crypt_lines(struct ComposeRedrawData *rd, int row)
Update the encryption info in the compose window.
Definition: compose.c:568
HeaderPadding
static int HeaderPadding[HDR_ATTACH_TITLE]
Definition: compose.c:173
mutt_warning
#define mutt_warning(...)
Definition: logging.h:82
mutt_buffer_make
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
mutt_list_free
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
Menu
GUI selectable list of items.
Definition: mutt_menu.h:52
AttachPtr::unowned
bool unowned
Don't unlink on detach.
Definition: attach.h:42
ComposeRedrawData::to_rows
short to_rows
Definition: compose.c:116
N_
#define N_(a)
Definition: message.h:32
dlg_select_mixmaster_chain
void dlg_select_mixmaster_chain(struct MuttWindow *win, struct ListHead *chainhead, int cols)
Create a Mixmaster chain.
Definition: remailer.c:574
HDR_CUSTOM_HEADERS
@ HDR_CUSTOM_HEADERS
"Headers:" field
Definition: compose.c:169
mutt_buffer_strcpy
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:312
index_pager_shutdown
void index_pager_shutdown(struct MuttWindow *dlg)
Clear up any non-Window parts.
Definition: index.c:4205
REDRAW_FLOW
#define REDRAW_FLOW
Used by pager to reflow text.
Definition: mutt_menu.h:47
HDR_BCC
@ HDR_BCC
"Bcc:" field
Definition: compose.c:152
REDRAW_STATUS
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
AttachCtx::idxlen
short idxlen
Number of attachmentes.
Definition: attach.h:55
mutt_get_content_info
struct Content * mutt_get_content_info(const char *fname, struct Body *b, struct ConfigSubset *sub)
Analyze file to determine MIME encoding to use.
Definition: sendlib.c:467
SEC_AUTOCRYPT
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:94
ComposeRedrawData::bcc_rows
short bcc_rows
Definition: compose.c:118
crypt_pgp_send_menu
SecurityFlags crypt_pgp_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu()
Definition: cryptglue.c:385
calc_user_hdrs
static int calc_user_hdrs(const struct ListHead *hdrs)
Calculate how many rows are needed for user-defined headers.
Definition: compose.c:510
Body::filename
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:46
Email::body
struct Body * body
List of MIME parts.
Definition: email.h:91
mutt_index_menu
int mutt_index_menu(struct MuttWindow *dlg)
Display a list of emails.
Definition: index.c:1160
OptNews
WHERE bool OptNews
(pseudo) used to change reader mode
Definition: options.h:45
mutt_menu_free
void mutt_menu_free(struct Menu **ptr)
Destroy a menu.
Definition: menu.c:972
idx
size_t idx
Definition: mailbox.c:234
mutt_window_free
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:186
MIN
#define MIN(a, b)
Definition: memory.h:31
mutt_error
#define mutt_error(...)
Definition: logging.h:84
mutt_window_reflow
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:433
mutt_str_copy
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:716
MUTT_COMP_NO_FLAGS
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:56