NeoMutt  2020-06-26-30-g76c339
Teaching an old dog new tricks
DOXYGEN
compose.c File Reference

GUI editor for an email's headers. More...

#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 "compose.h"
#include "browser.h"
#include "commands.h"
#include "context.h"
#include "edit.h"
#include "format_flags.h"
#include "globals.h"
#include "hook.h"
#include "index.h"
#include "init.h"
#include "keymap.h"
#include "mutt_attach.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 "sendlib.h"
#include "sort.h"
#include "ncrypt/lib.h"
#include <libintl.h>
#include "remailer.h"
#include "nntp/lib.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 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_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 (char *buf, size_t buflen, struct Menu *menu, int line)
 Format a menu item for the attachment list - Implements Menu::make_entry() More...
 
static void autocrypt_compose_menu (struct Email *e)
 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 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)
 Calculate how many rows the security info will need. 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)
 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 void draw_envelope (struct ComposeRedrawData *rd)
 Write the email headers to the compose window. More...
 
static void 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 mutt_dlg_compose_observer (struct NotifyCallback *nc)
 Listen for config changes affecting the Compose menu - Implements observer_t. More...
 
int mutt_compose_menu (struct Email *e, struct Buffer *fcc, struct Email *e_cur, int flags)
 Allow the user to edit the message envelope. More...
 

Variables

char * C_ComposeFormat
 Config: printf-like format string for the Compose panel's status bar. More...
 
char * C_Ispell
 Config: External command to perform spell-checking. More...
 
unsigned char C_Postpone
 Config: Save messages to the C_Postponed folder. More...
 
static const char * There_are_no_attachments = N_("There are no attachments")
 
int HeaderPadding [HDR_ATTACH_TITLE] = { 0 }
 
int MaxHeaderWidth = 0
 
static const char *const Prompts []
 
static const struct Mapping ComposeHelp []
 
static struct Mapping ComposeNewsHelp []
 
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.

◆ CHECK_COUNT

#define CHECK_COUNT
Value:
if (actx->idxlen == 0) \
{ \
mutt_error(_(There_are_no_attachments)); \
break; \
}
static const char * There_are_no_attachments
Definition: compose.c:101
#define _(a)
Definition: message.h:28

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_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
170 };
"To:" field
Definition: compose.c:150
"Cc:" field
Definition: compose.c:151
"Subject:" field
Definition: compose.c:153
"Sign as:" field (encryption/signing info)
Definition: compose.c:160
"From:" field
Definition: compose.c:149
"Autocrypt:" and "Recommendation:" fields
Definition: compose.c:162
The "-- Attachments" line.
Definition: compose.c:169
"X-Comment-To:" field
Definition: compose.c:167
"Security:" field (encryption/signing info)
Definition: compose.c:159
"Bcc:" field
Definition: compose.c:152
"Followup-To:" field
Definition: compose.c:166
"Mix:" field (Mixmaster chain)
Definition: compose.c:157
"Newsgroups:" field
Definition: compose.c:165
"Fcc:" (save folder) field
Definition: compose.c:155
"Reply-To:" field
Definition: compose.c:154

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 1265 of file compose.c.

1267 {
1268  mutt_expando_format(buf, buflen, col, cols, src, compose_format_str,
1269  (intptr_t) menu, MUTT_FORMAT_NO_FLAGS);
1270 }
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: format_flags.h:30
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:862
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:1207
+ 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 275 of file compose.c.

276 {
277  int width;
278 
279  HeaderPadding[idx] = mutt_str_len(header);
280  width = mutt_strwidth(header);
281  if (calc_max && (MaxHeaderWidth < width))
282  MaxHeaderWidth = width;
283  HeaderPadding[idx] -= width;
284 }
int MaxHeaderWidth
Definition: compose.c:173
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1338
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:639
int HeaderPadding[HDR_ATTACH_TITLE]
Definition: compose.c:172
+ 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 294 of file compose.c.

295 {
296  static bool done = false;
297 
298  if (done)
299  return;
300  done = true;
301 
302  for (int i = 0; i < HDR_ATTACH_TITLE; i++)
303  {
304  if (i == HDR_CRYPTINFO)
305  continue;
306  calc_header_width_padding(i, _(Prompts[i]), true);
307  }
308 
309  /* Don't include "Sign as: " in the MaxHeaderWidth calculation. It
310  * doesn't show up by default, and so can make the indentation of
311  * the other fields look funny. */
313 
314  for (int i = 0; i < HDR_ATTACH_TITLE; i++)
315  {
317  if (HeaderPadding[i] < 0)
318  HeaderPadding[i] = 0;
319  }
320 }
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:275
int MaxHeaderWidth
Definition: compose.c:173
#define _(a)
Definition: message.h:28
"Sign as:" field (encryption/signing info)
Definition: compose.c:160
The "-- Attachments" line.
Definition: compose.c:169
static const char *const Prompts[]
Definition: compose.c:175
int HeaderPadding[HDR_ATTACH_TITLE]
Definition: compose.c:172
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ snd_make_entry()

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

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

Definition at line 325 of file compose.c.

326 {
327  struct AttachCtx *actx = menu->mdata;
328 
329  mutt_expando_format(buf, buflen, 0, menu->win_index->state.cols, NONULL(C_AttachFormat),
330  attach_format_str, (intptr_t)(actx->idx[actx->v2r[line]]),
332 }
#define NONULL(x)
Definition: string2.h:37
WHERE char * C_AttachFormat
Config: printf-like format string for the attachment menu.
Definition: globals.h:99
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
#define MUTT_FORMAT_STAT_FILE
Used by attach_format_str.
Definition: format_flags.h:34
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:862
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:113
void * mdata
Extra data for the current menu.
Definition: mutt_menu.h:84
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:58
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:208
int const char int line
Definition: acutest.h:617
struct MuttWindow * win_index
Definition: mutt_menu.h:92
A set of attachments.
Definition: attach.h:49
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
+ 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)
static

Autocrypt compose settings.

Parameters
eEmail

Definition at line 339 of file compose.c.

340 {
341  /* L10N: The compose menu autocrypt prompt.
342  (e)ncrypt enables encryption via autocrypt.
343  (c)lear sets cleartext.
344  (a)utomatic defers to the recommendation. */
345  const char *prompt = _("Autocrypt: (e)ncrypt, (c)lear, (a)utomatic?");
346 
348 
349  /* L10N: The letter corresponding to the compose menu autocrypt prompt
350  (e)ncrypt, (c)lear, (a)utomatic */
351  const char *letters = _("eca");
352 
353  int choice = mutt_multi_choice(prompt, letters);
354  switch (choice)
355  {
356  case 1:
359  break;
360  case 2:
361  e->security &= ~SEC_AUTOCRYPT;
363  break;
364  case 3:
367  e->security |= SEC_OPPENCRYPT;
368  break;
369  }
370 }
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:125
#define _(a)
Definition: message.h:28
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:134
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:132
int mutt_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question.
Definition: curs_lib.c:912
WHERE bool C_CryptOpportunisticEncrypt
Config: Enable encryption when the recipient&#39;s key is available.
Definition: globals.h:263
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:137
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
Definition: lib.h:135
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
Definition: lib.h:133
#define SEC_SIGN
Email is signed.
Definition: lib.h:126
+ 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 380 of file compose.c.

381 {
383  mutt_window_mvprintw(win, col, row, "%s", text);
385 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
Plain text.
Definition: color.h:77
Header labels, e.g. From:
Definition: color.h:65
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:398
+ 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 393 of file compose.c.

394 {
396  mutt_window_mvprintw(win, 0, row, "%*s", HeaderPadding[field], _(Prompts[field]));
398 }
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
#define _(a)
Definition: message.h:28
Plain text.
Definition: color.h:77
Header labels, e.g. From:
Definition: color.h:65
static const char *const Prompts[]
Definition: compose.c:175
int HeaderPadding[HDR_ATTACH_TITLE]
Definition: compose.c:172
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:398
+ 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 410 of file compose.c.

412 {
413  mutt_list_free(slist);
414  mutt_addrlist_write_list(al, slist);
415 
416  int rows = 1;
417  int addr_len;
418  int width_left = cols;
419  struct ListNode *next = NULL;
420  struct ListNode *np = NULL;
421  STAILQ_FOREACH(np, slist, entries)
422  {
423  next = STAILQ_NEXT(np, entries);
424  addr_len = mutt_strwidth(np->data);
425  if (next)
426  addr_len += 2; // ", "
427 
428  try_again:
429  if (addr_len >= width_left)
430  {
431  if (width_left == cols)
432  break;
433 
434  rows++;
435  width_left = cols;
436  goto try_again;
437  }
438 
439  if (addr_len < width_left)
440  width_left -= addr_len;
441  }
442 
443  *srows = MIN(rows, MAX_ADDR_ROWS);
444  return *srows;
445 }
#define MIN(a, b)
Definition: memory.h:31
#define MAX_ADDR_ROWS
Maximum number of rows to use for the To:, Cc:, Bcc: fields.
Definition: compose.c:94
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1338
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
#define STAILQ_NEXT(elm, field)
Definition: queue.h:397
size_t mutt_addrlist_write_list(const struct AddressList *al, struct ListHead *list)
Write Addresses to a List.
Definition: address.c:1198
char * data
String.
Definition: list.h:36
A List node for strings.
Definition: list.h:34
+ 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 
)
static

Calculate how many rows the security info will need.

Parameters
eEmail
rowsRows needed
Return values
numRows needed

Definition at line 453 of file compose.c.

454 {
456  *rows = 0; // Neither PGP nor SMIME are built into NeoMutt
457  else if ((e->security & (SEC_ENCRYPT | SEC_SIGN)) != 0)
458  *rows = 2; // 'Security:' and 'Sign as:'
459  else
460  *rows = 1; // Just 'Security:'
461 
462 #ifdef USE_AUTOCRYPT
463  if (C_Autocrypt)
464  *rows += 1;
465 #endif
466 
467  return *rows;
468 }
WHERE bool C_Autocrypt
Config: Enables the Autocrypt feature.
Definition: globals.h:195
#define WithCrypto
Definition: lib.h:163
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:125
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:138
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:137
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
#define SEC_SIGN
Email is signed.
Definition: lib.h:126
+ 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 475 of file compose.c.

476 {
477  int rows = 4; // 'From:', 'Subject:', 'Reply-To:', 'Fcc:'
478 #ifdef MIXMASTER
479  rows++;
480 #endif
481 
482  struct Email *e = rd->email;
483  struct Envelope *env = e->env;
484  const int cols = rd->win_envelope->state.cols - MaxHeaderWidth;
485 
486 #ifdef USE_NNTP
487  if (OptNewsSend)
488  {
489  rows += 2; // 'Newsgroups:' and 'Followup-To:'
490  if (C_XCommentTo)
491  rows++;
492  }
493  else
494 #endif
495  {
496  rows += calc_address(&env->to, &rd->to_list, cols, &rd->to_rows);
497  rows += calc_address(&env->cc, &rd->cc_list, cols, &rd->cc_rows);
498  rows += calc_address(&env->bcc, &rd->bcc_list, cols, &rd->bcc_rows);
499  }
500  rows += calc_security(e, &rd->sec_rows);
501 
502  return rows;
503 }
The envelope/body of an email.
Definition: email.h:37
struct AddressList bcc
Email&#39;s &#39;Bcc&#39; list.
Definition: envelope.h:60
int MaxHeaderWidth
Definition: compose.c:173
struct ListHead bcc_list
Definition: compose.c:116
struct Email * email
Definition: compose.c:111
static int calc_security(struct Email *e, short *rows)
Calculate how many rows the security info will need.
Definition: compose.c:453
struct MuttWindow * win_envelope
Envelope: From, To, etc.
Definition: compose.c:127
struct Envelope * env
Envelope information.
Definition: email.h:89
struct AddressList cc
Email&#39;s &#39;Cc&#39; list.
Definition: envelope.h:59
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:113
WHERE bool C_XCommentTo
Config: (nntp) Add &#39;X-Comment-To&#39; header that contains article author.
Definition: globals.h:278
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:410
struct ListHead cc_list
Definition: compose.c:115
struct AddressList to
Email&#39;s &#39;To&#39; list.
Definition: envelope.h:58
struct ListHead to_list
Definition: compose.c:114
WHERE bool OptNewsSend
(pseudo) used to change behavior when posting
Definition: options.h:46
The header of an Email.
Definition: envelope.h:54
+ 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 510 of file compose.c.

511 {
512  struct Email *e = rd->email;
513 
514  draw_header(rd->win_envelope, row++, HDR_CRYPT);
515 
517  return 0;
518 
519  // We'll probably need two lines for 'Security:' and 'Sign as:'
520  int used = 2;
521  if ((e->security & (SEC_ENCRYPT | SEC_SIGN)) == (SEC_ENCRYPT | SEC_SIGN))
522  {
524  mutt_window_addstr(_("Sign, Encrypt"));
525  }
526  else if (e->security & SEC_ENCRYPT)
527  {
529  mutt_window_addstr(_("Encrypt"));
530  }
531  else if (e->security & SEC_SIGN)
532  {
534  mutt_window_addstr(_("Sign"));
535  }
536  else
537  {
538  /* L10N: This refers to the encryption of the email, e.g. "Security: None" */
540  mutt_window_addstr(_("None"));
541  used = 1; // 'Sign as:' won't be needed
542  }
544 
545  if ((e->security & (SEC_ENCRYPT | SEC_SIGN)))
546  {
547  if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & APPLICATION_PGP))
548  {
549  if ((e->security & SEC_INLINE))
550  mutt_window_addstr(_(" (inline PGP)"));
551  else
552  mutt_window_addstr(_(" (PGP/MIME)"));
553  }
554  else if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME))
555  mutt_window_addstr(_(" (S/MIME)"));
556  }
557 
559  mutt_window_addstr(_(" (OppEnc mode)"));
560 
562 
563  if (((WithCrypto & APPLICATION_PGP) != 0) &&
564  (e->security & APPLICATION_PGP) && (e->security & SEC_SIGN))
565  {
567  mutt_window_printf("%s", C_PgpSignAs ? C_PgpSignAs : _("<default>"));
568  }
569 
570  if (((WithCrypto & APPLICATION_SMIME) != 0) &&
571  (e->security & APPLICATION_SMIME) && (e->security & SEC_SIGN))
572  {
574  mutt_window_printf("%s", C_SmimeSignAs ? C_SmimeSignAs : _("<default>"));
575  }
576 
577  if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME) &&
579  {
580  draw_floating(rd->win_envelope, 40, row - 1, _("Encrypt with: "));
582  }
583 
584 #ifdef USE_AUTOCRYPT
585  if (C_Autocrypt)
586  {
588  if (e->security & SEC_AUTOCRYPT)
589  {
591  mutt_window_addstr(_("Encrypt"));
592  }
593  else
594  {
596  mutt_window_addstr(_("Off"));
597  }
598 
599  /* L10N: The autocrypt compose menu Recommendation field.
600  Displays the output of the recommendation engine
601  (Off, No, Discouraged, Available, Yes) */
602  draw_floating(rd->win_envelope, 40, row, _("Recommendation: "));
604 
605  used++;
606  }
607 #endif
608  return used;
609 }
Mail will be encrypted.
Definition: color.h:67
#define NONULL(x)
Definition: string2.h:37
WHERE bool C_Autocrypt
Config: Enables the Autocrypt feature.
Definition: globals.h:195
#define WithCrypto
Definition: lib.h:163
The envelope/body of an email.
Definition: email.h:37
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:125
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:212
#define _(a)
Definition: message.h:28
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:134
struct Email * email
Definition: compose.c:111
"Sign as:" field (encryption/signing info)
Definition: compose.c:160
static void draw_floating(struct MuttWindow *win, int col, int row, const char *text)
Draw a floating label.
Definition: compose.c:380
"Autocrypt:" and "Recommendation:" fields
Definition: compose.c:162
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:132
enum AutocryptRec autocrypt_rec
Definition: compose.c:124
struct MuttWindow * win_envelope
Envelope: From, To, etc.
Definition: compose.c:127
Plain text.
Definition: color.h:77
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:138
WHERE bool C_CryptOpportunisticEncrypt
Config: Enable encryption when the recipient&#39;s key is available.
Definition: globals.h:263
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:137
WHERE char * C_SmimeEncryptWith
Config: Algorithm for encryption.
Definition: globals.h:161
Mail will be signed.
Definition: color.h:69
"Security:" field (encryption/signing info)
Definition: compose.c:159
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
Definition: lib.h:133
#define SEC_SIGN
Email is signed.
Definition: lib.h:126
Mail will be encrypted and signed.
Definition: color.h:66
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:549
static void draw_header(struct MuttWindow *win, int row, enum HeaderField field)
Draw an aligned label.
Definition: compose.c:393
Mail will not be encrypted or signed.
Definition: color.h:68
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:521
WHERE char * C_PgpSignAs
Config: Use this alternative key for signing messages.
Definition: globals.h:156
WHERE char * C_SmimeSignAs
Config: Use this alternative key for signing messages.
Definition: globals.h:160
static const char * AutocryptRecUiFlags[]
Definition: compose.c:245
+ 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 615 of file compose.c.

616 {
617  struct Email *e = rd->email;
618 
621 
622 #ifdef USE_AUTOCRYPT
623  if (C_Autocrypt)
624  {
626 
627  /* Anything that enables SEC_ENCRYPT or SEC_SIGN, or turns on SMIME
628  * overrides autocrypt, be it oppenc or the user having turned on
629  * those flags manually. */
632  else
633  {
634  if (!(e->security & SEC_AUTOCRYPT_OVERRIDE))
635  {
636  if (rd->autocrypt_rec == AUTOCRYPT_REC_YES)
637  {
640  }
641  else
642  e->security &= ~SEC_AUTOCRYPT;
643  }
644  }
645  }
646 #endif
647 }
WHERE bool C_Autocrypt
Config: Enables the Autocrypt feature.
Definition: globals.h:195
The envelope/body of an email.
Definition: email.h:37
Autocrypt should be used.
Definition: lib.h:158
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:125
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:134
struct Email * email
Definition: compose.c:111
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:132
enum AutocryptRec autocrypt_rec
Definition: compose.c:124
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:138
WHERE bool C_CryptOpportunisticEncrypt
Config: Enable encryption when the recipient&#39;s key is available.
Definition: globals.h:263
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:137
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
Definition: lib.h:135
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
#define SEC_SIGN
Email is signed.
Definition: lib.h:126
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
Definition: crypt.c:1031
enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Email *e, char **keylist)
Get the recommended action for an Email.
Definition: autocrypt.c:549
+ 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 656 of file compose.c.

657 {
658  char *t = NULL;
659 
660  draw_header(rd->win_envelope, row, HDR_MIX);
661 
662  if (STAILQ_EMPTY(chain))
663  {
664  mutt_window_addstr(_("<no chain defined>"));
666  return;
667  }
668 
669  int c = 12;
670  struct ListNode *np = NULL;
671  STAILQ_FOREACH(np, chain, entries)
672  {
673  t = np->data;
674  if (t && (t[0] == '0') && (t[1] == '\0'))
675  t = "<random>";
676 
677  if (c + mutt_str_len(t) + 2 >= rd->win_envelope->state.cols)
678  break;
679 
681  if (STAILQ_NEXT(np, entries))
682  mutt_window_addstr(", ");
683 
684  c += mutt_str_len(t) + 2;
685  }
686 }
#define NONULL(x)
Definition: string2.h:37
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:212
#define _(a)
Definition: message.h:28
struct MuttWindow * win_envelope
Envelope: From, To, etc.
Definition: compose.c:127
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct ListHead chain
Mixmaster chain.
Definition: email.h:99
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:113
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
#define STAILQ_NEXT(elm, field)
Definition: queue.h:397
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:639
char * data
String.
Definition: list.h:36
"Mix:" field (Mixmaster chain)
Definition: compose.c:157
static void draw_header(struct MuttWindow *win, int row, enum HeaderField field)
Draw an aligned label.
Definition: compose.c:393
#define STAILQ_EMPTY(head)
Definition: queue.h:345
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:521
A List node for strings.
Definition: list.h:34
+ 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)
static

Check if any attachments have changed or been deleted.

Parameters
actxAttachment context
Return values
0Success
-1Error

Definition at line 695 of file compose.c.

696 {
697  int rc = -1;
698  struct stat st;
699  struct Buffer *pretty = NULL, *msg = NULL;
700 
701  for (int i = 0; i < actx->idxlen; i++)
702  {
703  if (actx->idx[i]->content->type == TYPE_MULTIPART)
704  continue;
705  if (stat(actx->idx[i]->content->filename, &st) != 0)
706  {
707  if (!pretty)
708  pretty = mutt_buffer_pool_get();
709  mutt_buffer_strcpy(pretty, actx->idx[i]->content->filename);
711  /* L10N: This message is displayed in the compose menu when an attachment
712  doesn't stat. %d is the attachment number and %s is the attachment
713  filename. The filename is located last to avoid a long path hiding
714  the error message. */
715  mutt_error(_("Attachment #%d no longer exists: %s"), i + 1, mutt_b2s(pretty));
716  goto cleanup;
717  }
718 
719  if (actx->idx[i]->content->stamp < st.st_mtime)
720  {
721  if (!pretty)
722  pretty = mutt_buffer_pool_get();
723  mutt_buffer_strcpy(pretty, actx->idx[i]->content->filename);
725 
726  if (!msg)
727  msg = mutt_buffer_pool_get();
728  /* L10N: This message is displayed in the compose menu when an attachment
729  is modified behind the scenes. %d is the attachment number and %s is
730  the attachment filename. The filename is located last to avoid a long
731  path hiding the prompt question. */
732  mutt_buffer_printf(msg, _("Attachment #%d modified. Update encoding for %s?"),
733  i + 1, mutt_b2s(pretty));
734 
735  enum QuadOption ans = mutt_yesorno(mutt_b2s(msg), MUTT_YES);
736  if (ans == MUTT_YES)
737  mutt_update_encoding(actx->idx[i]->content);
738  else if (ans == MUTT_ABORT)
739  goto cleanup;
740  }
741  }
742 
743  rc = 0;
744 
745 cleanup:
746  mutt_buffer_pool_release(&pretty);
748  return rc;
749 }
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:46
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
User aborted the question (with Ctrl-G)
Definition: quad.h:38
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:40
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
String manipulation buffer.
Definition: buffer.h:33
#define _(a)
Definition: message.h:28
short idxlen
Number of attachmentes.
Definition: attach.h:55
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
void mutt_buffer_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:688
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:377
void mutt_update_encoding(struct Body *a)
Update the encoding type.
Definition: sendlib.c:1486
#define mutt_b2s(buf)
Definition: buffer.h:41
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:312
unsigned int type
content-type primary type, ContentType
Definition: body.h:65
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
struct Body * content
Attachment.
Definition: attach.h:36
time_t stamp
Time stamp of last encoding update.
Definition: body.h:61
#define mutt_error(...)
Definition: logging.h:84
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
QuadOption
Possible values for a quad-option.
Definition: quad.h:36
+ 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 759 of file compose.c.

761 {
762  draw_header(win, row, field);
763 
764  struct ListHead list = STAILQ_HEAD_INITIALIZER(list);
765  int count = mutt_addrlist_write_list(al, &list);
766 
767  int lines_used = 1;
768  int width_left = win->state.cols - MaxHeaderWidth;
769  char more[32];
770  int more_len = 0;
771 
772  char *sep = NULL;
773  struct ListNode *next = NULL;
774  struct ListNode *np = NULL;
775  STAILQ_FOREACH(np, &list, entries)
776  {
777  next = STAILQ_NEXT(np, entries);
778  int addr_len = mutt_strwidth(np->data);
779  if (next)
780  {
781  sep = ", ";
782  addr_len += 2;
783  }
784  else
785  {
786  sep = "";
787  }
788 
789  count--;
790  try_again:
791  more_len = snprintf(more, sizeof(more),
792  ngettext("(+%d more)", "(+%d more)", count), count);
793  mutt_debug(LL_DEBUG3, "text: '%s' len: %d\n", more, more_len);
794 
795  int reserve = ((count > 0) && (lines_used == max_lines)) ? more_len : 0;
796  mutt_debug(LL_DEBUG3, "processing: %s (al:%ld, wl:%d, r:%d, lu:%ld)\n",
797  np->data, addr_len, width_left, reserve, lines_used);
798  if (addr_len >= (width_left - reserve))
799  {
800  mutt_debug(LL_DEBUG3, "not enough space\n");
801  if (lines_used == max_lines)
802  {
803  mutt_debug(LL_DEBUG3, "no more lines\n");
804  mutt_debug(LL_DEBUG3, "truncating: %s\n", np->data);
805  mutt_paddstr(width_left, np->data);
806  break;
807  }
808 
809  if (width_left == (win->state.cols - MaxHeaderWidth))
810  {
811  mutt_debug(LL_DEBUG3, "couldn't print: %s\n", np->data);
812  mutt_paddstr(width_left, np->data);
813  break;
814  }
815 
816  mutt_debug(LL_DEBUG3, "start a new line\n");
818  row++;
819  lines_used++;
820  width_left = win->state.cols - MaxHeaderWidth;
821  mutt_window_move(win, MaxHeaderWidth, row);
822  goto try_again;
823  }
824 
825  if (addr_len < width_left)
826  {
827  mutt_debug(LL_DEBUG3, "space for: %s\n", np->data);
829  mutt_window_addstr(sep);
830  width_left -= addr_len;
831  }
832  mutt_debug(LL_DEBUG3, "%ld addresses remaining\n", count);
833  mutt_debug(LL_DEBUG3, "%ld lines remaining\n", max_lines - lines_used);
834  }
835  mutt_list_free(&list);
836 
837  if (count > 0)
838  {
839  mutt_window_move(win, win->state.cols - more_len, row);
841  mutt_window_addstr(more);
843  mutt_debug(LL_DEBUG3, "%ld more (len %d)\n", count, more_len);
844  }
845  else
846  {
848  }
849 
850  for (int i = lines_used; i < max_lines; i++)
851  {
852  mutt_window_move(win, 0, row + i);
854  }
855 
856  mutt_debug(LL_DEBUG3, "used %d lines\n", lines_used);
857  return lines_used;
858 }
Bold text.
Definition: color.h:64
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:212
int MaxHeaderWidth
Definition: compose.c:173
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1245
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:365
Plain text.
Definition: color.h:77
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:113
int mutt_strwidth(const char *s)
Measure a string&#39;s width in screen cells.
Definition: curs_lib.c:1338
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
#define STAILQ_NEXT(elm, field)
Definition: queue.h:397
size_t mutt_addrlist_write_list(const struct AddressList *al, struct ListHead *list)
Write Addresses to a List.
Definition: address.c:1198
char * data
String.
Definition: list.h:36
static void draw_header(struct MuttWindow *win, int row, enum HeaderField field)
Draw an aligned label.
Definition: compose.c:393
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:321
int mutt_window_addstr(const char *str)
Write a string to a Window.
Definition: mutt_window.c:521
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
A List node for strings.
Definition: list.h:34
Log at debug level 3.
Definition: logging.h:42
+ 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 864 of file compose.c.

865 {
866  struct Email *e = rd->email;
867  const char *fcc = mutt_b2s(rd->fcc);
868  const int cols = rd->win_envelope->state.cols - MaxHeaderWidth;
869 
870  int row = draw_envelope_addr(HDR_FROM, &e->env->from, rd->win_envelope, 0, 1);
871 
872 #ifdef USE_NNTP
873  if (OptNewsSend)
874  {
876  mutt_paddstr(cols, NONULL(e->env->newsgroups));
877 
879  mutt_paddstr(cols, NONULL(e->env->followup_to));
880 
881  if (C_XCommentTo)
882  {
884  mutt_paddstr(cols, NONULL(e->env->x_comment_to));
885  }
886  }
887  else
888 #endif
889  {
890  row += draw_envelope_addr(HDR_TO, &e->env->to, rd->win_envelope, row, rd->to_rows);
891  row += draw_envelope_addr(HDR_CC, &e->env->cc, rd->win_envelope, row, rd->cc_rows);
892  row += draw_envelope_addr(HDR_BCC, &e->env->bcc, rd->win_envelope, row, rd->bcc_rows);
893  }
894 
895  draw_header(rd->win_envelope, row++, HDR_SUBJECT);
896  mutt_paddstr(cols, NONULL(e->env->subject));
897 
898  row += draw_envelope_addr(HDR_REPLYTO, &e->env->reply_to, rd->win_envelope, row, 1);
899 
900  draw_header(rd->win_envelope, row++, HDR_FCC);
901  mutt_paddstr(cols, fcc);
902 
903  if (WithCrypto)
904  row += redraw_crypt_lines(rd, row);
905 
906 #ifdef MIXMASTER
907  redraw_mix_line(&e->chain, rd, row++);
908 #endif
909 
911  mutt_window_mvaddstr(rd->win_abar, 0, 0, _("-- Attachments"));
914 }
#define NONULL(x)
Definition: string2.h:37
#define WithCrypto
Definition: lib.h:163
The envelope/body of an email.
Definition: email.h:37
struct AddressList reply_to
Email&#39;s &#39;reply-to&#39;.
Definition: envelope.h:62
struct MuttWindow * win_abar
Attachments label.
Definition: compose.c:128
struct AddressList bcc
Email&#39;s &#39;Bcc&#39; list.
Definition: envelope.h:60
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
void mutt_window_clrtoeol(struct MuttWindow *win)
Clear to the end of the line.
Definition: mutt_window.c:212
"To:" field
Definition: compose.c:150
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:759
"Cc:" field
Definition: compose.c:151
int MaxHeaderWidth
Definition: compose.c:173
#define _(a)
Definition: message.h:28
static void redraw_mix_line(struct ListHead *chain, struct ComposeRedrawData *rd, int row)
Redraw the Mixmaster chain.
Definition: compose.c:656
struct Email * email
Definition: compose.c:111
struct Buffer * fcc
Definition: compose.c:112
"Subject:" field
Definition: compose.c:153
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:379
"From:" field
Definition: compose.c:149
void mutt_paddstr(int n, const char *s)
Display a string on screen, padded if necessary.
Definition: curs_lib.c:1245
struct AddressList from
Email&#39;s &#39;From&#39; list.
Definition: envelope.h:57
struct MuttWindow * win_envelope
Envelope: From, To, etc.
Definition: compose.c:127
struct Envelope * env
Envelope information.
Definition: email.h:89
struct AddressList cc
Email&#39;s &#39;Cc&#39; list.
Definition: envelope.h:59
"X-Comment-To:" field
Definition: compose.c:167
Plain text.
Definition: color.h:77
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
#define mutt_b2s(buf)
Definition: buffer.h:41
char * x_comment_to
List of &#39;X-comment-to&#39; fields.
Definition: envelope.h:78
struct ListHead chain
Mixmaster chain.
Definition: email.h:99
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:113
Status bar (takes a pattern)
Definition: color.h:94
"Bcc:" field
Definition: compose.c:152
"Followup-To:" field
Definition: compose.c:166
char * subject
Email&#39;s subject.
Definition: envelope.h:66
char * newsgroups
List of newsgroups.
Definition: envelope.h:75
WHERE bool C_XCommentTo
Config: (nntp) Add &#39;X-Comment-To&#39; header that contains article author.
Definition: globals.h:278
char * followup_to
List of &#39;followup-to&#39; fields.
Definition: envelope.h:77
static void draw_header(struct MuttWindow *win, int row, enum HeaderField field)
Draw an aligned label.
Definition: compose.c:393
struct AddressList to
Email&#39;s &#39;To&#39; list.
Definition: envelope.h:58
"Newsgroups:" field
Definition: compose.c:165
static int redraw_crypt_lines(struct ComposeRedrawData *rd, int row)
Update the encryption info in the compose window.
Definition: compose.c:510
WHERE bool OptNewsSend
(pseudo) used to change behavior when posting
Definition: options.h:46
"Fcc:" (save folder) field
Definition: compose.c:155
"Reply-To:" field
Definition: compose.c:154
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ edit_address_list()

static void 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

Definition at line 921 of file compose.c.

922 {
923  char buf[8192] = { 0 }; /* needs to be large for alias expansion */
924 
926  mutt_addrlist_write(al, buf, sizeof(buf), false);
927  if (mutt_get_field(_(Prompts[field]), buf, sizeof(buf), MUTT_ALIAS) == 0)
928  {
930  mutt_addrlist_parse2(al, buf);
932  }
933 
934  char *err = NULL;
935  if (mutt_addrlist_to_intl(al, &err) != 0)
936  {
937  mutt_error(_("Bad IDN: '%s'"), err);
938  mutt_refresh();
939  FREE(&err);
940  }
941 }
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
Definition: alias.c:295
#define MUTT_ALIAS
Do alias "completion" by calling up the alias-menu.
Definition: mutt.h:57
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
Definition: address.c:1332
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1414
#define _(a)
Definition: message.h:28
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:616
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:90
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:106
static const char *const Prompts[]
Definition: compose.c:175
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1250
#define mutt_error(...)
Definition: logging.h:84
#define FREE(x)
Definition: memory.h:40
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:1147
+ 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 950 of file compose.c.

951 {
952  struct AttachPtr **idx = actx->idx;
953  int rindex = actx->v2r[x];
954 
955  if ((rindex == 0) && (actx->idxlen == 1))
956  {
957  mutt_error(_("You may not delete the only attachment"));
958  idx[rindex]->content->tagged = false;
959  return -1;
960  }
961 
962  for (int y = 0; y < actx->idxlen; y++)
963  {
964  if (idx[y]->content->next == idx[rindex]->content)
965  {
966  idx[y]->content->next = idx[rindex]->content->next;
967  break;
968  }
969  }
970 
971  idx[rindex]->content->next = NULL;
972  /* mutt_make_message_attach() creates body->parts, shared by
973  * body->email->content. If we NULL out that, it creates a memory
974  * leak because mutt_free_body() frees body->parts, not
975  * body->email->content.
976  *
977  * Other mutt_send_message() message constructors are careful to free
978  * any body->parts, removing depth:
979  * - mutt_prepare_template() used by postponed, resent, and draft files
980  * - mutt_copy_body() used by the recvattach menu and $forward_attachments.
981  *
982  * I believe it is safe to completely remove the "content->parts =
983  * NULL" statement. But for safety, am doing so only for the case
984  * it must be avoided: message attachments.
985  */
986  if (!idx[rindex]->content->email)
987  idx[rindex]->content->parts = NULL;
988  mutt_body_free(&(idx[rindex]->content));
989  FREE(&idx[rindex]->tree);
990  FREE(&idx[rindex]);
991  for (; rindex < actx->idxlen - 1; rindex++)
992  idx[rindex] = idx[rindex + 1];
993  idx[actx->idxlen - 1] = NULL;
994  actx->idxlen--;
995 
996  return 0;
997 }
An email to which things will be attached.
Definition: attach.h:34
#define _(a)
Definition: message.h:28
struct Body * next
next attachment in the list
Definition: body.h:53
short idxlen
Number of attachmentes.
Definition: attach.h:55
char * tree
Tree characters to display.
Definition: attach.h:39
bool tagged
This attachment is tagged.
Definition: body.h:70
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:58
struct Body * content
Attachment.
Definition: attach.h:36
#define mutt_error(...)
Definition: logging.h:84
#define FREE(x)
Definition: memory.h:40
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition: body.c:57
struct Email * email
header information for message/rfc822
Definition: body.h:55
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
+ 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 1006 of file compose.c.

1008 {
1009  for (; m; m = m->next)
1010  {
1011  if ((m->type == TYPE_MULTIPART) && m->parts &&
1013  {
1015  }
1016  else
1017  {
1018  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1019  mutt_actx_add_attach(actx, ap);
1020  ap->content = m;
1021  m->aptr = ap;
1022  ap->parent_type = parent_type;
1023  ap->level = level;
1024 
1025  /* We don't support multipart messages in the compose menu yet */
1026  }
1027  }
1028 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
An email to which things will be attached.
Definition: attach.h:34
#define WithCrypto
Definition: lib.h:163
struct Body * next
next attachment in the list
Definition: body.h:53
void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach)
Add an Attachment to an Attachment Context.
Definition: attach.c:40
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:1006
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
Definition: crypt.c:457
int parent_type
Type of parent attachment, e.g. TYPE_MULTIPART.
Definition: attach.h:38
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:137
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition: body.h:57
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
unsigned int type
content-type primary type, ContentType
Definition: body.h:65
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
struct Body * content
Attachment.
Definition: attach.h:36
int level
Nesting depth of attachment.
Definition: attach.h:40
+ 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 1036 of file compose.c.

1037 {
1038  if (init)
1039  {
1040  mutt_gen_compose_attach_list(actx, actx->email->content, -1, 0);
1041  mutt_attach_init(actx);
1042  menu->mdata = actx;
1043  }
1044 
1045  mutt_update_tree(actx);
1046 
1047  menu->max = actx->vcount;
1048  if (menu->max)
1049  {
1050  if (menu->current >= menu->max)
1051  menu->current = menu->max - 1;
1052  }
1053  else
1054  menu->current = 0;
1055 
1056  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
1057 }
struct Email * email
Used by recvattach for updating.
Definition: attach.h:51
struct Body * content
List of MIME parts.
Definition: email.h:90
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:1006
void * mdata
Extra data for the current menu.
Definition: mutt_menu.h:84
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
void mutt_attach_init(struct AttachCtx *actx)
Create a new Attachment context.
Definition: recvattach.c:1334
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
void mutt_update_tree(struct AttachCtx *actx)
Refresh the list of attachments.
Definition: recvattach.c:142
int current
Current entry.
Definition: mutt_menu.h:85
short vcount
The number of virtual attachments.
Definition: attach.h:59
+ 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 1065 of file compose.c.

1066 {
1067  ap->level = (actx->idxlen > 0) ? actx->idx[actx->idxlen - 1]->level : 0;
1068  if (actx->idxlen)
1069  actx->idx[actx->idxlen - 1]->content->next = ap->content;
1070  ap->content->aptr = ap;
1071  mutt_actx_add_attach(actx, ap);
1072  mutt_update_compose_menu(actx, menu, false);
1073  menu->current = actx->vcount - 1;
1074 }
if(!test_colorize_)
Definition: acutest.h:499
struct Body * next
next attachment in the list
Definition: body.h:53
short idxlen
Number of attachmentes.
Definition: attach.h:55
void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach)
Add an Attachment to an Attachment Context.
Definition: attach.c:40
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition: body.h:57
static void mutt_update_compose_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Redraw the compose window.
Definition: compose.c:1036
struct Body * content
Attachment.
Definition: attach.h:36
int current
Current entry.
Definition: mutt_menu.h:85
int level
Nesting depth of attachment.
Definition: attach.h:40
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
short vcount
The number of virtual attachments.
Definition: attach.h:59
+ 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 1079 of file compose.c.

1080 {
1081  struct ComposeRedrawData *rd = menu->redraw_data;
1082  if (!rd)
1083  return;
1084 
1085  if (menu->redraw & REDRAW_FLOW)
1086  {
1087  rd->win_envelope->req_rows = calc_envelope(rd);
1089  }
1090 
1091  if (menu->redraw & REDRAW_FULL)
1092  {
1093  menu_redraw_full(menu);
1094  draw_envelope(rd);
1095  menu->pagelen = menu->win_index->state.rows;
1096  }
1097 
1098  menu_check_recenter(menu);
1099 
1100  if (menu->redraw & REDRAW_STATUS)
1101  {
1102  char buf[1024];
1103  compose_status_line(buf, sizeof(buf), 0, menu->win_ibar->state.cols, menu,
1105  mutt_window_move(menu->win_ibar, 0, 0);
1107  mutt_draw_statusline(menu->win_ibar->state.cols, buf, sizeof(buf));
1109  menu->redraw &= ~REDRAW_STATUS;
1110  }
1111 
1112  if (menu->redraw & REDRAW_INDEX)
1113  menu_redraw_index(menu);
1114  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNC))
1115  menu_redraw_motion(menu);
1116  else if (menu->redraw == REDRAW_CURRENT)
1117  menu_redraw_current(menu);
1118  menu->redraw = REDRAW_NO_FLAGS;
1119 }
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
#define NONULL(x)
Definition: string2.h:37
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:55
#define REDRAW_FLOW
Used by pager to reflow text.
Definition: mutt_menu.h:47
static int calc_envelope(struct ComposeRedrawData *rd)
Calculate how many rows the envelope will need.
Definition: compose.c:475
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:365
void * redraw_data
Definition: mutt_menu.h:152
struct MuttWindow * win_ibar
Definition: mutt_menu.h:93
struct MuttWindow * win_envelope
Envelope: From, To, etc.
Definition: compose.c:127
static void draw_envelope(struct ComposeRedrawData *rd)
Write the email headers to the compose window.
Definition: compose.c:864
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:1265
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:41
Plain text.
Definition: color.h:77
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:42
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:113
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
Status bar (takes a pattern)
Definition: color.h:94
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
struct MuttWindow * mutt_window_dialog(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: mutt_window.c:651
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:432
short req_rows
Number of rows required.
Definition: mutt_window.h:111
char * C_ComposeFormat
Config: printf-like format string for the Compose panel&#39;s status bar.
Definition: compose.c:97
struct MuttWindow * win_index
Definition: mutt_menu.h:92
#define REDRAW_NO_FLAGS
No flags are set.
Definition: mutt_menu.h:39
Keep track when the compose screen needs redrawing.
Definition: compose.c:109
void mutt_draw_statusline(int cols, const char *buf, size_t buflen)
Draw a highlighted status bar.
Definition: index.c:954
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:43
+ 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 1127 of file compose.c.

1128 {
1129  /* Reorder Body pointers.
1130  * Must traverse msg from top since Body has no previous ptr. */
1131  for (struct Body *part = msg; part; part = part->next)
1132  {
1133  if (part->next == idx[first]->content)
1134  {
1135  idx[first]->content->next = idx[first + 1]->content->next;
1136  idx[first + 1]->content->next = idx[first]->content;
1137  part->next = idx[first + 1]->content;
1138  break;
1139  }
1140  }
1141 
1142  /* Reorder index */
1143  struct AttachPtr *saved = idx[first];
1144  idx[first] = idx[first + 1];
1145  idx[first + 1] = saved;
1146 
1147  /* Swap ptr->num */
1148  int i = idx[first]->num;
1149  idx[first]->num = idx[first + 1]->num;
1150  idx[first + 1]->num = i;
1151 }
An email to which things will be attached.
Definition: attach.h:34
struct Body * next
next attachment in the list
Definition: body.h:53
The body of an email.
Definition: body.h:34
int num
Attachment index number.
Definition: attach.h:41
struct Body * content
Attachment.
Definition: attach.h:36
+ 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 1161 of file compose.c.

1162 {
1163  size_t s = 0;
1164  struct AttachCtx *actx = menu->mdata;
1165  struct AttachPtr **idx = actx->idx;
1166  struct Content *info = NULL;
1167  struct Body *b = NULL;
1168 
1169  for (unsigned short i = 0; i < actx->idxlen; i++)
1170  {
1171  b = idx[i]->content;
1172 
1173  if (!b->content)
1175 
1176  info = b->content;
1177  if (info)
1178  {
1179  switch (b->encoding)
1180  {
1181  case ENC_QUOTED_PRINTABLE:
1182  s += 3 * (info->lobin + info->hibin) + info->ascii + info->crlf;
1183  break;
1184  case ENC_BASE64:
1185  s += (4 * (info->lobin + info->hibin + info->ascii + info->crlf)) / 3;
1186  break;
1187  default:
1188  s += info->lobin + info->hibin + info->ascii + info->crlf;
1189  break;
1190  }
1191  }
1192  }
1193 
1194  return s;
1195 }
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:46
An email to which things will be attached.
Definition: attach.h:34
struct Content * content
Detailed info about the content of the attachment.
Definition: body.h:51
short idxlen
Number of attachmentes.
Definition: attach.h:55
long hibin
8-bit characters
Definition: content.h:35
The body of an email.
Definition: body.h:34
struct Content * mutt_get_content_info(const char *fname, struct Body *b)
Analyze file to determine MIME encoding to use.
Definition: sendlib.c:1038
unsigned int encoding
content-transfer-encoding, ContentEncoding
Definition: body.h:66
Base-64 encoded text.
Definition: mime.h:52
Info about an attachment.
Definition: content.h:33
void * mdata
Extra data for the current menu.
Definition: mutt_menu.h:84
long ascii
Number of ascii chars.
Definition: content.h:39
long lobin
Unprintable 7-bit chars (eg., control chars)
Definition: content.h:36
struct Body * content
Attachment.
Definition: attach.h:36
Quoted-printable text.
Definition: mime.h:51
long crlf
\r and \n characters
Definition: content.h:38
A set of attachments.
Definition: attach.h:49
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
+ 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 1207 of file compose.c.

1211 {
1212  char fmt[128], tmp[128];
1213  bool optional = (flags & MUTT_FORMAT_OPTIONAL);
1214  struct Menu *menu = (struct Menu *) data;
1215 
1216  *buf = '\0';
1217  switch (op)
1218  {
1219  case 'a': /* total number of attachments */
1220  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
1221  snprintf(buf, buflen, fmt, menu->max);
1222  break;
1223 
1224  case 'h': /* hostname */
1225  snprintf(fmt, sizeof(fmt), "%%%ss", prec);
1226  snprintf(buf, buflen, fmt, NONULL(ShortHostname));
1227  break;
1228 
1229  case 'l': /* approx length of current message in bytes */
1230  snprintf(fmt, sizeof(fmt), "%%%ss", prec);
1231  mutt_str_pretty_size(tmp, sizeof(tmp), menu ? cum_attachs_size(menu) : 0);
1232  snprintf(buf, buflen, fmt, tmp);
1233  break;
1234 
1235  case 'v':
1236  snprintf(buf, buflen, "%s", mutt_make_version());
1237  break;
1238 
1239  case 0:
1240  *buf = '\0';
1241  return src;
1242 
1243  default:
1244  snprintf(buf, buflen, "%%%s%c", prec, op);
1245  break;
1246  }
1247 
1248  if (optional)
1249  compose_status_line(buf, buflen, col, cols, menu, if_str);
1250  else if (flags & MUTT_FORMAT_OPTIONAL)
1251  compose_status_line(buf, buflen, col, cols, menu, else_str);
1252 
1253  return src;
1254 }
#define NONULL(x)
Definition: string2.h:37
GUI selectable list of items.
Definition: mutt_menu.h:80
static int const char * fmt
Definition: acutest.h:488
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:1265
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: muttlib.c:1749
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
static unsigned long cum_attachs_size(struct Menu *menu)
Cumulative Attachments Size.
Definition: compose.c:1161
WHERE char * ShortHostname
Short version of the hostname.
Definition: globals.h:51
#define MUTT_FORMAT_OPTIONAL
Allow optional field processing.
Definition: format_flags.h:33
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1550
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_dlg_compose_observer()

static int mutt_dlg_compose_observer ( struct NotifyCallback nc)
static

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

Definition at line 1275 of file compose.c.

1276 {
1277  if (!nc->event_data || !nc->global_data)
1278  return -1;
1279  if (nc->event_type != NT_CONFIG)
1280  return 0;
1281 
1282  struct EventConfig *ec = nc->event_data;
1283  struct MuttWindow *dlg = nc->global_data;
1284 
1285  if (!mutt_str_equal(ec->name, "status_on_top"))
1286  return 0;
1287 
1288  struct MuttWindow *win_ebar = mutt_window_find(dlg, WT_INDEX_BAR);
1289  if (!win_ebar)
1290  return 0;
1291 
1292  TAILQ_REMOVE(&dlg->children, win_ebar, entries);
1293 
1294  if (C_StatusOnTop)
1295  TAILQ_INSERT_HEAD(&dlg->children, win_ebar, entries);
1296  else
1297  TAILQ_INSERT_TAIL(&dlg->children, win_ebar, entries);
1298 
1299  mutt_window_reflow(dlg);
1300  return 0;
1301 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:879
WHERE bool C_StatusOnTop
Config: Display the status bar at the top.
Definition: globals.h:247
struct MuttWindow * mutt_window_find(struct MuttWindow *root, enum WindowType type)
Find a Window of a given type.
Definition: mutt_window.c:669
A config-change event.
Definition: subset.h:70
A division of the screen.
Definition: mutt_window.h:108
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:41
void * global_data
Data from notify_observer_add()
Definition: observer.h:44
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:802
void * event_data
Data from notify_send()
Definition: observer.h:43
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:36
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:789
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:432
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:121
Index Bar containing status info about the Index.
Definition: mutt_window.h:94
const char * name
Name of config item that changed.
Definition: subset.h:73
+ 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,
int  flags 
)

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
Return values
1Message should be postponed
0Normal exit
-1Abort message

Definition at line 1313 of file compose.c.

1314 {
1315  char helpstr[1024]; // This isn't copied by the help bar
1316  char buf[PATH_MAX];
1317  int rc = -1;
1318  bool loop = true;
1319  bool fcc_set = false; /* has the user edited the Fcc: field ? */
1320  struct ComposeRedrawData redraw = { 0 };
1321 
1322  STAILQ_INIT(&redraw.to_list);
1323  STAILQ_INIT(&redraw.cc_list);
1324  STAILQ_INIT(&redraw.bcc_list);
1325 
1326  struct ComposeRedrawData *rd = &redraw;
1327 #ifdef USE_NNTP
1328  bool news = OptNewsSend; /* is it a news article ? */
1329 #endif
1330 
1332 
1333  struct MuttWindow *dlg =
1336  dlg->notify = notify_new();
1337 
1338  struct MuttWindow *envelope =
1341  envelope->notify = notify_new();
1342  notify_set_parent(envelope->notify, dlg->notify);
1343 
1344  struct MuttWindow *abar =
1347  abar->notify = notify_new();
1348  notify_set_parent(abar->notify, dlg->notify);
1349 
1350  struct MuttWindow *attach =
1353  attach->notify = notify_new();
1354  notify_set_parent(attach->notify, dlg->notify);
1355 
1356  struct MuttWindow *ebar =
1359  ebar->notify = notify_new();
1360  notify_set_parent(ebar->notify, dlg->notify);
1361 
1362  rd->email = e;
1363  rd->fcc = fcc;
1364  rd->win_envelope = envelope;
1365  rd->win_cbar = ebar;
1366  rd->win_attach = attach;
1367  rd->win_abar = abar;
1368 
1369  if (C_StatusOnTop)
1370  {
1371  mutt_window_add_child(dlg, ebar);
1372  mutt_window_add_child(dlg, envelope);
1373  mutt_window_add_child(dlg, abar);
1374  mutt_window_add_child(dlg, attach);
1375  }
1376  else
1377  {
1378  mutt_window_add_child(dlg, envelope);
1379  mutt_window_add_child(dlg, abar);
1380  mutt_window_add_child(dlg, attach);
1381  mutt_window_add_child(dlg, ebar);
1382  }
1383 
1385  dialog_push(dlg);
1386 
1387  envelope->req_rows = calc_envelope(rd);
1388  mutt_window_reflow(dlg);
1389 
1390  struct Menu *menu = mutt_menu_new(MENU_COMPOSE);
1391 
1392  menu->pagelen = attach->state.rows;
1393  menu->win_index = attach;
1394  menu->win_ibar = ebar;
1395 
1396  menu->make_entry = snd_make_entry;
1397  menu->tag = attach_tag;
1398 #ifdef USE_NNTP
1399  if (news)
1400  menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_COMPOSE, ComposeNewsHelp);
1401  else
1402 #endif
1403  menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_COMPOSE, ComposeHelp);
1405  menu->redraw_data = rd;
1406  mutt_menu_push_current(menu);
1407 
1408  struct AttachCtx *actx = mutt_actx_new();
1409  actx->email = e;
1410  mutt_update_compose_menu(actx, menu, true);
1411 
1412  update_crypt_info(rd);
1413 
1414  /* Since this is rather long lived, we don't use the pool */
1415  struct Buffer fname = mutt_buffer_make(PATH_MAX);
1416 
1417  bool redraw_env = false;
1418  while (loop)
1419  {
1420  if (redraw_env)
1421  {
1422  redraw_env = false;
1423  envelope->req_rows = calc_envelope(rd);
1424  mutt_window_reflow(dlg);
1425  }
1426 
1427 #ifdef USE_NNTP
1428  OptNews = false; /* for any case */
1429 #endif
1430  const int op = mutt_menu_loop(menu);
1431  if (op >= 0)
1432  mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", OpStrings[op][0], op);
1433  switch (op)
1434  {
1435  case OP_COMPOSE_EDIT_FROM:
1437  update_crypt_info(rd);
1439  redraw_env = true;
1440  break;
1441 
1442  case OP_COMPOSE_EDIT_TO:
1443  {
1444 #ifdef USE_NNTP
1445  if (news)
1446  break;
1447 #endif
1448  edit_address_list(HDR_TO, &e->env->to);
1449  update_crypt_info(rd);
1451  redraw_env = true;
1452  break;
1453  }
1454 
1455  case OP_COMPOSE_EDIT_BCC:
1456  {
1457 #ifdef USE_NNTP
1458  if (news)
1459  break;
1460 #endif
1462  update_crypt_info(rd);
1464  redraw_env = true;
1465  break;
1466  }
1467 
1468  case OP_COMPOSE_EDIT_CC:
1469  {
1470 #ifdef USE_NNTP
1471  if (news)
1472  break;
1473 #endif
1474  edit_address_list(HDR_CC, &e->env->cc);
1475  update_crypt_info(rd);
1477  redraw_env = true;
1478  break;
1479  }
1480 
1481 #ifdef USE_NNTP
1482  case OP_COMPOSE_EDIT_NEWSGROUPS:
1483  if (!news)
1484  break;
1485  if (e->env->newsgroups)
1486  mutt_str_copy(buf, e->env->newsgroups, sizeof(buf));
1487  else
1488  buf[0] = '\0';
1489  if (mutt_get_field(Prompts[HDR_NEWSGROUPS], buf, sizeof(buf), MUTT_COMP_NO_FLAGS) == 0)
1490  {
1491  mutt_str_replace(&e->env->newsgroups, buf);
1492  redraw_env = true;
1493  }
1494  break;
1495 
1496  case OP_COMPOSE_EDIT_FOLLOWUP_TO:
1497  if (!news)
1498  break;
1499  if (e->env->followup_to)
1500  mutt_str_copy(buf, e->env->followup_to, sizeof(buf));
1501  else
1502  buf[0] = '\0';
1503  if (mutt_get_field(Prompts[HDR_FOLLOWUPTO], buf, sizeof(buf), MUTT_COMP_NO_FLAGS) == 0)
1504  {
1505  mutt_str_replace(&e->env->followup_to, buf);
1506  redraw_env = true;
1507  }
1508  break;
1509 
1510  case OP_COMPOSE_EDIT_X_COMMENT_TO:
1511  if (!(news && C_XCommentTo))
1512  break;
1513  if (e->env->x_comment_to)
1514  mutt_str_copy(buf, e->env->x_comment_to, sizeof(buf));
1515  else
1516  buf[0] = '\0';
1517  if (mutt_get_field(Prompts[HDR_XCOMMENTTO], buf, sizeof(buf), MUTT_COMP_NO_FLAGS) == 0)
1518  {
1519  mutt_str_replace(&e->env->x_comment_to, buf);
1520  redraw_env = true;
1521  }
1522  break;
1523 #endif
1524 
1525  case OP_COMPOSE_EDIT_SUBJECT:
1526  if (e->env->subject)
1527  mutt_str_copy(buf, e->env->subject, sizeof(buf));
1528  else
1529  buf[0] = '\0';
1530  if (mutt_get_field(Prompts[HDR_SUBJECT], buf, sizeof(buf), MUTT_COMP_NO_FLAGS) == 0)
1531  {
1532  mutt_str_replace(&e->env->subject, buf);
1533  redraw_env = true;
1534  }
1536  break;
1537 
1538  case OP_COMPOSE_EDIT_REPLY_TO:
1541  redraw_env = true;
1542  break;
1543 
1544  case OP_COMPOSE_EDIT_FCC:
1545  mutt_buffer_copy(&fname, fcc);
1547  {
1548  mutt_buffer_copy(fcc, &fname);
1550  fcc_set = true;
1551  redraw_env = true;
1552  }
1554  break;
1555 
1556  case OP_COMPOSE_EDIT_MESSAGE:
1557  if (C_Editor && !mutt_str_equal("builtin", C_Editor) && !C_EditHeaders)
1558  {
1563  menu->redraw = REDRAW_FULL;
1565  break;
1566  }
1567  /* fallthrough */
1568 
1569  case OP_COMPOSE_EDIT_HEADERS:
1571  if (!mutt_str_equal("builtin", C_Editor) &&
1572  ((op == OP_COMPOSE_EDIT_HEADERS) || ((op == OP_COMPOSE_EDIT_MESSAGE) && C_EditHeaders)))
1573  {
1574  const char *tag = NULL;
1575  char *err = NULL;
1576  mutt_env_to_local(e->env);
1578  if (mutt_env_to_intl(e->env, &tag, &err))
1579  {
1580  mutt_error(_("Bad IDN in '%s': '%s'"), tag, err);
1581  FREE(&err);
1582  }
1583  update_crypt_info(rd);
1584  redraw_env = true;
1585  }
1586  else
1587  {
1588  /* this is grouped with OP_COMPOSE_EDIT_HEADERS because the
1589  * attachment list could change if the user invokes ~v to edit
1590  * the message with headers, in which we need to execute the
1591  * code below to regenerate the index array */
1592  mutt_builtin_editor(e->content->filename, e, e_cur);
1593  }
1594 
1597 
1598  /* attachments may have been added */
1599  if (actx->idxlen && actx->idx[actx->idxlen - 1]->content->next)
1600  {
1601  mutt_actx_entries_free(actx);
1602  mutt_update_compose_menu(actx, menu, true);
1603  }
1604 
1605  menu->redraw = REDRAW_FULL;
1607  break;
1608 
1609  case OP_COMPOSE_ATTACH_KEY:
1610  {
1611  if (!(WithCrypto & APPLICATION_PGP))
1612  break;
1613  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1615  if (ap->content)
1616  {
1617  update_idx(menu, actx, ap);
1618  menu->redraw |= REDRAW_INDEX;
1619  }
1620  else
1621  FREE(&ap);
1622 
1623  menu->redraw |= REDRAW_STATUS;
1624 
1626  break;
1627  }
1628 
1629  case OP_COMPOSE_MOVE_UP:
1630  if (menu->current == 0)
1631  {
1632  mutt_error(_("Attachment is already at top"));
1633  break;
1634  }
1635  if (menu->current == 1)
1636  {
1637  mutt_error(_("The fundamental part can't be moved"));
1638  break;
1639  }
1640  compose_attach_swap(e->content, actx->idx, menu->current - 1);
1641  menu->redraw |= REDRAW_INDEX;
1642  menu->current--;
1643  break;
1644 
1645  case OP_COMPOSE_MOVE_DOWN:
1646  if (menu->current == (actx->idxlen - 1))
1647  {
1648  mutt_error(_("Attachment is already at bottom"));
1649  break;
1650  }
1651  if (menu->current == 0)
1652  {
1653  mutt_error(_("The fundamental part can't be moved"));
1654  break;
1655  }
1656  compose_attach_swap(e->content, actx->idx, menu->current);
1657  menu->redraw |= REDRAW_INDEX;
1658  menu->current++;
1659  break;
1660 
1661  case OP_COMPOSE_GROUP_ALTS:
1662  {
1663  if (menu->tagged < 2)
1664  {
1665  mutt_error(
1666  _("Grouping 'alternatives' requires at least 2 tagged messages"));
1667  break;
1668  }
1669 
1670  struct Body *group = mutt_body_new();
1671  group->type = TYPE_MULTIPART;
1672  group->subtype = mutt_str_dup("alternative");
1673  group->disposition = DISP_INLINE;
1674 
1675  struct Body *alts = NULL;
1676  /* group tagged message into a multipart/alternative */
1677  struct Body *bptr = e->content;
1678  for (int i = 0; bptr;)
1679  {
1680  if (bptr->tagged)
1681  {
1682  bptr->tagged = false;
1683  bptr->disposition = DISP_INLINE;
1684 
1685  /* for first match, set group desc according to match */
1686 #define ALTS_TAG "Alternatives for \"%s\""
1687  if (!group->description)
1688  {
1689  char *p = bptr->description ? bptr->description : bptr->filename;
1690  if (p)
1691  {
1692  group->description =
1693  mutt_mem_calloc(1, strlen(p) + strlen(ALTS_TAG) + 1);
1694  sprintf(group->description, ALTS_TAG, p);
1695  }
1696  }
1697 
1698  // append bptr to the alts list, and remove from the e->content list
1699  if (alts)
1700  {
1701  alts->next = bptr;
1702  bptr = bptr->next;
1703  alts = alts->next;
1704  alts->next = NULL;
1705  }
1706  else
1707  {
1708  group->parts = bptr;
1709  alts = bptr;
1710  bptr = bptr->next;
1711  alts->next = NULL;
1712  }
1713 
1714  for (int j = i; j < actx->idxlen - 1; j++)
1715  {
1716  actx->idx[j] = actx->idx[j + 1];
1717  actx->idx[j + 1] = NULL; /* for debug reason */
1718  }
1719  actx->idxlen--;
1720  }
1721  else
1722  {
1723  bptr = bptr->next;
1724  i++;
1725  }
1726  }
1727 
1728  group->next = NULL;
1730 
1731  /* if no group desc yet, make one up */
1732  if (!group->description)
1733  group->description = mutt_str_dup("unknown alternative group");
1734 
1735  struct AttachPtr *gptr = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1736  gptr->content = group;
1737  update_idx(menu, actx, gptr);
1738  menu->redraw |= REDRAW_INDEX;
1739  break;
1740  }
1741 
1742  case OP_COMPOSE_GROUP_LINGUAL:
1743  {
1744  if (menu->tagged < 2)
1745  {
1746  mutt_error(
1747  _("Grouping 'multilingual' requires at least 2 tagged messages"));
1748  break;
1749  }
1750 
1751  /* traverse to see whether all the parts have Content-Language: set */
1752  int tagged_with_lang_num = 0;
1753  for (struct Body *b = e->content; b; b = b->next)
1754  if (b->tagged && b->language && *b->language)
1755  tagged_with_lang_num++;
1756 
1757  if (menu->tagged != tagged_with_lang_num)
1758  {
1759  if (mutt_yesorno(
1760  _("Not all parts have 'Content-Language' set, continue?"), MUTT_YES) != MUTT_YES)
1761  {
1762  mutt_message(_("Not sending this message"));
1763  break;
1764  }
1765  }
1766 
1767  struct Body *group = mutt_body_new();
1768  group->type = TYPE_MULTIPART;
1769  group->subtype = mutt_str_dup("multilingual");
1770  group->disposition = DISP_INLINE;
1771 
1772  struct Body *alts = NULL;
1773  /* group tagged message into a multipart/multilingual */
1774  struct Body *bptr = e->content;
1775  for (int i = 0; bptr;)
1776  {
1777  if (bptr->tagged)
1778  {
1779  bptr->tagged = false;
1780  bptr->disposition = DISP_INLINE;
1781 
1782  /* for first match, set group desc according to match */
1783 #define LINGUAL_TAG "Multilingual part for \"%s\""
1784  if (!group->description)
1785  {
1786  char *p = bptr->description ? bptr->description : bptr->filename;
1787  if (p)
1788  {
1789  group->description =
1790  mutt_mem_calloc(1, strlen(p) + strlen(LINGUAL_TAG) + 1);
1791  sprintf(group->description, LINGUAL_TAG, p);
1792  }
1793  }
1794 
1795  // append bptr to the alts list, and remove from the e->content list
1796  if (alts)
1797  {
1798  alts->next = bptr;
1799  bptr = bptr->next;
1800  alts = alts->next;
1801  alts->next = NULL;
1802  }
1803  else
1804  {
1805  group->parts = bptr;
1806  alts = bptr;
1807  bptr = bptr->next;
1808  alts->next = NULL;
1809  }
1810 
1811  for (int j = i; j < actx->idxlen - 1; j++)
1812  {
1813  actx->idx[j] = actx->idx[j + 1];
1814  actx->idx[j + 1] = NULL; /* for debug reason */
1815  }
1816  actx->idxlen--;
1817  }
1818  else
1819  {
1820  bptr = bptr->next;
1821  i++;
1822  }
1823  }
1824 
1825  group->next = NULL;
1827 
1828  /* if no group desc yet, make one up */
1829  if (!group->description)
1830  group->description = mutt_str_dup("unknown multilingual group");
1831 
1832  struct AttachPtr *gptr = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1833  gptr->content = group;
1834  update_idx(menu, actx, gptr);
1835  menu->redraw |= REDRAW_INDEX;
1836  break;
1837  }
1838 
1839  case OP_COMPOSE_ATTACH_FILE:
1840  {
1841  char *prompt = _("Attach file");
1842  int numfiles = 0;
1843  char **files = NULL;
1844 
1845  mutt_buffer_reset(&fname);
1846  if ((mutt_buffer_enter_fname_full(prompt, &fname, false, true, &files,
1847  &numfiles, MUTT_SEL_MULTI) == -1) ||
1848  mutt_buffer_is_empty(&fname))
1849  {
1850  for (int i = 0; i < numfiles; i++)
1851  FREE(&files[i]);
1852 
1853  FREE(&files);
1854  break;
1855  }
1856 
1857  bool error = false;
1858  if (numfiles > 1)
1859  {
1860  mutt_message(ngettext("Attaching selected file...",
1861  "Attaching selected files...", numfiles));
1862  }
1863  for (int i = 0; i < numfiles; i++)
1864  {
1865  char *att = files[i];
1866  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1867  ap->unowned = true;
1868  ap->content = mutt_make_file_attach(att);
1869  if (ap->content)
1870  update_idx(menu, actx, ap);
1871  else
1872  {
1873  error = true;
1874  mutt_error(_("Unable to attach %s"), att);
1875  FREE(&ap);
1876  }
1877  FREE(&files[i]);
1878  }
1879 
1880  FREE(&files);
1881  if (!error)
1882  mutt_clear_error();
1883 
1884  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
1886  break;
1887  }
1888 
1889  case OP_COMPOSE_ATTACH_MESSAGE:
1890 #ifdef USE_NNTP
1891  case OP_COMPOSE_ATTACH_NEWS_MESSAGE:
1892 #endif
1893  {
1894  mutt_buffer_reset(&fname);
1895  char *prompt = _("Open mailbox to attach message from");
1896 
1897 #ifdef USE_NNTP
1898  OptNews = false;
1899  if (Context && (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE))
1900  {
1902  if (!CurrentNewsSrv)
1903  break;
1904 
1905  prompt = _("Open newsgroup to attach message from");
1906  OptNews = true;
1907  }
1908 #endif
1909 
1910  if (Context)
1911  {
1912 #ifdef USE_NNTP
1913  if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->mailbox->type == MUTT_NNTP))
1914 #endif
1915  {
1918  }
1919  }
1920 
1921  if ((mutt_buffer_enter_fname(prompt, &fname, true) == -1) ||
1922  mutt_buffer_is_empty(&fname))
1923  {
1924  break;
1925  }
1926 
1927 #ifdef USE_NNTP
1928  if (OptNews)
1930  else
1931 #endif
1932  mutt_buffer_expand_path(&fname);
1933 #ifdef USE_IMAP
1934  if (imap_path_probe(mutt_b2s(&fname), NULL) != MUTT_IMAP)
1935 #endif
1936 #ifdef USE_POP
1937  if (pop_path_probe(mutt_b2s(&fname), NULL) != MUTT_POP)
1938 #endif
1939 #ifdef USE_NNTP
1940  if (!OptNews && (nntp_path_probe(mutt_b2s(&fname), NULL) != MUTT_NNTP))
1941 #endif
1942  if (mx_path_probe(mutt_b2s(&fname)) != MUTT_NOTMUCH)
1943  {
1944  /* check to make sure the file exists and is readable */
1945  if (access(mutt_b2s(&fname), R_OK) == -1)
1946  {
1947  mutt_perror(mutt_b2s(&fname));
1948  break;
1949  }
1950  }
1951 
1952  menu->redraw = REDRAW_FULL;
1953 
1954  struct Mailbox *m = mx_path_resolve(mutt_b2s(&fname));
1955  bool old_readonly = m->readonly;
1956  struct Context *ctx = mx_mbox_open(m, MUTT_READONLY);
1957  if (!ctx)
1958  {
1959  mutt_error(_("Unable to open mailbox %s"), mutt_b2s(&fname));
1961  m = NULL;
1962  break;
1963  }
1964 
1965  if (ctx->mailbox->msg_count == 0)
1966  {
1967  mx_mbox_close(&ctx);
1968  mutt_error(_("No messages in that folder"));
1969  break;
1970  }
1971 
1972  struct Context *ctx_cur = Context; /* remember current folder and sort methods */
1973  int old_sort = C_Sort; /* C_Sort, SortAux could be changed in mutt_index_menu() */
1974  int old_sort_aux = C_SortAux;
1975 
1976  Context = ctx;
1977  OptAttachMsg = true;
1978  mutt_message(_("Tag the messages you want to attach"));
1979  struct MuttWindow *dlgindex = index_pager_init();
1981  dialog_push(dlgindex);
1982  mutt_index_menu(dlgindex);
1983  dialog_pop();
1985  index_pager_shutdown(dlgindex);
1986  mutt_window_free(&dlgindex);
1987  OptAttachMsg = false;
1988 
1989  if (!Context)
1990  {
1991  /* go back to the folder we started from */
1992  Context = ctx_cur;
1993  /* Restore old $sort and $sort_aux */
1994  C_Sort = old_sort;
1995  C_SortAux = old_sort_aux;
1996  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
1997  break;
1998  }
1999 
2000  for (int i = 0; i < Context->mailbox->msg_count; i++)
2001  {
2002  if (!Context->mailbox->emails[i])
2003  break;
2005  continue;
2006 
2007  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
2009  Context->mailbox->emails[i], true);
2010  if (ap->content)
2011  update_idx(menu, actx, ap);
2012  else
2013  {
2014  mutt_error(_("Unable to attach"));
2015  FREE(&ap);
2016  }
2017  }
2018  menu->redraw |= REDRAW_FULL;
2019 
2020  Context->mailbox->readonly = old_readonly;
2022  ctx_free(&Context);
2023 
2024  /* go back to the folder we started from */
2025  Context = ctx_cur;
2026  /* Restore old $sort and $sort_aux */
2027  C_Sort = old_sort;
2028  C_SortAux = old_sort_aux;
2030  break;
2031  }
2032 
2033  case OP_DELETE:
2034  CHECK_COUNT;
2035  if (CUR_ATTACH->unowned)
2036  CUR_ATTACH->content->unlink = false;
2037  if (delete_attachment(actx, menu->current) == -1)
2038  break;
2039  mutt_update_compose_menu(actx, menu, false);
2040  if (menu->current == 0)
2041  e->content = actx->idx[0]->content;
2042 
2044  break;
2045 
2046  case OP_COMPOSE_TOGGLE_RECODE:
2047  {
2048  CHECK_COUNT;
2049  if (!mutt_is_text_part(CUR_ATTACH->content))
2050  {
2051  mutt_error(_("Recoding only affects text attachments"));
2052  break;
2053  }
2054  CUR_ATTACH->content->noconv = !CUR_ATTACH->content->noconv;
2055  if (CUR_ATTACH->content->noconv)
2056  mutt_message(_("The current attachment won't be converted"));
2057  else
2058  mutt_message(_("The current attachment will be converted"));
2059  menu->redraw |= REDRAW_CURRENT;
2061  break;
2062  }
2063 
2064  case OP_COMPOSE_EDIT_DESCRIPTION:
2065  CHECK_COUNT;
2066  mutt_str_copy(buf,
2067  CUR_ATTACH->content->description ? CUR_ATTACH->content->description : "",
2068  sizeof(buf));
2069  /* header names should not be translated */
2070  if (mutt_get_field("Description: ", buf, sizeof(buf), MUTT_COMP_NO_FLAGS) == 0)
2071  {
2072  mutt_str_replace(&CUR_ATTACH->content->description, buf);
2073  menu->redraw |= REDRAW_CURRENT;
2074  }
2076  break;
2077 
2078  case OP_COMPOSE_UPDATE_ENCODING:
2079  CHECK_COUNT;
2080  if (menu->tagprefix)
2081  {
2082  struct Body *top = NULL;
2083  for (top = e->content; top; top = top->next)
2084  {
2085  if (top->tagged)
2086  mutt_update_encoding(top);
2087  }
2088  menu->redraw = REDRAW_FULL;
2089  }
2090  else
2091  {
2092  mutt_update_encoding(CUR_ATTACH->content);
2093  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2094  }
2096  break;
2097 
2098  case OP_COMPOSE_TOGGLE_DISPOSITION:
2099  /* toggle the content-disposition between inline/attachment */
2100  CUR_ATTACH->content->disposition =
2101  (CUR_ATTACH->content->disposition == DISP_INLINE) ? DISP_ATTACH : DISP_INLINE;
2102  menu->redraw |= REDRAW_CURRENT;
2103  break;
2104 
2105  case OP_EDIT_TYPE:
2106  CHECK_COUNT;
2107  {
2108  mutt_edit_content_type(NULL, CUR_ATTACH->content, NULL);
2109 
2110  /* this may have been a change to text/something */
2111  mutt_update_encoding(CUR_ATTACH->content);
2112 
2113  menu->redraw |= REDRAW_CURRENT;
2114  }
2116  break;
2117 
2118  case OP_COMPOSE_EDIT_LANGUAGE:
2119  CHECK_COUNT;
2120  buf[0] = '\0'; /* clear buffer first */
2121  if (CUR_ATTACH->content->language)
2122  mutt_str_copy(buf, CUR_ATTACH->content->language, sizeof(buf));
2123  if (mutt_get_field("Content-Language: ", buf, sizeof(buf), MUTT_COMP_NO_FLAGS) == 0)
2124  {
2125  CUR_ATTACH->content->language = mutt_str_dup(buf);
2126  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2127  mutt_clear_error();
2128  }
2129  else
2130  mutt_warning(_("Empty 'Content-Language'"));
2132  break;
2133 
2134  case OP_COMPOSE_EDIT_ENCODING:
2135  CHECK_COUNT;
2136  mutt_str_copy(buf, ENCODING(CUR_ATTACH->content->encoding), sizeof(buf));
2137  if ((mutt_get_field("Content-Transfer-Encoding: ", buf, sizeof(buf),
2138  MUTT_COMP_NO_FLAGS) == 0) &&
2139  (buf[0] != '\0'))
2140  {
2141  int enc = mutt_check_encoding(buf);
2142  if ((enc != ENC_OTHER) && (enc != ENC_UUENCODED))
2143  {
2144  CUR_ATTACH->content->encoding = enc;
2145  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2146  mutt_clear_error();
2147  }
2148  else
2149  mutt_error(_("Invalid encoding"));
2150  }
2152  break;
2153 
2154  case OP_COMPOSE_SEND_MESSAGE:
2155  /* Note: We don't invoke send2-hook here, since we want to leave
2156  * users an opportunity to change settings from the ":" prompt. */
2157  if (check_attachments(actx) != 0)
2158  {
2159  menu->redraw = REDRAW_FULL;
2160  break;
2161  }
2162 
2163 #ifdef MIXMASTER
2164  if (!STAILQ_EMPTY(&e->chain) && (mix_check_message(e) != 0))
2165  break;
2166 #endif
2167 
2168  if (!fcc_set && !mutt_buffer_is_empty(fcc))
2169  {
2170  enum QuadOption ans =
2171  query_quadoption(C_Copy, _("Save a copy of this message?"));
2172  if (ans == MUTT_ABORT)
2173  break;
2174  else if (ans == MUTT_NO)
2175  mutt_buffer_reset(fcc);
2176  }
2177 
2178  loop = false;
2179  rc = 0;
2180  break;
2181 
2182  case OP_COMPOSE_EDIT_FILE:
2183  CHECK_COUNT;
2184  mutt_edit_file(NONULL(C_Editor), CUR_ATTACH->content->filename);
2185  mutt_update_encoding(CUR_ATTACH->content);
2186  menu->redraw |= REDRAW_CURRENT | REDRAW_STATUS;
2188  break;
2189 
2190  case OP_COMPOSE_TOGGLE_UNLINK:
2191  CHECK_COUNT;
2192  CUR_ATTACH->content->unlink = !CUR_ATTACH->content->unlink;
2193 
2194  menu->redraw |= REDRAW_INDEX;
2195  /* No send2hook since this doesn't change the message. */
2196  break;
2197 
2198  case OP_COMPOSE_GET_ATTACHMENT:
2199  CHECK_COUNT;
2200  if (menu->tagprefix)
2201  {
2202  for (struct Body *top = e->content; top; top = top->next)
2203  {
2204  if (top->tagged)
2206  }
2207  menu->redraw |= REDRAW_FULL;
2208  }
2209  else if (mutt_get_tmp_attachment(CUR_ATTACH->content) == 0)
2210  menu->redraw |= REDRAW_CURRENT;
2211 
2212  /* No send2hook since this doesn't change the message. */
2213  break;
2214 
2215  case OP_COMPOSE_RENAME_ATTACHMENT:
2216  {
2217  CHECK_COUNT;
2218  char *src = NULL;
2219  if (CUR_ATTACH->content->d_filename)
2220  src = CUR_ATTACH->content->d_filename;
2221  else
2222  src = CUR_ATTACH->content->filename;
2224  int ret = mutt_buffer_get_field(_("Send attachment with name: "), &fname, MUTT_FILE);
2225  if (ret == 0)
2226  {
2227  /* As opposed to RENAME_FILE, we don't check buf[0] because it's
2228  * valid to set an empty string here, to erase what was set */
2229  mutt_str_replace(&CUR_ATTACH->content->d_filename, mutt_b2s(&fname));
2230  menu->redraw |= REDRAW_CURRENT;
2231  }
2232  break;
2233  }
2234 
2235  case OP_COMPOSE_RENAME_FILE:
2236  CHECK_COUNT;
2237  mutt_buffer_strcpy(&fname, CUR_ATTACH->content->filename);
2239  if ((mutt_buffer_get_field(_("Rename to: "), &fname, MUTT_FILE) == 0) &&
2240  !mutt_buffer_is_empty(&fname))
2241  {
2242  struct stat st;
2243  if (stat(CUR_ATTACH->content->filename, &st) == -1)
2244  {
2245  /* L10N: "stat" is a system call. Do "man 2 stat" for more information. */
2246  mutt_error(_("Can't stat %s: %s"), mutt_b2s(&fname), strerror(errno));
2247  break;
2248  }
2249 
2250  mutt_buffer_expand_path(&fname);
2251  if (mutt_file_rename(CUR_ATTACH->content->filename, mutt_b2s(&fname)))
2252  break;
2253 
2254  mutt_str_replace(&CUR_ATTACH->content->filename, mutt_b2s(&fname));
2255  menu->redraw |= REDRAW_CURRENT;
2256 
2257  if (CUR_ATTACH->content->stamp >= st.st_mtime)
2259  }
2261  break;
2262 
2263  case OP_COMPOSE_NEW_MIME:
2264  {
2265  mutt_buffer_reset(&fname);
2266  if ((mutt_buffer_get_field(_("New file: "), &fname, MUTT_FILE) != 0) ||
2267  mutt_buffer_is_empty(&fname))
2268  {
2269  continue;
2270  }
2271  mutt_buffer_expand_path(&fname);
2272 
2273  /* Call to lookup_mime_type () ? maybe later */
2274  char type[256] = { 0 };
2275  if ((mutt_get_field("Content-Type: ", type, sizeof(type), MUTT_COMP_NO_FLAGS) != 0) ||
2276  (type[0] == '\0'))
2277  {
2278  continue;
2279  }
2280 
2281  char *p = strchr(type, '/');
2282  if (!p)
2283  {
2284  mutt_error(_("Content-Type is of the form base/sub"));
2285  continue;
2286  }
2287  *p++ = 0;
2288  enum ContentType itype = mutt_check_mime_type(type);
2289  if (itype == TYPE_OTHER)
2290  {
2291  mutt_error(_("Unknown Content-Type %s"), type);
2292  continue;
2293  }
2294  struct AttachPtr *ap = mutt_mem_calloc(1, sizeof(struct AttachPtr));
2295  /* Touch the file */
2296  FILE *fp = mutt_file_fopen(mutt_b2s(&fname), "w");
2297  if (!fp)
2298  {
2299  mutt_error(_("Can't create file %s"), mutt_b2s(&fname));
2300  FREE(&ap);
2301  continue;
2302  }
2303  mutt_file_fclose(&fp);
2304 
2305  ap->content = mutt_make_file_attach(mutt_b2s(&fname));
2306  if (!ap->content)
2307  {
2308  mutt_error(_("What we have here is a failure to make an attachment"));
2309  FREE(&ap);
2310  continue;
2311  }
2312  update_idx(menu, actx, ap);
2313 
2314  CUR_ATTACH->content->type = itype;
2315  mutt_str_replace(&CUR_ATTACH->content->subtype, p);
2316  CUR_ATTACH->content->unlink = true;
2317  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
2318 
2319  if (mutt_compose_attachment(CUR_ATTACH->content))
2320  {
2321  mutt_update_encoding(CUR_ATTACH->content);
2322  menu->redraw = REDRAW_FULL;
2323  }
2325  break;
2326  }
2327 
2328  case OP_COMPOSE_EDIT_MIME:
2329  CHECK_COUNT;
2330  if (mutt_edit_attachment(CUR_ATTACH->content))
2331  {
2332  mutt_update_encoding(CUR_ATTACH->content);
2333  menu->redraw = REDRAW_FULL;
2334  }
2336  break;
2337 
2338  case OP_VIEW_ATTACH:
2339  case OP_DISPLAY_HEADERS:
2340  CHECK_COUNT;
2341  mutt_attach_display_loop(menu, op, NULL, actx, false);
2342  menu->redraw = REDRAW_FULL;
2343  /* no send2hook, since this doesn't modify the message */
2344  break;
2345 
2346  case OP_SAVE:
2347  CHECK_COUNT;
2348  mutt_save_attachment_list(actx, NULL, menu->tagprefix,
2349  CUR_ATTACH->content, NULL, menu);
2350  /* no send2hook, since this doesn't modify the message */
2351  break;
2352 
2353  case OP_PRINT:
2354  CHECK_COUNT;
2355  mutt_print_attachment_list(actx, NULL, menu->tagprefix, CUR_ATTACH->content);
2356  /* no send2hook, since this doesn't modify the message */
2357  break;
2358 
2359  case OP_PIPE:
2360  case OP_FILTER:
2361  CHECK_COUNT;
2362  mutt_pipe_attachment_list(actx, NULL, menu->tagprefix,
2363  CUR_ATTACH->content, (op == OP_FILTER));
2364  if (op == OP_FILTER) /* cte might have changed */
2365  menu->redraw |= menu->tagprefix ? REDRAW_FULL : REDRAW_CURRENT;
2366  menu->redraw |= REDRAW_STATUS;
2368  break;
2369 
2370  case OP_EXIT:
2371  {
2372  enum QuadOption ans =
2373  query_quadoption(C_Postpone, _("Save (postpone) draft message?"));
2374  if (ans == MUTT_NO)
2375  {
2376  for (int i = 0; i < actx->idxlen; i++)
2377  if (actx->idx[i]->unowned)
2378  actx->idx[i]->content->unlink = false;
2379 
2380  if (!(flags & MUTT_COMPOSE_NOFREEHEADER))
2381  {
2382  for (int i = 0; i < actx->idxlen; i++)
2383  {
2384  /* avoid freeing other attachments */
2385  actx->idx[i]->content->next = NULL;
2386  /* See the comment in delete_attachment() */
2387  if (!actx->idx[i]->content->email)
2388  actx->idx[i]->content->parts = NULL;
2389  mutt_body_free(&actx->idx[i]->content);
2390  }
2391  }
2392  rc = -1;
2393  loop = false;
2394  break;
2395  }
2396  else if (ans == MUTT_ABORT)
2397  break; /* abort */
2398  }
2399  /* fallthrough */
2400 
2401  case OP_COMPOSE_POSTPONE_MESSAGE:
2402  if (check_attachments(actx) != 0)
2403  {
2404  menu->redraw = REDRAW_FULL;
2405  break;
2406  }
2407 
2408  loop = false;
2409  rc = 1;
2410  break;
2411 
2412  case OP_COMPOSE_ISPELL:
2413  endwin();
2414  snprintf(buf, sizeof(buf), "%s -x %s", NONULL(C_Ispell), e->content->filename);
2415  if (mutt_system(buf) == -1)
2416  mutt_error(_("Error running \"%s\""), buf);
2417  else
2418  {
2420  menu->redraw |= REDRAW_STATUS;
2421  }
2422  break;
2423 
2424  case OP_COMPOSE_WRITE_MESSAGE:
2425  mutt_buffer_reset(&fname);
2426  if (Context)
2427  {
2430  }
2431  if (actx->idxlen)
2432  e->content = actx->idx[0]->content;
2433  if ((mutt_buffer_enter_fname(_("Write message to mailbox"), &fname, true) != -1) &&
2434  !mutt_buffer_is_empty(&fname))
2435  {
2436  mutt_message(_("Writing message to %s ..."), mutt_b2s(&fname));
2437  mutt_buffer_expand_path(&fname);
2438 
2439  if (e->content->next)
2441 
2442  if (mutt_write_fcc(mutt_b2s(&fname), e, NULL, false, NULL, NULL) == 0)
2443  mutt_message(_("Message written"));
2444 
2446  }
2447  break;
2448 
2449  case OP_COMPOSE_PGP_MENU:
2450  if (!(WithCrypto & APPLICATION_PGP))
2451  break;
2452  if (!crypt_has_module_backend(APPLICATION_PGP))
2453  {
2454  mutt_error(_("No PGP backend configured"));
2455  break;
2456  }
2457  if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME))
2458  {
2459  if (e->security & (SEC_ENCRYPT | SEC_SIGN))
2460  {
2461  if (mutt_yesorno(_("S/MIME already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
2462  {
2463  mutt_clear_error();
2464  break;
2465  }
2466  e->security &= ~(SEC_ENCRYPT | SEC_SIGN);
2467  }
2468  e->security &= ~APPLICATION_SMIME;
2469  e->security |= APPLICATION_PGP;
2470  update_crypt_info(rd);
2471  }
2472  e->security = crypt_pgp_send_menu(e);
2473  update_crypt_info(rd);
2475  redraw_env = true;
2476  break;
2477 
2478  case OP_FORGET_PASSPHRASE:
2480  break;
2481 
2482  case OP_COMPOSE_SMIME_MENU:
2483  if (!(WithCrypto & APPLICATION_SMIME))
2484  break;
2485  if (!crypt_has_module_backend(APPLICATION_SMIME))
2486  {
2487  mutt_error(_("No S/MIME backend configured"));
2488  break;
2489  }
2490 
2491  if (((WithCrypto & APPLICATION_PGP) != 0) && (e->security & APPLICATION_PGP))
2492  {
2493  if (e->security & (SEC_ENCRYPT | SEC_SIGN))
2494  {
2495  if (mutt_yesorno(_("PGP already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
2496  {
2497  mutt_clear_error();
2498  break;
2499  }
2500  e->security &= ~(SEC_ENCRYPT | SEC_SIGN);
2501  }
2502  e->security &= ~APPLICATION_PGP;
2504  update_crypt_info(rd);
2505  }
2507  update_crypt_info(rd);
2509  redraw_env = true;
2510  break;
2511 
2512 #ifdef MIXMASTER
2513  case OP_COMPOSE_MIX:
2516  redraw_env = true;
2517  break;
2518 #endif
2519 
2520 #ifdef USE_AUTOCRYPT
2521  case OP_COMPOSE_AUTOCRYPT_MENU:
2522  if (!C_Autocrypt)
2523  break;
2524 
2525  if ((WithCrypto & APPLICATION_SMIME) && (e->security & APPLICATION_SMIME))
2526  {
2527  if (e->security & (SEC_ENCRYPT | SEC_SIGN))
2528  {
2529  if (mutt_yesorno(_("S/MIME already selected. Clear and continue?"), MUTT_YES) != MUTT_YES)
2530  {
2531  mutt_clear_error();
2532  break;
2533  }
2534  e->security &= ~(SEC_ENCRYPT | SEC_SIGN);
2535  }
2536  e->security &= ~APPLICATION_SMIME;
2537  e->security |= APPLICATION_PGP;
2538  update_crypt_info(rd);
2539  }
2541  update_crypt_info(rd);
2543  redraw_env = true;
2544  break;
2545 #endif
2546  }
2547  }
2548 
2549  mutt_buffer_dealloc(&fname);
2550 
2551 #ifdef USE_AUTOCRYPT
2552  /* This is a fail-safe to make sure the bit isn't somehow turned
2553  * on. The user could have disabled the option after setting SEC_AUTOCRYPT,
2554  * or perhaps resuming or replying to an autocrypt message. */
2555  if (!C_Autocrypt)
2556  e->security &= ~SEC_AUTOCRYPT;
2557 #endif
2558 
2559  mutt_menu_pop_current(menu);
2560  mutt_menu_free(&menu);
2561  dialog_pop();
2563  mutt_window_free(&dlg);
2564 
2565  if (actx->idxlen)
2566  e->content = actx->idx[0]->content;
2567  else
2568  e->content = NULL;
2569 
2570  mutt_actx_free(&actx);
2571 
2572  mutt_list_free(&redraw.to_list);
2573  mutt_list_free(&redraw.cc_list);
2574  mutt_list_free(&redraw.bcc_list);
2575  return rc;
2576 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:879
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
#define mutt_warning(...)
Definition: logging.h:82
The "current" mailbox.
Definition: context.h:37
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox&#39;s path string.
Definition: mailbox.h:194
WHERE bool C_StatusOnTop
Config: Display the status bar at the top.
Definition: globals.h:247
struct Body * mutt_make_message_attach(struct Mailbox *m, struct Email *e, bool attach_msg)
Create a message attachment.
Definition: sendlib.c:1517
static int delete_attachment(struct AttachCtx *actx, int x)
Delete an attachment.
Definition: compose.c:950
void mutt_stamp_attachment(struct Body *a)
Timestamp an Attachment.
Definition: sendlib.c:1449
Unknown Content-Type.
Definition: mime.h:31
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:45
void mutt_actx_free(struct AttachCtx **ptr)
Free an Attachment Context.
Definition: attach.c:140
void mix_make_chain(struct MuttWindow *win, struct ListHead *chainhead, int cols)
Create a Mixmaster chain.
Definition: remailer.c:601
bool message_is_tagged(struct Context *ctx, struct Email *e)
Is a message in the index tagged (and within limit)
Definition: context.c:343
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:46
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
#define NONULL(x)
Definition: string2.h:37
WHERE bool C_Autocrypt
Config: Enables the Autocrypt feature.
Definition: globals.h:195
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
An email to which things will be attached.
Definition: attach.h:34
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:1150
int msg_count
Total number of messages.
Definition: mailbox.h:91
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:79
struct Body * mutt_remove_multipart(struct Body *b)
Extract the multipart body if it exists.
Definition: sendlib.c:1777
#define WithCrypto
Definition: lib.h:163
#define MUTT_CLEAR
Clear input if printable character is pressed.
Definition: mutt.h:62
#define mutt_perror(...)
Definition: logging.h:85
GUI selectable list of items.
Definition: mutt_menu.h:80
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe()
Definition: imap.c:2351
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:36
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: mailbox.h:52
int mx_mbox_close(struct Context **ptr)
Save changes and close mailbox.
Definition: mx.c:603
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer&#39;s contents to another Buffer.
Definition: buffer.c:445
struct AddressList reply_to
Email&#39;s &#39;reply-to&#39;.
Definition: envelope.h:62
const char * mutt_path_basename(const char *f)
Find the last component for a pathname.
Definition: path.c:329
User aborted the question (with Ctrl-G)
Definition: quad.h:38
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
Definition: init.c:1112
#define mutt_message(...)
Definition: logging.h:83
struct MuttWindow * win_abar
Attachments label.
Definition: compose.c:128
Window uses all available vertical space.
Definition: mutt_window.h:35
struct Email * email
Used by recvattach for updating.
Definition: attach.h:51
int mutt_file_rename(const char *oldfile, const char *newfile)
Rename a file.
Definition: file.c:1340
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:40
struct AddressList bcc
Email&#39;s &#39;Bcc&#39; list.
Definition: envelope.h:60
static void compose_custom_redraw(struct Menu *menu)
Redraw the compose menu - Implements Menu::custom_redraw()
Definition: compose.c:1079
void dialog_pop(void)
Hide a Window from the user.
Definition: mutt_window.c:722
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:125
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:650
"To:" field
Definition: compose.c:150
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: mutt_window.c:697
struct Body * content
List of MIME parts.
Definition: email.h:90
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition: crypt.c:104
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
static void edit_address_list(int field, struct AddressList *al)
Let the user edit the address list.
Definition: compose.c:921
"Cc:" field
Definition: compose.c:151
int mutt_edit_attachment(struct Body *a)
Edit an attachment.
Definition: mutt_attach.c:257
String manipulation buffer.
Definition: buffer.h:33
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
#define _(a)
Definition: message.h:28
static void update_crypt_info(struct ComposeRedrawData *rd)
Update the crypto info.
Definition: compose.c:615
struct Body * next
next attachment in the list
Definition: body.h:53
short idxlen
Number of attachmentes.
Definition: attach.h:55
Compose an email.
Definition: keymap.h:74
struct Context * mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:265
WHERE unsigned char C_Copy
Config: Save outgoing emails to $record.
Definition: globals.h:175
static int calc_envelope(struct ComposeRedrawData *rd)
Calculate how many rows the envelope will need.
Definition: compose.c:475
A division of the screen.
Definition: mutt_window.h:108
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:134
struct ListHead bcc_list
Definition: compose.c:116
struct Email * email
Definition: compose.c:111
char * C_Ispell
Config: External command to perform spell-checking.
Definition: compose.c:98
struct Buffer * fcc
Definition: compose.c:112
#define MUTT_READONLY
Open in read-only mode.
Definition: mx.h:55
"Subject:" field
Definition: compose.c:153
int mutt_env_to_intl(struct Envelope *env, const char **tag, char **err)
Convert an Envelope&#39;s Address fields to Punycode format.
Definition: envelope.c:309
static int check_attachments(struct AttachCtx *actx)
Check if any attachments have changed or been deleted.
Definition: compose.c:695
"From:" field
Definition: compose.c:149
struct NntpAccountData * nntp_select_server(struct Mailbox *m, char *server, bool leave_lock)
Open a connection to an NNTP server.
Definition: newsrc.c:1014
Container for Accounts, Notifications.
Definition: neomutt.h:36
void mutt_buffer_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:688
int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, bool post, const char *fcc, char **finalpath)
Write email to FCC mailbox.
Definition: sendlib.c:3263
The "-- Attachments" line.
Definition: compose.c:169
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:90
The body of an email.
Definition: body.h:34
unsigned int disposition
content-disposition, ContentDisposition
Definition: body.h:67
An Index Window containing a selection list.
Definition: mutt_window.h:93
static void snd_make_entry(char *buf, size_t buflen, struct Menu *menu, int line)
Format a menu item for the attachment list - Implements Menu::make_entry()
Definition: compose.c:325
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:150
#define CUR_ATTACH
Definition: compose.c:140
size_t dsize
Length of data.
Definition: buffer.h:37
void * redraw_data
Definition: mutt_menu.h:152
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top)
Print a list of Attachments.
Definition: recvattach.c:1031
int mutt_get_tmp_attachment(struct Body *a)
Get a temporary copy of an attachment.
Definition: mutt_attach.c:68
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:377
struct Notify * notify
Notifications system.
Definition: mutt_window.h:123
WHERE bool C_EditHeaders
Config: Let the user edit the email headers whilst editing an email.
Definition: globals.h:207
struct Mailbox * mailbox
Definition: context.h:50
struct Body * mutt_body_new(void)
Create a new Body.
Definition: body.c:43
void mutt_generate_boundary(struct ParameterList *pl)
Create a unique boundary id for a MIME part.
Definition: sendlib.c:643
struct Body * mutt_make_file_attach(const char *path)
Create a file attachment.
Definition: sendlib.c:1655
#define STAILQ_INIT(head)
Definition: queue.h:369
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:56
enum ContentType mutt_check_mime_type(const char *s)
Check a MIME type string.
Definition: parse.c:318
struct AddressList from
Email&#39;s &#39;From&#39; list.
Definition: envelope.h:57
struct MuttWindow * win_ibar
Definition: mutt_menu.h:93
int crypt_smime_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu()
Definition: cryptglue.c:533
bool readonly
Don&#39;t allow changes to the mailbox.
Definition: mailbox.h:119
void mutt_update_encoding(struct Body *a)
Update the encoding type.
Definition: sendlib.c:1486
struct MuttWindow * win_envelope
Envelope: From, To, etc.
Definition: compose.c:127
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:153
struct Envelope * env
Envelope information.
Definition: email.h:89
#define ENCODING(x)
Definition: mime.h:85
void mx_fastclose_mailbox(struct Mailbox *m)
free up memory associated with the Mailbox
Definition: mx.c:424
struct AddressList cc
Email&#39;s &#39;Cc&#39; list.
Definition: envelope.h:59
"X-Comment-To:" field
Definition: compose.c:167
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
Content is attached.
Definition: mime.h:63
static void compose_attach_swap(struct Body *msg, struct AttachPtr **idx, short first)
Swap two adjacent entries in the attachment list.
Definition: compose.c:1127
void mutt_rfc3676_space_unstuff(struct Email *e)
Remove RFC3676 space stuffing.
Definition: rfc3676.c:480
struct AttachCtx * mutt_actx_new(void)
Create a new Attachment Context.
Definition: attach.c:131
WHERE short C_Sort
Config: Sort method for the index.
Definition: sort.h:58
bool tagged
This attachment is tagged.
Definition: body.h:70
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
const char * OpStrings[][2]
Definition: opcodes.c:28
Window with a custom drawing function.
Definition: mutt_window.h:91
bool unowned
Don&#39;t unlink on detach.
Definition: attach.h:42
struct Body * mutt_make_multipart(struct Body *b)
Create a multipart email.
Definition: sendlib.c:1751
Window has a fixed size.
Definition: mutt_window.h:44
const char * help
Quickref for the current menu.
Definition: mutt_menu.h:83
char * subtype
content-type subtype
Definition: body.h:37
int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname, bool mailbox, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file.
Definition: curs_lib.c:747
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
#define mutt_b2s(buf)
Definition: buffer.h:41
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:138
WHERE char * C_NewsServer
Config: (nntp) Url of the news server.
Definition: globals.h:125
static const struct Mapping ComposeHelp[]
Definition: compose.c:216
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:49
char * x_comment_to
List of &#39;X-comment-to&#39; fields.
Definition: envelope.h:78
struct ListHead chain
Mixmaster chain.
Definition: email.h:99
int mutt_dlgindex_observer(struct NotifyCallback *nc)
Listen for config changes affecting the Index/Pager - Implements observer_t.
Definition: index.c:4206
WHERE short C_SortAux
Config: Secondary sort method for the index.
Definition: sort.h:59
WHERE struct Context * Context
Definition: globals.h:43
int attach_tag(struct Menu *menu, int sel, int act)
Tag an attachment - Implements Menu::tag()
Definition: recvattach.c:449
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:113
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:137
WHERE bool OptAttachMsg
(pseudo) used by attach-message
Definition: options.h:31
&#39;POP3&#39; Mailbox type
Definition: mailbox.h:55
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
int mutt_check_encoding(const char *c)
Check the encoding type.
Definition: parse.c:391
#define ALTS_TAG
A mailbox.
Definition: mailbox.h:81
#define PATH_MAX
Definition: mutt.h:44
User answered &#39;No&#39;, or assume &#39;No&#39;.
Definition: quad.h:39
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:49
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
bool tagprefix
Definition: mutt_menu.h:90
enum MailboxType nntp_path_probe(const char *path, const struct stat *st)
Is this an NNTP Mailbox? - Implements MxOps::path_probe()
Definition: nntp.c:2836
char * data
Pointer to data.
Definition: buffer.h:35
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
int crypt_pgp_send_menu(struct Email *e)
Wrapper for CryptModuleSpecs::send_menu()
Definition: cryptglue.c:387
FILE * fp
Used in the recvattach menu.
Definition: attach.h:37
static void mutt_update_compose_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Redraw the compose window.
Definition: compose.c:1036
void(* custom_redraw)(struct Menu *menu)
Redraw the menu.
Definition: mutt_menu.h:150
int(* tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:136
char * description
content-description
Definition: body.h:40
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
bool mutt_is_text_part(struct Body *b)
Is this part of an email in plain text?
Definition: muttlib.c:437
static const char *const Prompts[]
Definition: compose.c:175
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
enum MailboxType pop_path_probe(const char *path, const struct stat *st)
Is this a POP Mailbox? - Implements MxOps::path_probe()
Definition: pop.c:1230
int mutt_index_menu(struct MuttWindow *dlg)
Display a list of emails.
Definition: index.c:1138
#define MUTT_SEL_MULTI
Multi-selection is enabled.
Definition: browser.h:46
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:450
static struct Mapping ComposeNewsHelp[]
Definition: compose.c:232
int tagged
Number of tagged entries.
Definition: mutt_menu.h:108
bool notify_observer_add(struct Notify *notify, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:153
#define MUTT_FILE
Do file completion.
Definition: mutt.h:58
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:312
unsigned int type
content-type primary type, ContentType
Definition: body.h:65
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:564
&#39;Notmuch&#39; (virtual) Mailbox type
Definition: mailbox.h:54
"Bcc:" field
Definition: compose.c:152
"Followup-To:" field
Definition: compose.c:166
#define mutt_buffer_get_field(field, buf, complete)
Definition: curs_lib.h:84
#define LINGUAL_TAG
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define SEC_SIGN
Email is signed.
Definition: lib.h:126
bool crypt_has_module_backend(SecurityFlags type)
Is there a crypto backend for a given type?
Definition: cryptglue.c:172
static void update_idx(struct Menu *menu, struct AttachCtx *actx, struct AttachPtr *ap)
Add a new attchment to the message.
Definition: compose.c:1065
struct Connection * conn
Definition: lib.h:104
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:876
void mutt_env_to_local(struct Envelope *env)
Convert an Envelope&#39;s Address fields to local format.
Definition: envelope.c:271
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:168
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1328
struct Body * crypt_pgp_make_key_attachment(void)
Wrapper for CryptModuleSpecs::pgp_make_key_attachment()
Definition: cryptglue.c:308
void mutt_actx_entries_free(struct AttachCtx *actx)
Free entries in an Attachment Context.
Definition: attach.c:103
char * subject
Email&#39;s subject.
Definition: envelope.h:66
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:327
Log at debug level 1.
Definition: logging.h:40
char * newsgroups
List of newsgroups.
Definition: envelope.h:75
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
Definition: hook.h:56
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:724
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
Compose Dialog, mutt_compose_menu()
Definition: mutt_window.h:79
WHERE bool C_XCommentTo
Config: (nntp) Add &#39;X-Comment-To&#39; header that contains article author.
Definition: globals.h:278
struct Body * content
Attachment.
Definition: attach.h:36
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:432
unsigned char C_Postpone
Config: Save messages to the C_Postponed folder.
Definition: compose.c:99
#define mutt_error(...)
Definition: logging.h:84
int mutt_builtin_editor(const char *path, struct Email *e_new, struct Email *e_cur)
Show the user the built-in editor.
Definition: edit.c:401
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
Definition: body.h:69
void mutt_rfc3676_space_stuff(struct Email *e)
Perform RFC3676 space stuffing on an Email.
Definition: rfc3676.c:463
char * followup_to
List of &#39;followup-to&#39; fields.
Definition: envelope.h:77
static void autocrypt_compose_menu(struct Email *e)
Autocrypt compose settings.
Definition: compose.c:339
WHERE char * C_Editor
Config: External command to use as an email editor.
Definition: globals.h:109
struct MuttWindow * win_cbar
Compose bar.
Definition: compose.c:130
struct ListHead cc_list
Definition: compose.c:115
#define FREE(x)
Definition: memory.h:40
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
Definition: mx.c:1671
#define MUTT_COMPOSE_NOFREEHEADER
Definition: compose.h:35
#define STAILQ_EMPTY(head)
Definition: queue.h:345
struct MuttWindow * win_attach
List of Attachments.
Definition: compose.c:129
void index_pager_shutdown(struct MuttWindow *dlg)
Clear up any non-Window parts.
Definition: index.c:4191
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:84
short req_rows
Number of rows required.
Definition: mutt_window.h:111
struct AddressList to
Email&#39;s &#39;To&#39; list.
Definition: envelope.h:58
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:185
"Newsgroups:" field
Definition: compose.c:165
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:82
static void init_header_padding(void)
Calculate how much padding the compose table will need.
Definition: compose.c:294
struct MuttWindow * index_pager_init(void)
Allocate the Windows for the Index/Pager.
Definition: index.c:4154
struct ListHead to_list
Definition: compose.c:114
void ctx_free(struct Context **ptr)
Free a Context.
Definition: context.c:48
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:573
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition: body.c:57
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:131
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
Definition: commands.c:1249
int current
Current entry.
Definition: mutt_menu.h:85
WHERE bool OptNewsSend
(pseudo) used to change behavior when posting
Definition: options.h:46
"Fcc:" (save folder) field
Definition: compose.c:155
#define CHECK_COUNT
Definition: compose.c:133
struct MuttWindow * win_index
Definition: mutt_menu.h:92
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:588
char * mutt_compile_help(char *buf, size_t buflen, enum MenuType menu, const struct Mapping *items)
Create the text for the help menu.
Definition: help.c:110
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition: newsrc.c:563
Window wants as much space as possible.
Definition: mutt_window.h:45
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
Content is inline.
Definition: mime.h:62
struct ParameterList parameter
parameters of the content-type
Definition: body.h:39
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
struct Email * email
header information for message/rfc822
Definition: body.h:55
Index Bar containing status info about the Index.
Definition: mutt_window.h:94
A set of attachments.
Definition: attach.h:49
Encoding unknown.
Definition: mime.h:48
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
void(* make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:117
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
Definition: curs_lib.c:353
WHERE bool OptNews
(pseudo) used to change reader mode
Definition: options.h:45
Keep track when the compose screen needs redrawing.
Definition: compose.c:109
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:51
#define mutt_buffer_enter_fname(prompt, fname, mailbox)
Definition: curs_lib.h:87
QuadOption
Possible values for a quad-option.
Definition: quad.h:36
UUEncoded text.
Definition: mime.h:54
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:43
int mutt_compose_attachment(struct Body *a)
Create an attachment.
Definition: mutt_attach.c:118
int mix_check_message(struct Email *e)
Safety-check the message before passing it to mixmaster.
Definition: remailer.c:856
static int mutt_dlg_compose_observer(struct NotifyCallback *nc)
Listen for config changes affecting the Compose menu - Implements observer_t.
Definition: compose.c:1275
ContentType
Content-Type.
Definition: mime.h:29
"Reply-To:" field
Definition: compose.c:154
+ Here is the caller graph for this function:

Variable Documentation

◆ C_ComposeFormat

char* C_ComposeFormat

Config: printf-like format string for the Compose panel's status bar.

Definition at line 97 of file compose.c.

◆ C_Ispell

char* C_Ispell

Config: External command to perform spell-checking.

Definition at line 98 of file compose.c.

◆ C_Postpone

unsigned char C_Postpone

Config: Save messages to the C_Postponed folder.

Definition at line 99 of file compose.c.

◆ There_are_no_attachments

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

Definition at line 101 of file compose.c.

◆ HeaderPadding

int HeaderPadding[HDR_ATTACH_TITLE] = { 0 }

Definition at line 172 of file compose.c.

◆ MaxHeaderWidth

int MaxHeaderWidth = 0

Definition at line 173 of file compose.c.

◆ Prompts

const char* const Prompts[]
static

Definition at line 175 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 },
}
#define N_(a)
Definition: message.h:32

Definition at line 216 of file compose.c.

◆ ComposeNewsHelp

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 },
}
#define N_(a)
Definition: message.h:32

Definition at line 232 of file compose.c.

◆ AutocryptRecUiFlags

const char* AutocryptRecUiFlags[]
static
Initial value:
= {
N_("Off"),
N_("No"),
N_("Discouraged"),
N_("Available"),
N_("Yes"),
}
#define N_(a)
Definition: message.h:32

Definition at line 245 of file compose.c.