NeoMutt  2018-07-16 +1783-b00bd9
Teaching an old dog new tricks
DOXYGEN
recvattach.c File Reference

Routines for managing attachments. More...

#include "config.h"
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "mutt/mutt.h"
#include "config/lib.h"
#include "email/lib.h"
#include "mutt.h"
#include "recvattach.h"
#include "commands.h"
#include "context.h"
#include "curs_lib.h"
#include "filter.h"
#include "format_flags.h"
#include "globals.h"
#include "handler.h"
#include "hdrline.h"
#include "hook.h"
#include "keymap.h"
#include "mailbox.h"
#include "mutt_attach.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt_parse.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "mx.h"
#include "ncrypt/ncrypt.h"
#include "opcodes.h"
#include "options.h"
#include "recvcmd.h"
#include "rfc1524.h"
#include "send.h"
#include "sendlib.h"
#include "state.h"
#include <libintl.h>
+ Include dependency graph for recvattach.c:

Go to the source code of this file.

Macros

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

Functions

static void mutt_update_recvattach_menu (struct AttachCtx *actx, struct Menu *menu, bool init)
 Update the Attachment Menu. More...
 
static void mutt_update_v2r (struct AttachCtx *actx)
 Update the virtual list of attachments. More...
 
void mutt_update_tree (struct AttachCtx *actx)
 Refresh the list of attachments. More...
 
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, unsigned long data, MuttFormatFlags flags)
 Format a string for the attachment menu - Implements format_t. More...
 
static void attach_make_entry (char *buf, size_t buflen, struct Menu *menu, int line)
 Format a menu item for the attachment list - Implements Menu::menu_make_entry() More...
 
int attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - Implements Menu::menu_tag() More...
 
static void prepend_savedir (char *buf, size_t bufsize)
 Add C_AttachSaveDir to the beginning of a path. More...
 
static int query_save_attachment (FILE *fp, struct Body *body, struct Email *e, char **directory)
 Ask the user if we should save the attachment. More...
 
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. More...
 
static void query_pipe_attachment (char *command, FILE *fp, struct Body *body, bool filter)
 Ask the user if we should pipe the attachment. More...
 
static void pipe_attachment (FILE *fp, struct Body *b, struct State *state)
 Pipe the attachment to a command. More...
 
static void pipe_attachment_list (char *command, struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, bool filter, struct State *state)
 Pipe a list of attachments to a command. More...
 
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. More...
 
static bool can_print (struct AttachCtx *actx, struct Body *top, bool tag)
 Do we know how to print this attachment type? More...
 
static void print_attachment_list (struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, struct State *state)
 Print a list of Attachments. More...
 
void mutt_print_attachment_list (struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top)
 Print a list of Attachments. More...
 
static void recvattach_extract_pgp_keys (struct AttachCtx *actx, struct Menu *menu)
 Extract PGP keys from attachments. More...
 
static int recvattach_pgp_check_traditional (struct AttachCtx *actx, struct Menu *menu)
 Is the Attachment inline PGP? More...
 
static void recvattach_edit_content_type (struct AttachCtx *actx, struct Menu *menu, struct Email *e)
 Edit the content type of an attachment. More...
 
int mutt_attach_display_loop (struct Menu *menu, int op, struct Email *e, struct AttachCtx *actx, bool recv)
 Event loop for the Attachment menu. More...
 
void mutt_generate_recvattach_list (struct AttachCtx *actx, struct Email *e, struct Body *parts, FILE *fp, int parent_type, int level, bool decrypted)
 Create a list of attachments. More...
 
void mutt_attach_init (struct AttachCtx *actx)
 Create a new Attachment context. More...
 
static void attach_collapse (struct AttachCtx *actx, struct Menu *menu)
 Close the tree of the current attachment. More...
 
void mutt_view_attachments (struct Email *e)
 Show the attachments in a Menu. More...
 

Variables

char * C_AttachSaveDir
 Config: Default directory where attachments are saved. More...
 
char * C_AttachSep
 Config: Separator to add between saved/printed/piped attachments. More...
 
bool C_AttachSplit
 Config: Save/print/pipe tagged messages individually. More...
 
bool C_DigestCollapse
 Config: Hide the subparts of a multipart/digest. More...
 
char * C_MessageFormat
 Config: printf-like format string for listing attached messages. More...
 
static const char * Mailbox_is_read_only = N_("Mailbox is read-only")
 
static const struct Mapping AttachHelp []
 
static const char * Function_not_permitted
 

Detailed Description

Routines for managing attachments.

Authors
  • Michael R. Elkins
  • Thomas Roessler

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

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

Definition in file recvattach.c.

Macro Definition Documentation

#define CHECK_READONLY
Value:
{ \
break; \
}
The "current" mailbox.
Definition: context.h:38
static const char * Mailbox_is_read_only
Definition: recvattach.c:81
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:785
#define _(a)
Definition: message.h:28
struct Mailbox * mailbox
Definition: context.h:52
bool readonly
don&#39;t allow changes to the mailbox
Definition: mailbox.h:119
#define mutt_error(...)
Definition: logging.h:83

Definition at line 83 of file recvattach.c.

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

Definition at line 91 of file recvattach.c.

#define CHECK_ATTACH
Value:
{ \
break; \
}
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:785
#define _(a)
Definition: message.h:28
WHERE bool OptAttachMsg
(pseudo) used by attach-message
Definition: options.h:31
#define mutt_error(...)
Definition: logging.h:83
static const char * Function_not_permitted
Definition: recvattach.c:98

Definition at line 101 of file recvattach.c.

Function Documentation

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

Update the Attachment Menu.

Parameters
actxAttachment context
menuMenu listing Attachments
initIf true, create a new Attachments context

Definition at line 1273 of file recvattach.c.

1274 {
1275  if (init)
1276  {
1277  mutt_generate_recvattach_list(actx, actx->email, actx->email->content,
1278  actx->fp_root, -1, 0, 0);
1279  mutt_attach_init(actx);
1280  menu->data = actx;
1281  }
1282 
1283  mutt_update_tree(actx);
1284 
1285  menu->max = actx->vcount;
1286 
1287  if (menu->current >= menu->max)
1288  menu->current = menu->max - 1;
1289  menu_check_recenter(menu);
1290  menu->redraw |= REDRAW_INDEX;
1291 }
void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Email *e, struct Body *parts, FILE *fp, int parent_type, int level, bool decrypted)
Create a list of attachments.
Definition: recvattach.c:1140
struct Email * email
used by recvattach for updating
Definition: attach.h:51
struct Body * content
list of MIME parts
Definition: email.h:93
FILE * fp_root
used by recvattach for updating
Definition: attach.h:52
void mutt_attach_init(struct AttachCtx *actx)
Create a new Attachment context.
Definition: recvattach.c:1248
int max
the number of entries in the menu
Definition: mutt_menu.h:88
MuttRedrawFlags redraw
when to redraw the screen
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
void mutt_update_tree(struct AttachCtx *actx)
Refresh the list of attachments.
Definition: recvattach.c:143
void * data
extra data for the current menu
Definition: mutt_menu.h:86
int current
current entry
Definition: mutt_menu.h:87
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:

static void mutt_update_v2r ( struct AttachCtx actx)
static

Update the virtual list of attachments.

Parameters
actxAttachment context

Update the record of the number of attachments and the status of the tree.

Definition at line 115 of file recvattach.c.

116 {
117  int vindex, rindex, curlevel;
118 
119  vindex = 0;
120  rindex = 0;
121 
122  while (rindex < actx->idxlen)
123  {
124  actx->v2r[vindex++] = rindex;
125  if (actx->idx[rindex]->content->collapsed)
126  {
127  curlevel = actx->idx[rindex]->level;
128  do
129  rindex++;
130  while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel));
131  }
132  else
133  rindex++;
134  }
135 
136  actx->vcount = vindex;
137 }
bool collapsed
used by recvattach
Definition: body.h:100
short * v2r
mapping from virtual to real attachment
Definition: attach.h:58
struct Body * content
Definition: attach.h:36
int level
Definition: attach.h:40
struct AttachPtr ** idx
Definition: attach.h:54
short vcount
the number of virtual attachments
Definition: attach.h:59

+ Here is the caller graph for this function:

void mutt_update_tree ( struct AttachCtx actx)

Refresh the list of attachments.

Parameters
actxAttachment context

Definition at line 143 of file recvattach.c.

144 {
145  char buf[256];
146  char *s = NULL;
147 
148  mutt_update_v2r(actx);
149 
150  for (int vindex = 0; vindex < actx->vcount; vindex++)
151  {
152  const int rindex = actx->v2r[vindex];
153  actx->idx[rindex]->num = vindex;
154  if ((2 * (actx->idx[rindex]->level + 2)) < sizeof(buf))
155  {
156  if (actx->idx[rindex]->level)
157  {
158  s = buf + 2 * (actx->idx[rindex]->level - 1);
159  *s++ = (actx->idx[rindex]->content->next) ? MUTT_TREE_LTEE : MUTT_TREE_LLCORNER;
160  *s++ = MUTT_TREE_HLINE;
161  *s++ = MUTT_TREE_RARROW;
162  }
163  else
164  s = buf;
165  *s = '\0';
166  }
167 
168  if (actx->idx[rindex]->tree)
169  {
170  if (mutt_str_strcmp(actx->idx[rindex]->tree, buf) != 0)
171  mutt_str_replace(&actx->idx[rindex]->tree, buf);
172  }
173  else
174  actx->idx[rindex]->tree = mutt_str_strdup(buf);
175 
176  if (((2 * (actx->idx[rindex]->level + 2)) < sizeof(buf)) &&
177  actx->idx[rindex]->level)
178  {
179  s = buf + 2 * (actx->idx[rindex]->level - 1);
180  *s++ = (actx->idx[rindex]->content->next) ? '\005' : '\006';
181  *s++ = '\006';
182  }
183  }
184 }
Lower left corner.
Definition: mutt_menu.h:61
struct Body * next
next attachment in the list
Definition: body.h:60
Right arrow.
Definition: mutt_menu.h:67
char * tree
Definition: attach.h:39
static void mutt_update_v2r(struct AttachCtx *actx)
Update the virtual list of attachments.
Definition: recvattach.c:115
int num
Definition: attach.h:41
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:456
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:380
short * v2r
mapping from virtual to real attachment
Definition: attach.h:58
struct Body * content
Definition: attach.h:36
int level
Definition: attach.h:40
struct AttachPtr ** idx
Definition: attach.h:54
Left T-piece.
Definition: mutt_menu.h:63
int mutt_str_strcmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:618
short vcount
the number of virtual attachments
Definition: attach.h:59
Horizontal line.
Definition: mutt_menu.h:64

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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,
unsigned long  data,
MuttFormatFlags  flags 
)

Format a string for the attachment menu - Implements format_t.

Expando Description
%C Character set
%c Character set: convert?
%D Deleted flag
%d Description
%e MIME content-transfer-encoding
%f Filename
%F Filename for content-disposition header
%I Content-disposition, either I (inline) or A (attachment)
%m Major MIME type
%M MIME subtype
%n Attachment number
%Q 'Q', if MIME part qualifies for attachment counting
%s Size
%t Tagged flag
%T Tree chars
%u Unlink
%X Number of qualifying MIME parts in this part and its children

Definition at line 209 of file recvattach.c.

213 {
214  char fmt[128];
215  char charset[128];
216  struct AttachPtr *aptr = (struct AttachPtr *) data;
217  int optional = (flags & MUTT_FORMAT_OPTIONAL);
218 
219  switch (op)
220  {
221  case 'C':
222  if (!optional)
223  {
224  if (mutt_is_text_part(aptr->content) &&
225  mutt_body_get_charset(aptr->content, charset, sizeof(charset)))
226  {
227  mutt_format_s(buf, buflen, prec, charset);
228  }
229  else
230  mutt_format_s(buf, buflen, prec, "");
231  }
232  else if (!mutt_is_text_part(aptr->content) ||
233  !mutt_body_get_charset(aptr->content, charset, sizeof(charset)))
234  {
235  optional = 0;
236  }
237  break;
238  case 'c':
239  /* XXX */
240  if (!optional)
241  {
242  snprintf(fmt, sizeof(fmt), "%%%sc", prec);
243  snprintf(buf, buflen, fmt,
244  ((aptr->content->type != TYPE_TEXT) || aptr->content->noconv) ? 'n' : 'c');
245  }
246  else if ((aptr->content->type != TYPE_TEXT) || aptr->content->noconv)
247  optional = 0;
248  break;
249  case 'd':
250  if (!optional)
251  {
252  if (aptr->content->description)
253  {
254  mutt_format_s(buf, buflen, prec, aptr->content->description);
255  break;
256  }
257  if (mutt_is_message_type(aptr->content->type, aptr->content->subtype) &&
258  C_MessageFormat && aptr->content->email)
259  {
260  char s[128];
261  mutt_make_string_flags(s, sizeof(s), C_MessageFormat, NULL, NULL,
262  aptr->content->email,
264  if (*s)
265  {
266  mutt_format_s(buf, buflen, prec, s);
267  break;
268  }
269  }
270  if (!aptr->content->d_filename && !aptr->content->filename)
271  {
272  mutt_format_s(buf, buflen, prec, "<no description>");
273  break;
274  }
275  }
276  else if (aptr->content->description ||
277  (mutt_is_message_type(aptr->content->type, aptr->content->subtype) &&
278  C_MessageFormat && aptr->content->email))
279  {
280  break;
281  }
282  /* fallthrough */
283  case 'F':
284  if (!optional)
285  {
286  if (aptr->content->d_filename)
287  {
288  mutt_format_s(buf, buflen, prec, aptr->content->d_filename);
289  break;
290  }
291  }
292  else if (!aptr->content->d_filename && !aptr->content->filename)
293  {
294  optional = 0;
295  break;
296  }
297  /* fallthrough */
298  case 'f':
299  if (!optional)
300  {
301  if (aptr->content->filename && (*aptr->content->filename == '/'))
302  {
303  char path[PATH_MAX];
304 
305  mutt_str_strfcpy(path, aptr->content->filename, sizeof(path));
306  mutt_pretty_mailbox(path, sizeof(path));
307  mutt_format_s(buf, buflen, prec, path);
308  }
309  else
310  mutt_format_s(buf, buflen, prec, NONULL(aptr->content->filename));
311  }
312  else if (!aptr->content->filename)
313  optional = 0;
314  break;
315  case 'D':
316  if (!optional)
317  snprintf(buf, buflen, "%c", aptr->content->deleted ? 'D' : ' ');
318  else if (!aptr->content->deleted)
319  optional = 0;
320  break;
321  case 'e':
322  if (!optional)
323  mutt_format_s(buf, buflen, prec, ENCODING(aptr->content->encoding));
324  break;
325  case 'I':
326  if (!optional)
327  {
328  const char dispchar[] = { 'I', 'A', 'F', '-' };
329  char ch;
330 
331  if (aptr->content->disposition < sizeof(dispchar))
332  ch = dispchar[aptr->content->disposition];
333  else
334  {
335  mutt_debug(LL_DEBUG1, "ERROR: invalid content-disposition %d\n",
336  aptr->content->disposition);
337  ch = '!';
338  }
339  snprintf(buf, buflen, "%c", ch);
340  }
341  break;
342  case 'm':
343  if (!optional)
344  mutt_format_s(buf, buflen, prec, TYPE(aptr->content));
345  break;
346  case 'M':
347  if (!optional)
348  mutt_format_s(buf, buflen, prec, aptr->content->subtype);
349  else if (!aptr->content->subtype)
350  optional = 0;
351  break;
352  case 'n':
353  if (!optional)
354  {
355  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
356  snprintf(buf, buflen, fmt, aptr->num + 1);
357  }
358  break;
359  case 'Q':
360  if (optional)
361  optional = aptr->content->attach_qualifies;
362  else
363  {
364  snprintf(fmt, sizeof(fmt), "%%%sc", prec);
365  mutt_format_s(buf, buflen, fmt, "Q");
366  }
367  break;
368  case 's':
369  {
370  size_t l;
371  if (flags & MUTT_FORMAT_STAT_FILE)
372  {
373  struct stat st;
374  stat(aptr->content->filename, &st);
375  l = st.st_size;
376  }
377  else
378  l = aptr->content->length;
379 
380  if (!optional)
381  {
382  char tmp[128];
383  mutt_str_pretty_size(tmp, sizeof(tmp), l);
384  mutt_format_s(buf, buflen, prec, tmp);
385  }
386  else if (l == 0)
387  optional = 0;
388 
389  break;
390  }
391  case 't':
392  if (!optional)
393  snprintf(buf, buflen, "%c", aptr->content->tagged ? '*' : ' ');
394  else if (!aptr->content->tagged)
395  optional = 0;
396  break;
397  case 'T':
398  if (!optional)
399  mutt_format_s_tree(buf, buflen, prec, NONULL(aptr->tree));
400  else if (!aptr->tree)
401  optional = 0;
402  break;
403  case 'u':
404  if (!optional)
405  snprintf(buf, buflen, "%c", aptr->content->unlink ? '-' : ' ');
406  else if (!aptr->content->unlink)
407  optional = 0;
408  break;
409  case 'X':
410  if (optional)
411  optional = (aptr->content->attach_count + aptr->content->attach_qualifies) != 0;
412  else
413  {
414  snprintf(fmt, sizeof(fmt), "%%%sd", prec);
415  snprintf(buf, buflen, fmt, aptr->content->attach_count + aptr->content->attach_qualifies);
416  }
417  break;
418  default:
419  *buf = '\0';
420  }
421 
422  if (optional)
423  mutt_expando_format(buf, buflen, col, cols, if_str, attach_format_str, data,
425  else if (flags & MUTT_FORMAT_OPTIONAL)
426  mutt_expando_format(buf, buflen, col, cols, else_str, attach_format_str,
427  data, MUTT_FORMAT_NO_FLAGS);
428  return src;
429 }
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:836
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:48
#define NONULL(x)
Definition: string2.h:36
An email to which things will be attached.
Definition: attach.h:34
char * C_MessageFormat
Config: printf-like format string for listing attached messages.
Definition: recvattach.c:77
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
Definition: parse.c:1260
#define MUTT_FORMAT_FORCESUBJ
Print the subject even if unchanged.
Definition: format_flags.h:31
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
bool noconv
don&#39;t do character set conversion
Definition: body.h:82
#define MUTT_FORMAT_STAT_FILE
Used by attach_format_str.
Definition: format_flags.h:34
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: format_flags.h:30
unsigned int disposition
content-disposition
Definition: body.h:74
char * tree
Definition: attach.h:39
bool attach_qualifies
Definition: body.h:101
#define ENCODING(x)
Definition: mime.h:85
void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Context *ctx, struct Mailbox *m, struct Email *e, MuttFormatFlags flags)
Create formatted strings using mailbox expandos.
Definition: hdrline.c:1491
signed short attach_count
Definition: body.h:66
bool tagged
Definition: body.h:79
unsigned int encoding
content-transfer-encoding
Definition: body.h:73
char * subtype
content-type subtype
Definition: body.h:37
LOFF_T length
length (in bytes) of attachment
Definition: body.h:47
#define PATH_MAX
Definition: mutt.h:49
int num
Definition: attach.h:41
Type: &#39;text/*&#39;.
Definition: mime.h:38
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
char * mutt_body_get_charset(struct Body *b, char *buf, size_t buflen)
Get a body&#39;s character set.
Definition: sendlib.c:1423
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:615
char * description
content-description
Definition: body.h:40
bool mutt_is_text_part(struct Body *b)
Is this part of an email in plain text?
Definition: muttlib.c:437
unsigned int type
content-type primary type
Definition: body.h:72
bool deleted
attachment marked for deletion
Definition: body.h:80
#define TYPE(body)
Definition: mime.h:83
void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string.
Definition: curs_lib.c:1124
Log at debug level 1.
Definition: logging.h:56
struct Body * content
Definition: attach.h:36
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, unsigned long data, MuttFormatFlags flags)
Format a string for the attachment menu - Implements format_t.
Definition: recvattach.c:209
bool unlink
flag to indicate the file named by "filename" should be unlink()ed before free()ing this structure ...
Definition: body.h:76
#define MUTT_FORMAT_OPTIONAL
Allow optional field processing.
Definition: format_flags.h:33
char * d_filename
filename to be used for the content-disposition header.
Definition: body.h:50
#define mutt_debug(LEVEL,...)
Definition: logging.h:80
void mutt_str_pretty_size(char *buf, size_t buflen, size_t num)
Display an abbreviated size, like 3.4K.
Definition: string.c:1049
struct Email * email
header information for message/rfc822
Definition: body.h:62
void mutt_format_s_tree(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string with tree characters.
Definition: curs_lib.c:1136

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Definition at line 434 of file recvattach.c.

435 {
436  struct AttachCtx *actx = menu->data;
437 
439  attach_format_str, (unsigned long) (actx->idx[actx->v2r[line]]),
441 }
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, MuttFormatFlags flags)
Expand expandos (x) in a string.
Definition: muttlib.c:836
#define NONULL(x)
Definition: string2.h:36
WHERE char * C_AttachFormat
Config: printf-like format string for the attachment menu.
Definition: globals.h:98
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
const char * line
Definition: common.c:35
struct MuttWindow * MuttIndexWindow
Index Window.
Definition: mutt_window.c:39
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, unsigned long data, MuttFormatFlags flags)
Format a string for the attachment menu - Implements format_t.
Definition: recvattach.c:209
void * data
extra data for the current menu
Definition: mutt_menu.h:86
A set of attachments.
Definition: attach.h:49
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int attach_tag ( struct Menu menu,
int  sel,
int  act 
)

Tag an attachment - Implements Menu::menu_tag()

Definition at line 446 of file recvattach.c.

447 {
448  struct AttachCtx *actx = menu->data;
449  struct Body *cur = actx->idx[actx->v2r[sel]]->content;
450  bool ot = cur->tagged;
451 
452  cur->tagged = ((act >= 0) ? act : !cur->tagged);
453  return cur->tagged - ot;
454 }
The body of an email.
Definition: body.h:34
bool tagged
Definition: body.h:79
short * v2r
mapping from virtual to real attachment
Definition: attach.h:58
struct Body * content
Definition: attach.h:36
void * data
extra data for the current menu
Definition: mutt_menu.h:86
A set of attachments.
Definition: attach.h:49
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the caller graph for this function:

static void prepend_savedir ( char *  buf,
size_t  bufsize 
)
static

Add C_AttachSaveDir to the beginning of a path.

Parameters
bufBuffer for the result, must be valid
bufsizeSize of the buffer

Definition at line 461 of file recvattach.c.

462 {
463  const char *savedir = C_AttachSaveDir;
464 
465  if (buf[0] == '/')
466  return;
467 
468  if (!savedir || !*savedir)
469  savedir = "./";
470 
471  size_t savedirlen = strlen(savedir);
472  size_t buflen = strlen(buf);
473  bool addsep = (savedir[savedirlen - 1] != '/');
474  size_t newbuflen = savedirlen + buflen + addsep;
475 
476  if (bufsize < newbuflen)
477  {
478  return;
479  }
480 
481  memmove(buf + savedirlen + addsep, buf, buflen);
482  memcpy(buf, savedir, savedirlen);
483  if (addsep)
484  {
485  buf[savedirlen] = '/';
486  }
487  buf[newbuflen] = '\0';
488 }
char * C_AttachSaveDir
Config: Default directory where attachments are saved.
Definition: recvattach.c:73

+ Here is the caller graph for this function:

static int query_save_attachment ( FILE *  fp,
struct Body body,
struct Email e,
char **  directory 
)
static

Ask the user if we should save the attachment.

Parameters
[in]fpFile handle to the attachment (OPTIONAL)
[in]bodyAttachment
[in]eEmail
[out]directoryWhere the attachment was saved
Return values
0Success
-1Failure

Definition at line 499 of file recvattach.c.

500 {
501  char *prompt = NULL;
502  char buf[PATH_MAX], tfile[PATH_MAX];
503  enum SaveAttach opt = MUTT_SAVE_NO_FLAGS;
504  int rc;
505 
506  if (body->filename)
507  {
508  if (directory && *directory)
509  {
510  mutt_path_concat(buf, *directory, mutt_path_basename(body->filename), sizeof(buf));
511  }
512  else
513  mutt_str_strfcpy(buf, body->filename, sizeof(buf));
514  }
515  else if (body->email && (body->encoding != ENC_BASE64) &&
516  (body->encoding != ENC_QUOTED_PRINTABLE) &&
517  mutt_is_message_type(body->type, body->subtype))
518  {
519  mutt_default_save(buf, sizeof(buf), body->email);
520  }
521  else
522  buf[0] = '\0';
523 
524  prepend_savedir(buf, sizeof(buf));
525 
526  prompt = _("Save to file: ");
527  while (prompt)
528  {
529  if ((mutt_get_field(prompt, buf, sizeof(buf), MUTT_FILE) != 0) || (buf[0] == '\0'))
530  {
532  return -1;
533  }
534 
535  prompt = NULL;
536  mutt_expand_path(buf, sizeof(buf));
537 
538  bool is_message = (fp && body->email && (body->encoding != ENC_BASE64) &&
539  (body->encoding != ENC_QUOTED_PRINTABLE) &&
540  mutt_is_message_type(body->type, body->subtype));
541 
542  if (is_message)
543  {
544  struct stat st;
545 
546  /* check to make sure that this file is really the one the user wants */
547  rc = mutt_save_confirm(buf, &st);
548  if (rc == 1)
549  {
550  prompt = _("Save to file: ");
551  continue;
552  }
553  else if (rc == -1)
554  return -1;
555  mutt_str_strfcpy(tfile, buf, sizeof(tfile));
556  }
557  else
558  {
559  rc = mutt_check_overwrite(body->filename, buf, tfile, sizeof(tfile), &opt, directory);
560  if (rc == -1)
561  return -1;
562  else if (rc == 1)
563  {
564  prompt = _("Save to file: ");
565  continue;
566  }
567  }
568 
569  mutt_message(_("Saving..."));
570  if (mutt_save_attachment(fp, body, tfile, opt, (e || !is_message) ? e : body->email) == 0)
571  {
572  mutt_message(_("Attachment saved"));
573  return 0;
574  }
575  else
576  {
577  prompt = _("Save to file: ");
578  continue;
579  }
580  }
581  return 0;
582 }
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:48
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
Definition: parse.c:1260
const char * mutt_path_basename(const char *f)
Find the last component for a pathname.
Definition: path.c:306
#define mutt_message(...)
Definition: logging.h:82
No flags set.
Definition: mutt_attach.h:54
#define _(a)
Definition: message.h:28
int mutt_save_attachment(FILE *fp, struct Body *m, const char *path, enum SaveAttach opt, struct Email *e)
Save an attachment.
Definition: mutt_attach.c:806
static void prepend_savedir(char *buf, size_t bufsize)
Add C_AttachSaveDir to the beginning of a path.
Definition: recvattach.c:461
void mutt_default_save(char *path, size_t pathlen, struct Email *e)
Find the default save path for an email.
Definition: hook.c:661
int mutt_save_confirm(const char *s, struct stat *st)
Ask the user to save.
Definition: muttlib.c:1404
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:86
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:127
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:141
unsigned int encoding
content-transfer-encoding
Definition: body.h:73
Base-64 encoded text.
Definition: mime.h:52
int mutt_check_overwrite(const char *attname, const char *path, char *fname, size_t flen, enum SaveAttach *opt, char **directory)
Ask the user if overwriting is necessary.
Definition: muttlib.c:709
char * subtype
content-type subtype
Definition: body.h:37
#define PATH_MAX
Definition: mutt.h:49
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
#define MUTT_FILE
Do file completion.
Definition: mutt.h:63
unsigned int type
content-type primary type
Definition: body.h:72
Quoted-printable text.
Definition: mime.h:51
char * mutt_path_concat(char *d, const char *dir, const char *fname, size_t l)
Join a directory name and a filename.
Definition: path.c:329
struct Email * email
header information for message/rfc822
Definition: body.h:62
SaveAttach
Options for saving attachments.
Definition: mutt_attach.h:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
actxAttachment context
fpFile handle for the attachment (OPTIONAL)
tagIf true, only save the tagged attachments
topFirst Attachment
eEmail
menuMenu listing attachments

Definition at line 593 of file recvattach.c.

595 {
596  char buf[PATH_MAX], tfile[PATH_MAX];
597  char *directory = NULL;
598  int rc = 1;
599  int last = menu ? menu->current : -1;
600  FILE *fp_out = NULL;
601 
602  buf[0] = '\0';
603 
604  for (int i = 0; !tag || (i < actx->idxlen); i++)
605  {
606  if (tag)
607  {
608  fp = actx->idx[i]->fp;
609  top = actx->idx[i]->content;
610  }
611  if (!tag || top->tagged)
612  {
613  if (!C_AttachSplit)
614  {
615  if (buf[0] == '\0')
616  {
617  enum SaveAttach opt = MUTT_SAVE_NO_FLAGS;
618 
619  mutt_str_strfcpy(buf, mutt_path_basename(NONULL(top->filename)), sizeof(buf));
620  prepend_savedir(buf, sizeof(buf));
621 
622  if ((mutt_get_field(_("Save to file: "), buf, sizeof(buf), MUTT_FILE) != 0) ||
623  !buf[0])
624  {
625  return;
626  }
627  mutt_expand_path(buf, sizeof(buf));
628  if (mutt_check_overwrite(top->filename, buf, tfile, sizeof(tfile), &opt, NULL))
629  return;
630  rc = mutt_save_attachment(fp, top, tfile, opt, e);
631  if ((rc == 0) && C_AttachSep && (fp_out = fopen(tfile, "a")))
632  {
633  fprintf(fp_out, "%s", C_AttachSep);
634  mutt_file_fclose(&fp_out);
635  }
636  }
637  else
638  {
639  rc = mutt_save_attachment(fp, top, tfile, MUTT_SAVE_APPEND, e);
640  if ((rc == 0) && C_AttachSep && (fp_out = fopen(tfile, "a")))
641  {
642  fprintf(fp_out, "%s", C_AttachSep);
643  mutt_file_fclose(&fp_out);
644  }
645  }
646  }
647  else
648  {
649  if (tag && menu && top->aptr)
650  {
651  menu->oldcurrent = menu->current;
652  menu->current = top->aptr->num;
653  menu_check_recenter(menu);
654  menu->redraw |= REDRAW_MOTION;
655 
656  menu_redraw(menu);
657  }
658  if (query_save_attachment(fp, top, e, &directory) == -1)
659  break;
660  }
661  }
662  if (!tag)
663  break;
664  }
665 
666  FREE(&directory);
667 
668  if (tag && menu)
669  {
670  menu->oldcurrent = menu->current;
671  menu->current = last;
672  menu_check_recenter(menu);
673  menu->redraw |= REDRAW_MOTION;
674  }
675 
676  if (!C_AttachSplit && (rc == 0))
677  mutt_message(_("Attachment saved"));
678 }
bool C_AttachSplit
Config: Save/print/pipe tagged messages individually.
Definition: recvattach.c:75
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:48
#define NONULL(x)
Definition: string2.h:36
const char * mutt_path_basename(const char *f)
Find the last component for a pathname.
Definition: path.c:306
#define mutt_message(...)
Definition: logging.h:82
int oldcurrent
for driver use only
Definition: mutt_menu.h:111
No flags set.
Definition: mutt_attach.h:54
char * C_AttachSep
Config: Separator to add between saved/printed/piped attachments.
Definition: recvattach.c:74
#define _(a)
Definition: message.h:28
short idxlen
Definition: attach.h:55
static int query_save_attachment(FILE *fp, struct Body *body, struct Email *e, char **directory)
Ask the user if we should save the attachment.
Definition: recvattach.c:499
int mutt_save_attachment(FILE *fp, struct Body *m, const char *path, enum SaveAttach opt, struct Email *e)
Save an attachment.
Definition: mutt_attach.c:806
static void prepend_savedir(char *buf, size_t bufsize)
Add C_AttachSaveDir to the beginning of a path.
Definition: recvattach.c:461
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:86
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:127
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
bool tagged
Definition: body.h:79
#define REDRAW_MOTION
Redraw after moving the menu list.
Definition: mutt_menu.h:43
int mutt_check_overwrite(const char *attname, const char *path, char *fname, size_t flen, enum SaveAttach *opt, char **directory)
Ask the user if overwriting is necessary.
Definition: muttlib.c:709
#define PATH_MAX
Definition: mutt.h:49
int num
Definition: attach.h:41
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition: body.h:64
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
FILE * fp
used in the recvattach menu.
Definition: attach.h:37
#define MUTT_FILE
Do file completion.
Definition: mutt.h:63
MuttRedrawFlags redraw
when to redraw the screen
Definition: mutt_menu.h:89
struct Body * content
Definition: attach.h:36
Append to existing file.
Definition: mutt_attach.h:55
#define FREE(x)
Definition: memory.h:40
int current
current entry
Definition: mutt_menu.h:87
struct AttachPtr ** idx
Definition: attach.h:54
SaveAttach
Options for saving attachments.
Definition: mutt_attach.h:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void query_pipe_attachment ( char *  command,
FILE *  fp,
struct Body body,
bool  filter 
)
static

Ask the user if we should pipe the attachment.

Parameters
commandCommand to pipe the attachment to
fpFile handle to the attachment (OPTIONAL)
bodyAttachment
filterIs this command a filter?

Definition at line 687 of file recvattach.c.

688 {
689  char tfile[PATH_MAX];
690 
691  if (filter)
692  {
693  char warning[PATH_MAX + 256];
694  snprintf(warning, sizeof(warning),
695  _("WARNING! You are about to overwrite %s, continue?"), body->filename);
696  if (mutt_yesorno(warning, MUTT_NO) != MUTT_YES)
697  {
699  return;
700  }
701  mutt_mktemp(tfile, sizeof(tfile));
702  }
703  else
704  tfile[0] = '\0';
705 
706  if (mutt_pipe_attachment(fp, body, command, tfile))
707  {
708  if (filter)
709  {
710  mutt_file_unlink(body->filename);
711  mutt_file_rename(tfile, body->filename);
712  mutt_update_encoding(body);
713  mutt_message(_("Attachment filtered"));
714  }
715  }
716  else
717  {
718  if (filter && tfile[0])
719  mutt_file_unlink(tfile);
720  }
721 }
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:48
#define mutt_message(...)
Definition: logging.h:82
int mutt_file_rename(const char *oldfile, const char *newfile)
Rename a file.
Definition: file.c:1312
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:39
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:191
#define _(a)
Definition: message.h:28
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
Definition: curs_lib.c:332
void mutt_update_encoding(struct Body *a)
Update the encoding type.
Definition: sendlib.c:1447
void mutt_window_clearline(struct MuttWindow *win, int row)
Clear a row of a Window.
Definition: mutt_window.c:69
#define mutt_mktemp(buf, buflen)
Definition: muttlib.h:74
#define PATH_MAX
Definition: mutt.h:49
User answered &#39;No&#39;, or assume &#39;No&#39;.
Definition: quad.h:38
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:41
int mutt_pipe_attachment(FILE *fp, struct Body *b, const char *path, char *outfile)
Pipe an attachment to a command.
Definition: mutt_attach.c:689

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void pipe_attachment ( FILE *  fp,
struct Body b,
struct State state 
)
static

Pipe the attachment to a command.

Parameters
fpFile handle to the attachment (OPTIONAL)
bAttachment
stateFile state for decoding the attachment

Definition at line 729 of file recvattach.c.

730 {
731  if (!state || !state->fp_out)
732  return;
733 
734  if (fp)
735  {
736  state->fp_in = fp;
737  mutt_decode_attachment(b, state);
738  if (C_AttachSep)
739  state_puts(C_AttachSep, state);
740  }
741  else
742  {
743  FILE *fp_in = fopen(b->filename, "r");
744  if (!fp_in)
745  {
746  mutt_perror("fopen");
747  return;
748  }
749  mutt_file_copy_stream(fp_in, state->fp_out);
750  mutt_file_fclose(&fp_in);
751  if (C_AttachSep)
752  state_puts(C_AttachSep, state);
753  }
754 }
void mutt_decode_attachment(struct Body *b, struct State *s)
Decode an email&#39;s attachment.
Definition: handler.c:1789
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:48
#define mutt_perror(...)
Definition: logging.h:84
char * C_AttachSep
Config: Separator to add between saved/printed/piped attachments.
Definition: recvattach.c:74
FILE * fp_out
File to write to.
Definition: state.h:47
FILE * fp_in
File to read from.
Definition: state.h:46
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
#define state_puts(str, state)
Definition: state.h:54
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
Definition: file.c:264

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void pipe_attachment_list ( char *  command,
struct AttachCtx actx,
FILE *  fp,
bool  tag,
struct Body top,
bool  filter,
struct State state 
)
static

Pipe a list of attachments to a command.

Parameters
commandCommand to pipe the attachment to
actxAttachment context
fpFile handle to the attachment (OPTIONAL)
tagIf true, only save the tagged attachments
topFirst Attachment
filterIs this command a filter?
stateFile state for decoding the attachments

Definition at line 766 of file recvattach.c.

768 {
769  for (int i = 0; !tag || (i < actx->idxlen); i++)
770  {
771  if (tag)
772  {
773  fp = actx->idx[i]->fp;
774  top = actx->idx[i]->content;
775  }
776  if (!tag || top->tagged)
777  {
778  if (!filter && !C_AttachSplit)
779  pipe_attachment(fp, top, state);
780  else
781  query_pipe_attachment(command, fp, top, filter);
782  }
783  if (!tag)
784  break;
785  }
786 }
bool C_AttachSplit
Config: Save/print/pipe tagged messages individually.
Definition: recvattach.c:75
short idxlen
Definition: attach.h:55
bool tagged
Definition: body.h:79
static void query_pipe_attachment(char *command, FILE *fp, struct Body *body, bool filter)
Ask the user if we should pipe the attachment.
Definition: recvattach.c:687
FILE * fp
used in the recvattach menu.
Definition: attach.h:37
static void pipe_attachment(FILE *fp, struct Body *b, struct State *state)
Pipe the attachment to a command.
Definition: recvattach.c:729
struct Body * content
Definition: attach.h:36
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

Parameters
actxAttachment context
fpFile handle to the attachment (OPTIONAL)
tagIf true, only save the tagged attachments
topFirst Attachment
filterIs this command a filter?

Definition at line 796 of file recvattach.c.

798 {
799  struct State state = { 0 };
800  char buf[128];
801 
802  if (fp)
803  filter = false; /* sanity check: we can't filter in the recv case yet */
804 
805  buf[0] = '\0';
806  /* perform charset conversion on text attachments when piping */
807  state.flags = MUTT_CHARCONV;
808 
809  if ((mutt_get_field((filter ? _("Filter through: ") : _("Pipe to: ")), buf,
810  sizeof(buf), MUTT_CMD) != 0) ||
811  (buf[0] == '\0'))
812  {
813  return;
814  }
815 
816  mutt_expand_path(buf, sizeof(buf));
817 
818  if (!filter && !C_AttachSplit)
819  {
820  mutt_endwin();
821  pid_t pid = mutt_create_filter(buf, &state.fp_out, NULL, NULL);
822  pipe_attachment_list(buf, actx, fp, tag, top, filter, &state);
823  mutt_file_fclose(&state.fp_out);
824  if ((mutt_wait_filter(pid) != 0) || C_WaitKey)
826  }
827  else
828  pipe_attachment_list(buf, actx, fp, tag, top, filter, &state);
829 }
pid_t mutt_create_filter(const char *s, FILE **fp_in, FILE **fp_out, FILE **fp_err)
Set up filter program.
Definition: filter.c:216
bool C_AttachSplit
Config: Save/print/pipe tagged messages individually.
Definition: recvattach.c:75
static void pipe_attachment_list(char *command, struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, bool filter, struct State *state)
Pipe a list of attachments to a command.
Definition: recvattach.c:766
#define MUTT_CHARCONV
Do character set conversions.
Definition: state.h:36
#define _(a)
Definition: message.h:28
FILE * fp_out
File to write to.
Definition: state.h:47
#define mutt_get_field(field, buf, buflen, complete)
Definition: curs_lib.h:86
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
Definition: state.h:49
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:127
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
#define MUTT_CMD
Do completion on previous word.
Definition: mutt.h:65
WHERE bool C_WaitKey
Config: Prompt to press a key after running external commands.
Definition: globals.h:258
void mutt_endwin(void)
Shutdown curses/slang.
Definition: curs_lib.c:499
int mutt_any_key_to_continue(const char *s)
Prompt the user to &#39;press any key&#39; and wait.
Definition: curs_lib.c:532
Keep track when processing files.
Definition: state.h:44
int mutt_wait_filter(pid_t pid)
Wait for the exit of a process and return its status.
Definition: filter.c:227

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool can_print ( struct AttachCtx actx,
struct Body top,
bool  tag 
)
static

Do we know how to print this attachment type?

Parameters
actxAttachment
topBody of email
tagApply to all tagged Attachments
Return values
trueIf (all) the Attachment(s) are printable

Definition at line 838 of file recvattach.c.

839 {
840  char type[256];
841 
842  for (int i = 0; !tag || (i < actx->idxlen); i++)
843  {
844  if (tag)
845  top = actx->idx[i]->content;
846  snprintf(type, sizeof(type), "%s/%s", TYPE(top), top->subtype);
847  if (!tag || top->tagged)
848  {
849  if (!rfc1524_mailcap_lookup(top, type, NULL, MUTT_MC_PRINT))
850  {
851  if ((mutt_str_strcasecmp("text/plain", top->subtype) != 0) &&
852  (mutt_str_strcasecmp("application/postscript", top->subtype) != 0))
853  {
854  if (!mutt_can_decode(top))
855  {
856  /* L10N: s gets replaced by a MIME type, e.g. "text/plain" or
857  application/octet-stream. */
858  mutt_error(_("I don't know how to print %s attachments"), type);
859  return false;
860  }
861  }
862  }
863  }
864  if (!tag)
865  break;
866  }
867  return true;
868 }
bool rfc1524_mailcap_lookup(struct Body *a, char *type, struct Rfc1524MailcapEntry *entry, enum MailcapLookup opt)
Find given type in the list of mailcap files.
Definition: rfc1524.c:468
#define _(a)
Definition: message.h:28
short idxlen
Definition: attach.h:55
Mailcap print field.
Definition: rfc1524.h:60
bool tagged
Definition: body.h:79
char * subtype
content-type subtype
Definition: body.h:37
bool mutt_can_decode(struct Body *a)
Will decoding the attachment produce any output.
Definition: handler.c:1748
#define TYPE(body)
Definition: mime.h:83
struct Body * content
Definition: attach.h:36
#define mutt_error(...)
Definition: logging.h:83
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:631
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void print_attachment_list ( struct AttachCtx actx,
FILE *  fp,
bool  tag,
struct Body top,
struct State state 
)
static

Print a list of Attachments.

Parameters
actxAttachment context
fpFile handle to the attachment (OPTIONAL)
tagApply to all tagged Attachments
topFirst Attachment
stateFile state for decoding the attachments

Definition at line 878 of file recvattach.c.

880 {
881  char type[256];
882 
883  for (int i = 0; !tag || (i < actx->idxlen); i++)
884  {
885  if (tag)
886  {
887  fp = actx->idx[i]->fp;
888  top = actx->idx[i]->content;
889  }
890  if (!tag || top->tagged)
891  {
892  snprintf(type, sizeof(type), "%s/%s", TYPE(top), top->subtype);
893  if (!C_AttachSplit && !rfc1524_mailcap_lookup(top, type, NULL, MUTT_MC_PRINT))
894  {
895  if ((mutt_str_strcasecmp("text/plain", top->subtype) == 0) ||
896  (mutt_str_strcasecmp("application/postscript", top->subtype) == 0))
897  {
898  pipe_attachment(fp, top, state);
899  }
900  else if (mutt_can_decode(top))
901  {
902  /* decode and print */
903 
904  char newfile[PATH_MAX] = "";
905  FILE *fp_in = NULL;
906 
907  mutt_mktemp(newfile, sizeof(newfile));
908  if (mutt_decode_save_attachment(fp, top, newfile, MUTT_PRINTING,
909  MUTT_SAVE_NO_FLAGS) == 0)
910  {
911  if (!state->fp_out)
912  {
913  mutt_error(
914  "BUG in print_attachment_list(). Please report this. ");
915  return;
916  }
917 
918  fp_in = fopen(newfile, "r");
919  if (fp_in)
920  {
921  mutt_file_copy_stream(fp_in, state->fp_out);
922  mutt_file_fclose(&fp_in);
923  if (C_AttachSep)
924  state_puts(C_AttachSep, state);
925  }
926  }
927  mutt_file_unlink(newfile);
928  }
929  }
930  else
931  mutt_print_attachment(fp, top);
932  }
933  if (!tag)
934  break;
935  }
936 }
bool C_AttachSplit
Config: Save/print/pipe tagged messages individually.
Definition: recvattach.c:75
bool rfc1524_mailcap_lookup(struct Body *a, char *type, struct Rfc1524MailcapEntry *entry, enum MailcapLookup opt)
Find given type in the list of mailcap files.
Definition: rfc1524.c:468
No flags set.
Definition: mutt_attach.h:54
char * C_AttachSep
Config: Separator to add between saved/printed/piped attachments.
Definition: recvattach.c:74
void mutt_file_unlink(const char *s)
Delete a file, carefully.
Definition: file.c:191
short idxlen
Definition: attach.h:55
FILE * fp_out
File to write to.
Definition: state.h:47
#define MUTT_PRINTING
Are we printing? - MUTT_DISPLAY "light".
Definition: state.h:37
FILE * fp_in
File to read from.
Definition: state.h:46
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
Mailcap print field.
Definition: rfc1524.h:60
bool tagged
Definition: body.h:79
char * subtype
content-type subtype
Definition: body.h:37
#define mutt_mktemp(buf, buflen)
Definition: muttlib.h:74
#define PATH_MAX
Definition: mutt.h:49
int mutt_decode_save_attachment(FILE *fp, struct Body *m, const char *path, int displaying, enum SaveAttach opt)
Decode, then save an attachment.
Definition: mutt_attach.c:937
bool mutt_can_decode(struct Body *a)
Will decoding the attachment produce any output.
Definition: handler.c:1748
FILE * fp
used in the recvattach menu.
Definition: attach.h:37
static void pipe_attachment(FILE *fp, struct Body *b, struct State *state)
Pipe the attachment to a command.
Definition: recvattach.c:729
#define TYPE(body)
Definition: mime.h:83
#define state_puts(str, state)
Definition: state.h:54
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
Copy the contents of one file into another.
Definition: file.c:264
struct Body * content
Definition: attach.h:36
#define mutt_error(...)
Definition: logging.h:83
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:631
struct AttachPtr ** idx
Definition: attach.h:54
int mutt_print_attachment(FILE *fp, struct Body *a)
Print out an attachment.
Definition: mutt_attach.c:1036

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mutt_print_attachment_list ( struct AttachCtx actx,
FILE *  fp,
bool  tag,
struct Body top 
)

Print a list of Attachments.

Parameters
actxAttachment context
fpFile handle to the attachment (OPTIONAL)
tagApply to all tagged Attachments
topFirst Attachment

Definition at line 945 of file recvattach.c.

946 {
947  char prompt[128];
948  struct State state = { 0 };
949  int tagmsgcount = 0;
950 
951  if (tag)
952  for (int i = 0; i < actx->idxlen; i++)
953  if (actx->idx[i]->content->tagged)
954  tagmsgcount++;
955 
956  snprintf(prompt, sizeof(prompt),
957  /* L10N: Although we now the precise number of tagged messages, we
958  do not show it to the user. So feel free to use a "generic
959  plural" as plural translation if your language has one. */
960  tag ? ngettext("Print tagged attachment?", "Print %d tagged attachments?", tagmsgcount) :
961  _("Print attachment?"),
962  tagmsgcount);
963  if (query_quadoption(C_Print, prompt) != MUTT_YES)
964  return;
965 
966  if (!C_AttachSplit)
967  {
968  if (!can_print(actx, top, tag))
969  return;
970  mutt_endwin();
971  pid_t pid = mutt_create_filter(NONULL(C_PrintCommand), &state.fp_out, NULL, NULL);
972  print_attachment_list(actx, fp, tag, top, &state);
973  mutt_file_fclose(&state.fp_out);
974  if ((mutt_wait_filter(pid) != 0) || C_WaitKey)
976  }
977  else
978  print_attachment_list(actx, fp, tag, top, &state);
979 }
pid_t mutt_create_filter(const char *s, FILE **fp_in, FILE **fp_out, FILE **fp_err)
Set up filter program.
Definition: filter.c:216
bool C_AttachSplit
Config: Save/print/pipe tagged messages individually.
Definition: recvattach.c:75
#define NONULL(x)
Definition: string2.h:36
WHERE unsigned char C_Print
Config: Confirm before printing a message.
Definition: globals.h:185
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
Definition: init.c:3367
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:39
static void print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top, struct State *state)
Print a list of Attachments.
Definition: recvattach.c:878
#define _(a)
Definition: message.h:28
short idxlen
Definition: attach.h:55
FILE * fp_out
File to write to.
Definition: state.h:47
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
bool tagged
Definition: body.h:79
WHERE bool C_WaitKey
Config: Prompt to press a key after running external commands.
Definition: globals.h:258
void mutt_endwin(void)
Shutdown curses/slang.
Definition: curs_lib.c:499
static bool can_print(struct AttachCtx *actx, struct Body *top, bool tag)
Do we know how to print this attachment type?
Definition: recvattach.c:838
int mutt_any_key_to_continue(const char *s)
Prompt the user to &#39;press any key&#39; and wait.
Definition: curs_lib.c:532
struct Body * content
Definition: attach.h:36
WHERE char * C_PrintCommand
Config: External command to print a message.
Definition: globals.h:134
Keep track when processing files.
Definition: state.h:44
int mutt_wait_filter(pid_t pid)
Wait for the exit of a process and return its status.
Definition: filter.c:227
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void recvattach_extract_pgp_keys ( struct AttachCtx actx,
struct Menu menu 
)
static

Extract PGP keys from attachments.

Parameters
actxAttachment context
menuMenu listing attachments

Definition at line 986 of file recvattach.c.

987 {
988  if (!menu->tagprefix)
990  else
991  {
992  for (int i = 0; i < actx->idxlen; i++)
993  {
994  if (actx->idx[i]->content->tagged)
995  {
997  }
998  }
999  }
1000 }
short idxlen
Definition: attach.h:55
#define CUR_ATTACH
Definition: recvattach.c:91
bool tagged
Definition: body.h:79
void crypt_pgp_extract_key_from_attachment(FILE *fp, struct Body *top)
Wrapper for CryptModuleSpecs::pgp_extract_key_from_attachment()
Definition: cryptglue.c:334
bool tagprefix
Definition: mutt_menu.h:93
FILE * fp
used in the recvattach menu.
Definition: attach.h:37
struct Body * content
Definition: attach.h:36
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int recvattach_pgp_check_traditional ( struct AttachCtx actx,
struct Menu menu 
)
static

Is the Attachment inline PGP?

Parameters
actxAttachment to check
menuMenu listing Attachments
Return values
1If the (tagged) Attachment(s) are inline PGP
Note
If the menu->tagprefix is set, all the tagged attachments will be checked.

Definition at line 1010 of file recvattach.c.

1011 {
1012  int rc = 0;
1013 
1014  if (!menu->tagprefix)
1015  rc = crypt_pgp_check_traditional(CUR_ATTACH->fp, CUR_ATTACH->content, true);
1016  else
1017  {
1018  for (int i = 0; i < actx->idxlen; i++)
1019  if (actx->idx[i]->content->tagged)
1020  rc = rc || crypt_pgp_check_traditional(actx->idx[i]->fp, actx->idx[i]->content, true);
1021  }
1022 
1023  return rc;
1024 }
short idxlen
Definition: attach.h:55
#define CUR_ATTACH
Definition: recvattach.c:91
bool tagged
Definition: body.h:79
bool tagprefix
Definition: mutt_menu.h:93
FILE * fp
used in the recvattach menu.
Definition: attach.h:37
int crypt_pgp_check_traditional(FILE *fp, struct Body *b, bool just_one)
Wrapper for CryptModuleSpecs::pgp_check_traditional()
Definition: cryptglue.c:237
struct Body * content
Definition: attach.h:36
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void recvattach_edit_content_type ( struct AttachCtx actx,
struct Menu menu,
struct Email e 
)
static

Edit the content type of an attachment.

Parameters
actxAttachment context
menuMenu listing Attachments
eEmail

Definition at line 1032 of file recvattach.c.

1034 {
1035  if (!mutt_edit_content_type(e, CUR_ATTACH->content, CUR_ATTACH->fp))
1036  return;
1037 
1038  /* The mutt_update_recvattach_menu() will overwrite any changes
1039  * made to a decrypted CUR_ATTACH->content, so warn the user. */
1040  if (CUR_ATTACH->decrypted)
1041  {
1042  mutt_message(
1043  _("Structural changes to decrypted attachments are not supported"));
1044  mutt_sleep(1);
1045  }
1046  /* Editing the content type can rewrite the body structure. */
1047  for (int i = 0; i < actx->idxlen; i++)
1048  actx->idx[i]->content = NULL;
1049  mutt_actx_free_entries(actx);
1050  mutt_update_recvattach_menu(actx, menu, true);
1051 }
#define mutt_message(...)
Definition: logging.h:82
#define _(a)
Definition: message.h:28
short idxlen
Definition: attach.h:55
#define CUR_ATTACH
Definition: recvattach.c:91
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1498
void mutt_actx_free_entries(struct AttachCtx *actx)
Free entries in an Attachment Context.
Definition: attach.c:103
static void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
Definition: recvattach.c:1273
struct Body * content
Definition: attach.h:36
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
Definition: commands.c:1182
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int mutt_attach_display_loop ( struct Menu menu,
int  op,
struct Email e,
struct AttachCtx actx,
bool  recv 
)

Event loop for the Attachment menu.

Parameters
menuMenu listing Attachments
opOperation, e.g. OP_VIEW_ATTACH
eEmail
actxAttachment context
recvtrue if these are received attachments (rather than in compose)
Return values
numOperation performed

Definition at line 1062 of file recvattach.c.

1064 {
1065  do
1066  {
1067  switch (op)
1068  {
1069  case OP_DISPLAY_HEADERS:
1070  bool_str_toggle(Config, "weed", NULL);
1071  /* fallthrough */
1072 
1073  case OP_VIEW_ATTACH:
1074  op = mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content,
1075  MUTT_VA_REGULAR, e, actx);
1076  break;
1077 
1078  case OP_NEXT_ENTRY:
1079  case OP_MAIN_NEXT_UNDELETED: /* hack */
1080  if (menu->current < menu->max - 1)
1081  {
1082  menu->current++;
1083  op = OP_VIEW_ATTACH;
1084  }
1085  else
1086  op = OP_NULL;
1087  break;
1088  case OP_PREV_ENTRY:
1089  case OP_MAIN_PREV_UNDELETED: /* hack */
1090  if (menu->current > 0)
1091  {
1092  menu->current--;
1093  op = OP_VIEW_ATTACH;
1094  }
1095  else
1096  op = OP_NULL;
1097  break;
1098  case OP_EDIT_TYPE:
1099  /* when we edit the content-type, we should redisplay the attachment
1100  * immediately */
1101  mutt_edit_content_type(e, CUR_ATTACH->content, CUR_ATTACH->fp);
1102  if (recv)
1103  recvattach_edit_content_type(actx, menu, e);
1104  else
1105  mutt_edit_content_type(e, CUR_ATTACH->content, CUR_ATTACH->fp);
1106 
1107  menu->redraw |= REDRAW_INDEX;
1108  op = OP_VIEW_ATTACH;
1109  break;
1110  /* functions which are passed through from the pager */
1111  case OP_CHECK_TRADITIONAL:
1113  {
1114  op = OP_NULL;
1115  break;
1116  }
1117  /* fallthrough */
1118  case OP_ATTACH_COLLAPSE:
1119  if (recv)
1120  return op;
1121  /* fallthrough */
1122  default:
1123  op = OP_NULL;
1124  }
1125  } while (op != OP_NULL);
1126 
1127  return op;
1128 }
#define PGP_TRADITIONAL_CHECKED
Email has a traditional (inline) signature.
Definition: ncrypt.h:131
WHERE struct ConfigSet * Config
Wrapper around the user&#39;s config settings.
Definition: globals.h:39
View using default method.
Definition: mutt_attach.h:41
#define CUR_ATTACH
Definition: recvattach.c:91
static void recvattach_edit_content_type(struct AttachCtx *actx, struct Menu *menu, struct Email *e)
Edit the content type of an attachment.
Definition: recvattach.c:1032
SecurityFlags security
bit 0-8: flags, bit 9,10: application.
Definition: email.h:39
int max
the number of entries in the menu
Definition: mutt_menu.h:88
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: ncrypt.h:129
MuttRedrawFlags redraw
when to redraw the screen
Definition: mutt_menu.h:89
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
int bool_str_toggle(struct ConfigSet *cs, const char *name, struct Buffer *err)
Toggle the value of a bool.
Definition: bool.c:240
int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx)
View an attachment.
Definition: mutt_attach.c:394
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
Definition: commands.c:1182
int current
current entry
Definition: mutt_menu.h:87
#define WithCrypto
Definition: ncrypt.h:155

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mutt_generate_recvattach_list ( struct AttachCtx actx,
struct Email e,
struct Body parts,
FILE *  fp,
int  parent_type,
int  level,
bool  decrypted 
)

Create a list of attachments.

Parameters
actxAttachment context
eEmail
partsBody of email
fpFile to read from
parent_typeType, e.g. TYPE_MULTIPART
levelAttachment depth
decryptedTrue if attachment has been decrypted

Definition at line 1140 of file recvattach.c.

1143 {
1144  struct AttachPtr *new = NULL;
1145  struct Body *m = NULL;
1146  struct Body *new_body = NULL;
1147  FILE *fp_new = NULL;
1149  int need_secured, secured;
1150 
1151  for (m = parts; m; m = m->next)
1152  {
1153  need_secured = 0;
1154  secured = 0;
1155 
1156  if (((WithCrypto & APPLICATION_SMIME) != 0) && (type = mutt_is_application_smime(m)))
1157  {
1158  need_secured = 1;
1159 
1160  if (type & SEC_ENCRYPT)
1161  {
1162  if (!crypt_valid_passphrase(APPLICATION_SMIME))
1163  goto decrypt_failed;
1164 
1165  if (e->env)
1167  }
1168 
1169  secured = !crypt_smime_decrypt_mime(fp, &fp_new, m, &new_body);
1170  /* If the decrypt/verify-opaque doesn't generate mime output, an empty
1171  * text/plain type will still be returned by mutt_read_mime_header().
1172  * We can't distinguish an actual part from a failure, so only use a
1173  * text/plain that results from a single top-level part. */
1174  if (secured && (new_body->type == TYPE_TEXT) &&
1175  (mutt_str_strcasecmp("plain", new_body->subtype) == 0) &&
1176  ((parts != m) || m->next))
1177  {
1178  mutt_body_free(&new_body);
1179  mutt_file_fclose(&fp_new);
1180  goto decrypt_failed;
1181  }
1182 
1183  if (secured && (type & SEC_ENCRYPT))
1184  e->security |= SMIME_ENCRYPT;
1185  }
1186 
1187  if (((WithCrypto & APPLICATION_PGP) != 0) &&
1189  {
1190  need_secured = 1;
1191 
1192  if (!crypt_valid_passphrase(APPLICATION_PGP))
1193  goto decrypt_failed;
1194 
1195  secured = !crypt_pgp_decrypt_mime(fp, &fp_new, m, &new_body);
1196 
1197  if (secured)
1198  e->security |= PGP_ENCRYPT;
1199  }
1200 
1201  if (need_secured && secured)
1202  {
1203  mutt_actx_add_fp(actx, fp_new);
1204  mutt_actx_add_body(actx, new_body);
1205  mutt_generate_recvattach_list(actx, e, new_body, fp_new, parent_type, level, 1);
1206  continue;
1207  }
1208 
1209  decrypt_failed:
1210  /* Fall through and show the original parts if decryption fails */
1211  if (need_secured && !secured)
1212  mutt_error(_("Can't decrypt encrypted message"));
1213 
1214  /* Strip out the top level multipart */
1215  if ((m->type == TYPE_MULTIPART) && m->parts && !need_secured &&
1216  ((parent_type == -1) && mutt_str_strcasecmp("alternative", m->subtype)))
1217  {
1218  mutt_generate_recvattach_list(actx, e, m->parts, fp, m->type, level, decrypted);
1219  }
1220  else
1221  {
1222  new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
1223  mutt_actx_add_attach(actx, new);
1224 
1225  new->content = m;
1226  new->fp = fp;
1227  m->aptr = new;
1228  new->parent_type = parent_type;
1229  new->level = level;
1230  new->decrypted = decrypted;
1231 
1232  if (m->type == TYPE_MULTIPART)
1233  mutt_generate_recvattach_list(actx, e, m->parts, fp, m->type, level + 1, decrypted);
1234  else if (mutt_is_message_type(m->type, m->subtype))
1235  {
1236  mutt_generate_recvattach_list(actx, m->email, m->parts, fp, m->type,
1237  level + 1, decrypted);
1238  e->security |= m->email->security;
1239  }
1240  }
1241  }
1242 }
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
An email to which things will be attached.
Definition: attach.h:34
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
Definition: parse.c:1260
void mutt_actx_add_fp(struct AttachCtx *actx, FILE *fp_new)
Save a File handle to the Attachment Context.
Definition: attach.c:62
void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Email *e, struct Body *parts, FILE *fp, int parent_type, int level, bool decrypted)
Create a list of attachments.
Definition: recvattach.c:1140
#define _(a)
Definition: message.h:28
struct Body * next
next attachment in the list
Definition: body.h:60
void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach)
Add an Attachment to an Attachment Context.
Definition: attach.c:40
#define SEC_ENCRYPT
Email is encrypted.
Definition: ncrypt.h:120
The body of an email.
Definition: body.h:34
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
Definition: crypt.c:143
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
Definition: crypt.c:417
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
int parent_type
Definition: attach.h:38
struct Envelope * env
envelope information
Definition: email.h:92
char * subtype
content-type subtype
Definition: body.h:37
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition: body.h:64
Type: &#39;text/*&#39;.
Definition: mime.h:38
void crypt_smime_getkeys(struct Envelope *env)
Wrapper for CryptModuleSpecs::smime_getkeys()
Definition: cryptglue.c:405
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:61
SecurityFlags mutt_is_malformed_multipart_pgp_encrypted(struct Body *b)
Check for malformed layout.
Definition: crypt.c:479
int crypt_smime_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Wrapper for CryptModuleSpecs::decrypt_mime()
Definition: cryptglue.c:372
SecurityFlags mutt_is_application_smime(struct Body *m)
Does the message use S/MIME?
Definition: crypt.c:583
SecurityFlags security
bit 0-8: flags, bit 9,10: application.
Definition: email.h:39
unsigned int type
content-type primary type
Definition: body.h:72
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: ncrypt.h:129
int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Wrapper for CryptModuleSpecs::decrypt_mime()
Definition: cryptglue.c:191
void mutt_body_free(struct Body **p)
Free a Body.
Definition: body.c:57
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
#define SMIME_ENCRYPT
Definition: ncrypt.h:141
#define mutt_error(...)
Definition: logging.h:83
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:631
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
Definition: ncrypt.h:118
struct Email * email
header information for message/rfc822
Definition: body.h:62
#define WithCrypto
Definition: ncrypt.h:155
#define PGP_ENCRYPT
Definition: ncrypt.h:135
void mutt_actx_add_body(struct AttachCtx *actx, struct Body *new_body)
Add an email box to an Attachment Context.
Definition: attach.c:83
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: ncrypt.h:130

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mutt_attach_init ( struct AttachCtx actx)

Create a new Attachment context.

Parameters
actxAttachment context

Definition at line 1248 of file recvattach.c.

1249 {
1250  /* Collapse the attachments if '$digest_collapse' is set AND if...
1251  * the outer container is of type 'multipart/digest' */
1252  bool digest = (mutt_str_strcasecmp(actx->email->content->subtype, "digest") == 0);
1253 
1254  for (int i = 0; i < actx->idxlen; i++)
1255  {
1256  actx->idx[i]->content->tagged = false;
1257 
1258  /* OR an inner container is of type 'multipart/digest' */
1259  actx->idx[i]->content->collapsed =
1260  (C_DigestCollapse &&
1261  (digest ||
1262  ((actx->idx[i]->content->type == TYPE_MULTIPART) &&
1263  (mutt_str_strcasecmp(actx->idx[i]->content->subtype, "digest") == 0))));
1264  }
1265 }
struct Email * email
used by recvattach for updating
Definition: attach.h:51
struct Body * content
list of MIME parts
Definition: email.h:93
bool C_DigestCollapse
Config: Hide the subparts of a multipart/digest.
Definition: recvattach.c:76
short idxlen
Definition: attach.h:55
bool tagged
Definition: body.h:79
bool collapsed
used by recvattach
Definition: body.h:100
char * subtype
content-type subtype
Definition: body.h:37
unsigned int type
content-type primary type
Definition: body.h:72
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
struct Body * content
Definition: attach.h:36
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:631
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void attach_collapse ( struct AttachCtx actx,
struct Menu menu 
)
static

Close the tree of the current attachment.

Parameters
actxAttachment context
menuMenu listing Attachments

Definition at line 1298 of file recvattach.c.

1299 {
1300  int rindex, curlevel;
1301 
1302  CUR_ATTACH->content->collapsed = !CUR_ATTACH->content->collapsed;
1303  /* When expanding, expand all the children too */
1304  if (CUR_ATTACH->content->collapsed)
1305  return;
1306 
1307  curlevel = CUR_ATTACH->level;
1308  rindex = actx->v2r[menu->current] + 1;
1309 
1310  while ((rindex < actx->idxlen) && (actx->idx[rindex]->level > curlevel))
1311  {
1312  if (C_DigestCollapse && (actx->idx[rindex]->content->type == TYPE_MULTIPART) &&
1313  !mutt_str_strcasecmp(actx->idx[rindex]->content->subtype, "digest"))
1314  {
1315  actx->idx[rindex]->content->collapsed = true;
1316  }
1317  else
1318  {
1319  actx->idx[rindex]->content->collapsed = false;
1320  }
1321  rindex++;
1322  }
1323 }
bool C_DigestCollapse
Config: Hide the subparts of a multipart/digest.
Definition: recvattach.c:76
#define CUR_ATTACH
Definition: recvattach.c:91
bool collapsed
used by recvattach
Definition: body.h:100
char * subtype
content-type subtype
Definition: body.h:37
unsigned int type
content-type primary type
Definition: body.h:72
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
short * v2r
mapping from virtual to real attachment
Definition: attach.h:58
struct Body * content
Definition: attach.h:36
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:631
int current
current entry
Definition: mutt_menu.h:87
int level
Definition: attach.h:40
struct AttachPtr ** idx
Definition: attach.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mutt_view_attachments ( struct Email e)

Show the attachments in a Menu.

Parameters
eEmail

Definition at line 1329 of file recvattach.c.

1330 {
1331  char helpstr[1024];
1332  int op = OP_NULL;
1333 
1334  struct Mailbox *m = Context ? Context->mailbox : NULL;
1335 
1336  /* make sure we have parsed this message */
1338 
1340 
1341  struct Message *msg = mx_msg_open(m, e->msgno);
1342  if (!msg)
1343  return;
1344 
1345  struct Menu *menu = mutt_menu_new(MENU_ATTACH);
1346  menu->title = _("Attachments");
1348  menu->menu_tag = attach_tag;
1349  menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_ATTACH, AttachHelp);
1350  mutt_menu_push_current(menu);
1351 
1352  struct AttachCtx *actx = mutt_mem_calloc(sizeof(struct AttachCtx), 1);
1353  actx->email = e;
1354  actx->fp_root = msg->fp;
1355  mutt_update_recvattach_menu(actx, menu, true);
1356 
1357  while (true)
1358  {
1359  if (op == OP_NULL)
1360  op = mutt_menu_loop(menu);
1361  if (!Context)
1362  return;
1363  switch (op)
1364  {
1365  case OP_ATTACH_VIEW_MAILCAP:
1366  mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content, MUTT_VA_MAILCAP, e, actx);
1367  menu->redraw = REDRAW_FULL;
1368  break;
1369 
1370  case OP_ATTACH_VIEW_TEXT:
1371  mutt_view_attachment(CUR_ATTACH->fp, CUR_ATTACH->content, MUTT_VA_AS_TEXT, e, actx);
1372  menu->redraw = REDRAW_FULL;
1373  break;
1374 
1375  case OP_DISPLAY_HEADERS:
1376  case OP_VIEW_ATTACH:
1377  op = mutt_attach_display_loop(menu, op, e, actx, true);
1378  menu->redraw = REDRAW_FULL;
1379  continue;
1380 
1381  case OP_ATTACH_COLLAPSE:
1382  if (!CUR_ATTACH->content->parts)
1383  {
1384  mutt_error(_("There are no subparts to show"));
1385  break;
1386  }
1387  attach_collapse(actx, menu);
1388  mutt_update_recvattach_menu(actx, menu, false);
1389  break;
1390 
1391  case OP_FORGET_PASSPHRASE:
1393  break;
1394 
1395  case OP_EXTRACT_KEYS:
1397  {
1398  recvattach_extract_pgp_keys(actx, menu);
1399  menu->redraw = REDRAW_FULL;
1400  }
1401  break;
1402 
1403  case OP_CHECK_TRADITIONAL:
1404  if (((WithCrypto & APPLICATION_PGP) != 0) &&
1406  {
1407  e->security = crypt_query(NULL);
1408  menu->redraw = REDRAW_FULL;
1409  }
1410  break;
1411 
1412  case OP_PRINT:
1414  CUR_ATTACH->content);
1415  break;
1416 
1417  case OP_PIPE:
1419  CUR_ATTACH->content, false);
1420  break;
1421 
1422  case OP_SAVE:
1424  CUR_ATTACH->content, e, menu);
1425 
1426  if (!menu->tagprefix && C_Resolve && (menu->current < menu->max - 1))
1427  menu->current++;
1428 
1430  break;
1431 
1432  case OP_DELETE:
1434 
1435 #ifdef USE_POP
1436  if (m->magic == MUTT_POP)
1437  {
1438  mutt_flushinp();
1439  mutt_error(_("Can't delete attachment from POP server"));
1440  break;
1441  }
1442 #endif
1443 
1444 #ifdef USE_NNTP
1445  if (m->magic == MUTT_NNTP)
1446  {
1447  mutt_flushinp();
1448  mutt_error(_("Can't delete attachment from news server"));
1449  break;
1450  }
1451 #endif
1452 
1453  if ((WithCrypto != 0) && (e->security & SEC_ENCRYPT))
1454  {
1455  mutt_message(_("Deletion of attachments from encrypted messages is "
1456  "unsupported"));
1457  break;
1458  }
1459  if ((WithCrypto != 0) && (e->security & (SEC_SIGN | SEC_PARTSIGN)))
1460  {
1461  mutt_message(_("Deletion of attachments from signed messages may "
1462  "invalidate the signature"));
1463  }
1464  if (!menu->tagprefix)
1465  {
1466  if (CUR_ATTACH->parent_type == TYPE_MULTIPART)
1467  {
1468  CUR_ATTACH->content->deleted = true;
1469  if (C_Resolve && (menu->current < menu->max - 1))
1470  {
1471  menu->current++;
1472  menu->redraw = REDRAW_MOTION_RESYNC;
1473  }
1474  else
1475  menu->redraw = REDRAW_CURRENT;
1476  }
1477  else
1478  {
1479  mutt_message(
1480  _("Only deletion of multipart attachments is supported"));
1481  }
1482  }
1483  else
1484  {
1485  for (int i = 0; i < menu->max; i++)
1486  {
1487  if (actx->idx[i]->content->tagged)
1488  {
1489  if (actx->idx[i]->parent_type == TYPE_MULTIPART)
1490  {
1491  actx->idx[i]->content->deleted = true;
1492  menu->redraw = REDRAW_INDEX;
1493  }
1494  else
1495  {
1496  mutt_message(
1497  _("Only deletion of multipart attachments is supported"));
1498  }
1499  }
1500  }
1501  }
1502  break;
1503 
1504  case OP_UNDELETE:
1506  if (!menu->tagprefix)
1507  {
1508  CUR_ATTACH->content->deleted = false;
1509  if (C_Resolve && (menu->current < menu->max - 1))
1510  {
1511  menu->current++;
1512  menu->redraw = REDRAW_MOTION_RESYNC;
1513  }
1514  else
1515  menu->redraw = REDRAW_CURRENT;
1516  }
1517  else
1518  {
1519  for (int i = 0; i < menu->max; i++)
1520  {
1521  if (actx->idx[i]->content->tagged)
1522  {
1523  actx->idx[i]->content->deleted = false;
1524  menu->redraw = REDRAW_INDEX;
1525  }
1526  }
1527  }
1528  break;
1529 
1530  case OP_RESEND:
1531  CHECK_ATTACH;
1532  mutt_attach_resend(CUR_ATTACH->fp, actx,
1533  menu->tagprefix ? NULL : CUR_ATTACH->content);
1534  menu->redraw = REDRAW_FULL;
1535  break;
1536 
1537  case OP_BOUNCE_MESSAGE:
1538  CHECK_ATTACH;
1539  mutt_attach_bounce(m, CUR_ATTACH->fp, actx,
1540  menu->tagprefix ? NULL : CUR_ATTACH->content);
1541  menu->redraw = REDRAW_FULL;
1542  break;
1543 
1544  case OP_FORWARD_MESSAGE:
1545  CHECK_ATTACH;
1546  mutt_attach_forward(CUR_ATTACH->fp, e, actx,
1547  menu->tagprefix ? NULL : CUR_ATTACH->content, SEND_NO_FLAGS);
1548  menu->redraw = REDRAW_FULL;
1549  break;
1550 
1551 #ifdef USE_NNTP
1552  case OP_FORWARD_TO_GROUP:
1553  CHECK_ATTACH;
1554  mutt_attach_forward(CUR_ATTACH->fp, e, actx,
1555  menu->tagprefix ? NULL : CUR_ATTACH->content, SEND_NEWS);
1556  menu->redraw = REDRAW_FULL;
1557  break;
1558 
1559  case OP_FOLLOWUP:
1560  CHECK_ATTACH;
1561 
1562  if (!CUR_ATTACH->content->email->env->followup_to ||
1563  (mutt_str_strcasecmp(CUR_ATTACH->content->email->env->followup_to, "poster") != 0) ||
1565  _("Reply by mail as poster prefers?")) != MUTT_YES))
1566  {
1567  mutt_attach_reply(CUR_ATTACH->fp, e, actx,
1568  menu->tagprefix ? NULL : CUR_ATTACH->content,
1569  SEND_NEWS | SEND_REPLY);
1570  menu->redraw = REDRAW_FULL;
1571  break;
1572  }
1573 #endif
1574  /* fallthrough */
1575  case OP_REPLY:
1576  case OP_GROUP_REPLY:
1577  case OP_GROUP_CHAT_REPLY:
1578  case OP_LIST_REPLY:
1579  {
1580  CHECK_ATTACH;
1581 
1582  SendFlags flags = SEND_REPLY;
1583  if (op == OP_GROUP_REPLY)
1584  flags |= SEND_GROUP_REPLY;
1585  else if (op == OP_GROUP_CHAT_REPLY)
1586  flags |= SEND_GROUP_CHAT_REPLY;
1587  else if (op == OP_LIST_REPLY)
1588  flags |= SEND_LIST_REPLY;
1589 
1590  mutt_attach_reply(CUR_ATTACH->fp, e, actx,
1591  menu->tagprefix ? NULL : CUR_ATTACH->content, flags);
1592  menu->redraw = REDRAW_FULL;
1593  break;
1594  }
1595 
1596  case OP_COMPOSE_TO_SENDER:
1597  CHECK_ATTACH;
1598  mutt_attach_mail_sender(CUR_ATTACH->fp, e, actx,
1599  menu->tagprefix ? NULL : CUR_ATTACH->content);
1600  menu->redraw = REDRAW_FULL;
1601  break;
1602 
1603  case OP_EDIT_TYPE:
1604  recvattach_edit_content_type(actx, menu, e);
1605  menu->redraw |= REDRAW_INDEX;
1606  break;
1607 
1608  case OP_EXIT:
1609  mx_msg_close(m, &msg);
1610 
1611  e->attach_del = false;
1612  for (int i = 0; i < actx->idxlen; i++)
1613  {
1614  if (actx->idx[i]->content && actx->idx[i]->content->deleted)
1615  {
1616  e->attach_del = true;
1617  break;
1618  }
1619  }
1620  if (e->attach_del)
1621  e->changed = true;
1622 
1623  mutt_actx_free(&actx);
1624 
1625  mutt_menu_pop_current(menu);
1626  mutt_menu_destroy(&menu);
1627  return;
1628  }
1629 
1630  op = OP_NULL;
1631  }
1632 
1633  /* not reached */
1634 }
The "current" mailbox.
Definition: context.h:38
#define REDRAW_FULL
Redraw everything.
Definition: mutt_menu.h:47
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
static const struct Mapping AttachHelp[]
Definition: recvattach.c:93
GUI selectable list of items.
Definition: mutt_menu.h:82
static void attach_make_entry(char *buf, size_t buflen, struct Menu *menu, int line)
Format a menu item for the attachment list - Implements Menu::menu_make_entry()
Definition: recvattach.c:434
&#39;NNTP&#39; (Usenet) Mailbox type
Definition: magic.h:41
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
Definition: init.c:3367
#define mutt_message(...)
Definition: logging.h:82
struct Email * email
used by recvattach for updating
Definition: attach.h:51
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:39
WHERE unsigned char C_FollowupToPoster
Config: (nntp) Reply to the poster if &#39;poster&#39; is in the &#39;Followup-To&#39; header.
Definition: globals.h:192
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: curs_lib.c:785
bool attach_del
has an attachment marked for deletion
Definition: email.h:49
void crypt_forget_passphrase(void)
Forget a passphrase and display a message.
Definition: crypt.c:101
FILE * fp_root
used by recvattach for updating
Definition: attach.h:52
void mutt_parse_mime_message(struct Mailbox *m, struct Email *e)
Parse a MIME email.
Definition: mutt_parse.c:50
#define _(a)
Definition: message.h:28
bool changed
Definition: email.h:48
short idxlen
Definition: attach.h:55
Force viewing as text.
Definition: mutt_attach.h:43
#define MUTT_MESSAGE_HOOK
message-hook: run before displaying a message
Definition: hook.h:51
int menu
menu definition for keymap entries.
Definition: mutt_menu.h:90
uint16_t SendFlags
Flags for ci_send_message(), e.g. SEND_REPLY.
Definition: send.h:84
#define SEC_ENCRYPT
Email is encrypted.
Definition: ncrypt.h:120
#define SEC_PARTSIGN
Not all parts of the email is signed.
Definition: ncrypt.h:124
void(* menu_make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:122
char * mutt_compile_help(char *buf, size_t buflen, int menu, const struct Mapping *items)
Create the text for the help menu.
Definition: help.c:115
#define CUR_ATTACH
Definition: recvattach.c:91
int attach_tag(struct Menu *menu, int sel, int act)
Tag an attachment - Implements Menu::menu_tag()
Definition: recvattach.c:446
#define SEND_NO_FLAGS
No flags are set.
Definition: send.h:85
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
Definition: mx.c:1077
struct Mailbox * mailbox
Definition: context.h:52
enum MailboxType magic
mailbox type
Definition: mailbox.h:105
int parent_type
Definition: attach.h:38
#define SEND_LIST_REPLY
Reply to mailing list.
Definition: send.h:88
bool tagged
Definition: body.h:79
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:44
void mutt_actx_free(struct AttachCtx **pactx)
Free an Attachment Context.
Definition: attach.c:131
void mutt_attach_bounce(struct Mailbox *m, FILE *fp, struct AttachCtx *actx, struct Body *cur)
Bounce function, from the attachment menu.
Definition: recvcmd.c:165
#define SEC_SIGN
Email is signed.
Definition: ncrypt.h:121
A local copy of an email.
Definition: mx.h:79
Select an attachment.
Definition: keymap.h:71
A mailbox.
Definition: mailbox.h:83
static void recvattach_edit_content_type(struct AttachCtx *actx, struct Menu *menu, struct Email *e)
Edit the content type of an attachment.
Definition: recvattach.c:1032
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:1062
bool tagprefix
Definition: mutt_menu.h:93
static void recvattach_extract_pgp_keys(struct AttachCtx *actx, struct Menu *menu)
Extract PGP keys from attachments.
Definition: recvattach.c:986
WHERE bool C_Resolve
Config: Move to the next email whenever a command modifies an email.
Definition: globals.h:244
static void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
Definition: recvattach.c:1273
#define SEND_NEWS
Reply to a news article.
Definition: send.h:100
void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *cur, SendFlags flags)
Attach a reply.
Definition: recvcmd.c:895
SecurityFlags security
bit 0-8: flags, bit 9,10: application.
Definition: email.h:39
static int recvattach_pgp_check_traditional(struct AttachCtx *actx, struct Menu *menu)
Is the Attachment inline PGP?
Definition: recvattach.c:1010
Force viewing using mailcap entry.
Definition: mutt_attach.h:42
#define SEND_REPLY
Reply to sender.
Definition: send.h:86
#define CHECK_READONLY
Definition: recvattach.c:83
int max
the number of entries in the menu
Definition: mutt_menu.h:88
int(* menu_tag)(struct Menu *menu, int sel, int act)
Tag some menu items.
Definition: mutt_menu.h:139
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: ncrypt.h:129
void mutt_print_attachment_list(struct AttachCtx *actx, FILE *fp, bool tag, struct Body *top)
Print a list of Attachments.
Definition: recvattach.c:945
MuttRedrawFlags redraw
when to redraw the screen
Definition: mutt_menu.h:89
void mutt_attach_forward(FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *cur, SendFlags flags)
Forward an Attachment.
Definition: recvcmd.c:747
char * title
the title of this menu
Definition: mutt_menu.h:84
bool deleted
attachment marked for deletion
Definition: body.h:80
static void attach_collapse(struct AttachCtx *actx, struct Menu *menu)
Close the tree of the current attachment.
Definition: recvattach.c:1298
#define SEND_GROUP_REPLY
Reply to all.
Definition: send.h:87
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:42
struct Body * content
Definition: attach.h:36
#define mutt_error(...)
Definition: logging.h:83
int mutt_str_strcasecmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:631
FILE * fp
pointer to the message data
Definition: mx.h:81
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:593
void mutt_attach_mail_sender(FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *cur)
Compose an email to the sender in the email attachment.
Definition: recvcmd.c:1056
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:578
#define SEND_GROUP_CHAT_REPLY
Reply to all recipients preserving To/Cc.
Definition: send.h:99
int mutt_view_attachment(FILE *fp, struct Body *a, enum ViewAttachMode mode, struct Email *e, struct AttachCtx *actx)
View an attachment.
Definition: mutt_attach.c:394
int current
current entry
Definition: mutt_menu.h:87
#define CHECK_ATTACH
Definition: recvattach.c:101
#define WithCrypto
Definition: ncrypt.h:155
A set of attachments.
Definition: attach.h:49
struct AttachPtr ** idx
Definition: attach.h:54
SecurityFlags crypt_query(struct Body *m)
Check out the type of encryption used.
Definition: crypt.c:660
void mutt_attach_resend(FILE *fp, struct AttachCtx *actx, struct Body *cur)
resend-message, from the attachment menu
Definition: recvcmd.c:288
char * help
quickref for the current menu
Definition: mutt_menu.h:85
struct Message * mx_msg_open(struct Mailbox *m, int msgno)
return a stream pointer for a message
Definition: mx.c:1029
#define REDRAW_CURRENT
Redraw the current line of the menu.
Definition: mutt_menu.h:45
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:796
int msgno
number displayed to the user
Definition: email.h:89
&#39;POP3&#39; Mailbox type
Definition: magic.h:44

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

char* C_AttachSaveDir

Config: Default directory where attachments are saved.

Definition at line 73 of file recvattach.c.

char* C_AttachSep

Config: Separator to add between saved/printed/piped attachments.

Definition at line 74 of file recvattach.c.

bool C_AttachSplit

Config: Save/print/pipe tagged messages individually.

Definition at line 75 of file recvattach.c.

bool C_DigestCollapse

Config: Hide the subparts of a multipart/digest.

Definition at line 76 of file recvattach.c.

char* C_MessageFormat

Config: printf-like format string for listing attached messages.

Definition at line 77 of file recvattach.c.

const char* Mailbox_is_read_only = N_("Mailbox is read-only")
static

Definition at line 81 of file recvattach.c.

const struct Mapping AttachHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT }, { N_("Save"), OP_SAVE }, { N_("Pipe"), OP_PIPE },
{ N_("Print"), OP_PRINT }, { N_("Help"), OP_HELP }, { NULL, 0 },
}
#define N_(a)
Definition: message.h:32

Definition at line 93 of file recvattach.c.

const char* Function_not_permitted
static
Initial value:
=
N_("Function not permitted in attach-message mode")
#define N_(a)
Definition: message.h:32

Definition at line 98 of file recvattach.c.