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

Save/restore and GUI list postponed emails. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "context.h"
#include "format_flags.h"
#include "globals.h"
#include "handler.h"
#include "hdrline.h"
#include "keymap.h"
#include "mutt_logging.h"
#include "mutt_menu.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "mx.h"
#include "opcodes.h"
#include "options.h"
#include "protos.h"
#include "rfc3676.h"
#include "send.h"
#include "sendlib.h"
#include "sort.h"
#include "state.h"
#include "ncrypt/lib.h"
#include "imap/lib.h"
+ Include dependency graph for postpone.c:

Go to the source code of this file.

Functions

int mutt_num_postponed (struct Mailbox *m, bool force)
 Return the number of postponed messages. More...
 
void mutt_update_num_postponed (void)
 Force the update of the number of postponed messages. More...
 
static void post_make_entry (char *buf, size_t buflen, struct Menu *menu, int line)
 Format a menu item for the email list - Implements Menu::make_entry() More...
 
static struct Emailselect_msg (struct Context *ctx)
 Create a Menu to select a postponed message. More...
 
int mutt_get_postponed (struct Context *ctx, struct Email *hdr, struct Email **cur, struct Buffer *fcc)
 Recall a postponed message. More...
 
SecurityFlags mutt_parse_crypt_hdr (const char *p, bool set_empty_signas, SecurityFlags crypt_app)
 Parse a crypto header string. More...
 
int mutt_prepare_template (FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend)
 Prepare a message template. More...
 

Variables

static const struct Mapping PostponeHelp []
 
static short PostCount = 0
 
static bool UpdateNumPostponed = false
 

Detailed Description

Save/restore and GUI list postponed emails.

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

Function Documentation

◆ mutt_num_postponed()

int mutt_num_postponed ( struct Mailbox m,
bool  force 
)

Return the number of postponed messages.

Parameters
mcurrently selected mailbox
force
  • false Use a cached value if costly to get a fresh count (IMAP)
  • true Force check
Return values
numPostponed messages

Definition at line 86 of file postpone.c.

87 {
88  struct stat st;
89 
90  static time_t LastModify = 0;
91  static char *OldPostponed = NULL;
92 
94  {
95  UpdateNumPostponed = false;
96  force = true;
97  }
98 
99  if (!mutt_str_equal(C_Postponed, OldPostponed))
100  {
101  FREE(&OldPostponed);
102  OldPostponed = mutt_str_dup(C_Postponed);
103  LastModify = 0;
104  force = true;
105  }
106 
107  if (!C_Postponed)
108  return 0;
109 
110  // We currently are in the C_Postponed mailbox so just pick the current status
111  if (m && mutt_str_equal(C_Postponed, m->realpath))
112  {
113  PostCount = m->msg_count - m->msg_deleted;
114  return PostCount;
115  }
116 
117 #ifdef USE_IMAP
118  /* LastModify is useless for IMAP */
119  if (imap_path_probe(C_Postponed, NULL) == MUTT_IMAP)
120  {
121  if (force)
122  {
123  short newpc;
124 
125  newpc = imap_path_status(C_Postponed, false);
126  if (newpc >= 0)
127  {
128  PostCount = newpc;
129  mutt_debug(LL_DEBUG3, "%d postponed IMAP messages found\n", PostCount);
130  }
131  else
132  mutt_debug(LL_DEBUG3, "using old IMAP postponed count\n");
133  }
134  return PostCount;
135  }
136 #endif
137 
138  if (stat(C_Postponed, &st) == -1)
139  {
140  PostCount = 0;
141  LastModify = 0;
142  return 0;
143  }
144 
145  if (S_ISDIR(st.st_mode))
146  {
147  /* if we have a maildir mailbox, we need to stat the "new" dir */
148  struct Buffer *buf = mutt_buffer_pool_get();
149 
150  mutt_buffer_printf(buf, "%s/new", C_Postponed);
151  if ((access(mutt_b2s(buf), F_OK) == 0) && (stat(mutt_b2s(buf), &st) == -1))
152  {
153  PostCount = 0;
154  LastModify = 0;
156  return 0;
157  }
159  }
160 
161  if (LastModify < st.st_mtime)
162  {
163 #ifdef USE_NNTP
164  int optnews = OptNews;
165 #endif
166  LastModify = st.st_mtime;
167 
168  if (access(C_Postponed, R_OK | F_OK) != 0)
169  return PostCount = 0;
170 #ifdef USE_NNTP
171  if (optnews)
172  OptNews = false;
173 #endif
174  struct Mailbox *m_post = mx_path_resolve(C_Postponed);
175  struct Context *ctx = mx_mbox_open(m_post, MUTT_NOSORT | MUTT_QUIET);
176  if (ctx)
177  {
178  PostCount = ctx->mailbox->msg_count;
179  }
180  else
181  {
182  mailbox_free(&m_post);
183  PostCount = 0;
184  }
185  mx_fastclose_mailbox(m_post);
186  ctx_free(&ctx);
187 #ifdef USE_NNTP
188  if (optnews)
189  OptNews = true;
190 #endif
191  }
192 
193  return PostCount;
194 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:879
The "current" mailbox.
Definition: context.h:37
int msg_count
Total number of messages.
Definition: mailbox.h:91
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
int imap_path_status(const char *path, bool queue)
Refresh the number of total and new messages.
Definition: imap.c:1187
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
int msg_deleted
Number of deleted messages.
Definition: mailbox.h:96
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:84
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
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
struct Context * mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:265
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:160
struct Mailbox * mailbox
Definition: context.h:50
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:60
void mx_fastclose_mailbox(struct Mailbox *m)
free up memory associated with the Mailbox
Definition: mx.c:424
#define mutt_b2s(buf)
Definition: buffer.h:41
A mailbox.
Definition: mailbox.h:81
#define MUTT_NOSORT
Do not sort the mailbox after opening it.
Definition: mx.h:53
static short PostCount
Definition: postpone.c:75
#define MUTT_QUIET
Do not print any messages.
Definition: mx.h:56
#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
static bool UpdateNumPostponed
Definition: postpone.c:76
void ctx_free(struct Context **ptr)
Free a Context.
Definition: context.c:48
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
WHERE char * C_Postponed
Config: Folder to store postponed messages.
Definition: globals.h:130
&#39;IMAP&#39; Mailbox type
Definition: mailbox.h:53
WHERE bool OptNews
(pseudo) used to change reader mode
Definition: options.h:45
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:

◆ mutt_update_num_postponed()

void mutt_update_num_postponed ( void  )

Force the update of the number of postponed messages.

Definition at line 199 of file postpone.c.

200 {
201  UpdateNumPostponed = true;
202 }
static bool UpdateNumPostponed
Definition: postpone.c:76
+ Here is the caller graph for this function:

◆ post_make_entry()

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

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

Definition at line 207 of file postpone.c.

208 {
209  struct Context *ctx = menu->mdata;
210 
211  mutt_make_string_flags(buf, buflen, menu->win_index->state.cols,
212  NONULL(C_IndexFormat), ctx, ctx->mailbox,
214 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
The "current" mailbox.
Definition: context.h:37
#define NONULL(x)
Definition: string2.h:37
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
struct Mailbox * mailbox
Definition: context.h:50
void mutt_make_string_flags(char *buf, size_t buflen, int cols, const char *s, struct Context *ctx, struct Mailbox *m, struct Email *e, MuttFormatFlags flags)
Create formatted strings using mailbox expandos.
Definition: hdrline.c:1407
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
WHERE char * C_IndexFormat
Config: printf-like format string for the index menu (emails)
Definition: globals.h:112
int const char int line
Definition: acutest.h:617
struct MuttWindow * win_index
Definition: mutt_menu.h:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ select_msg()

static struct Email* select_msg ( struct Context ctx)
static

Create a Menu to select a postponed message.

Parameters
ctxContext
Return values
ptrEmail

Definition at line 221 of file postpone.c.

222 {
223  int r = -1;
224  bool done = false;
225  char helpstr[1024];
226 
227  struct MuttWindow *dlg =
230  dlg->notify = notify_new();
231 
232  struct MuttWindow *index =
235  index->notify = notify_new();
236  notify_set_parent(index->notify, dlg->notify);
237 
238  struct MuttWindow *ibar =
241  ibar->notify = notify_new();
242  notify_set_parent(ibar->notify, dlg->notify);
243 
244  if (C_StatusOnTop)
245  {
246  mutt_window_add_child(dlg, ibar);
247  mutt_window_add_child(dlg, index);
248  }
249  else
250  {
251  mutt_window_add_child(dlg, index);
252  mutt_window_add_child(dlg, ibar);
253  }
254 
255  dialog_push(dlg);
256 
257  struct Menu *menu = mutt_menu_new(MENU_POSTPONE);
258 
259  menu->pagelen = index->state.rows;
260  menu->win_index = index;
261  menu->win_ibar = ibar;
262 
263  menu->make_entry = post_make_entry;
264  menu->max = ctx->mailbox->msg_count;
265  menu->title = _("Postponed Messages");
266  menu->mdata = ctx;
267  menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_POSTPONE, PostponeHelp);
269 
270  /* The postponed mailbox is setup to have sorting disabled, but the global
271  * C_Sort variable may indicate something different. Sorting has to be
272  * disabled while the postpone menu is being displayed. */
273  const short orig_sort = C_Sort;
274  C_Sort = SORT_ORDER;
275 
276  while (!done)
277  {
278  const int op = mutt_menu_loop(menu);
279  switch (op)
280  {
281  case OP_DELETE:
282  case OP_UNDELETE:
283  /* should deleted draft messages be saved in the trash folder? */
284  mutt_set_flag(ctx->mailbox, ctx->mailbox->emails[menu->current],
285  MUTT_DELETE, (op == OP_DELETE));
287  if (C_Resolve && (menu->current < menu->max - 1))
288  {
289  menu->oldcurrent = menu->current;
290  menu->current++;
291  if (menu->current >= menu->top + menu->pagelen)
292  {
293  menu->top = menu->current;
294  menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;
295  }
296  else
297  menu->redraw |= REDRAW_MOTION_RESYNC;
298  }
299  else
300  menu->redraw |= REDRAW_CURRENT;
301  break;
302 
303  case OP_GENERIC_SELECT_ENTRY:
304  r = menu->current;
305  done = true;
306  break;
307 
308  case OP_EXIT:
309  done = true;
310  break;
311  }
312  }
313 
314  C_Sort = orig_sort;
315  mutt_menu_pop_current(menu);
316  mutt_menu_free(&menu);
317  dialog_pop();
318  mutt_window_free(&dlg);
319 
320  return (r > -1) ? ctx->mailbox->emails[r] : NULL;
321 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
static const struct Mapping PostponeHelp[]
Definition: postpone.c:67
WHERE bool C_StatusOnTop
Config: Display the status bar at the top.
Definition: globals.h:247
int msg_count
Total number of messages.
Definition: mailbox.h:91
#define mutt_set_flag(m, e, flag, bf)
Definition: protos.h:68
GUI selectable list of items.
Definition: mutt_menu.h:80
int msg_deleted
Number of deleted messages.
Definition: mailbox.h:96
Window uses all available vertical space.
Definition: mutt_window.h:35
int oldcurrent
For driver use only.
Definition: mutt_menu.h:106
void dialog_pop(void)
Hide a Window from the user.
Definition: mutt_window.c:722
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: mutt_window.c:697
#define _(a)
Definition: message.h:28
A division of the screen.
Definition: mutt_window.h:108
static void post_make_entry(char *buf, size_t buflen, struct Menu *menu, int line)
Format a menu item for the email list - Implements Menu::make_entry()
Definition: postpone.c:207
An Index Window containing a selection list.
Definition: mutt_window.h:93
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:150
struct Notify * notify
Notifications system.
Definition: mutt_window.h:123
struct Mailbox * mailbox
Definition: context.h:50
struct MuttWindow * win_ibar
Definition: mutt_menu.h:93
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:55
const char * title
Title of this menu.
Definition: mutt_menu.h:82
WHERE short C_Sort
Config: Sort method for the index.
Definition: sort.h:58
Window has a fixed size.
Definition: mutt_window.h:44
const char * help
Quickref for the current menu.
Definition: mutt_menu.h:83
#define REDRAW_MOTION_RESYNC
Redraw any changing the menu selection.
Definition: mutt_menu.h:42
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:49
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
#define REDRAW_STATUS
Redraw the status bar.
Definition: mutt_menu.h:44
Messages to be deleted.
Definition: mutt.h:98
#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
int top
Entry that is the top of the current page.
Definition: mutt_menu.h:105
WHERE bool C_Resolve
Config: Move to the next email whenever a command modifies an email.
Definition: globals.h:238
static short PostCount
Definition: postpone.c:75
int pagelen
Number of entries per screen.
Definition: mutt_menu.h:89
int max
Number of entries in the menu.
Definition: mutt_menu.h:86
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:564
MuttRedrawFlags redraw
When to redraw the screen.
Definition: mutt_menu.h:87
#define REDRAW_INDEX
Redraw the index.
Definition: mutt_menu.h:40
Postpone Dialog, select_msg()
Definition: mutt_window.h:85
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:82
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
int current
Current entry.
Definition: mutt_menu.h:85
struct MuttWindow * win_index
Definition: mutt_menu.h:92
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
Window wants as much space as possible.
Definition: mutt_window.h:45
Index Bar containing status info about the Index.
Definition: mutt_window.h:94
void(* make_entry)(char *buf, size_t buflen, struct Menu *menu, int line)
Format a item for a menu.
Definition: mutt_menu.h:117
Select a postponed email.
Definition: keymap.h:80
#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:

◆ mutt_get_postponed()

int mutt_get_postponed ( struct Context ctx,
struct Email hdr,
struct Email **  cur,
struct Buffer fcc 
)

Recall a postponed message.

Parameters
[in]ctxContext info, used when recalling a message to which we reply
[in]hdrenvelope/attachment info for recalled message
[out]curif message was a reply, 'cur' is set to the message which 'hdr' is in reply to
[in]fccfcc for the recalled message
Return values
-1Error/no messages
0Normal exit
SEND_REPLYRecalled message is a reply

Definition at line 333 of file postpone.c.

335 {
336  if (!C_Postponed)
337  return -1;
338 
339  struct Email *e = NULL;
340  int rc = SEND_POSTPONED;
341  const char *p = NULL;
342  struct Context *ctx_post = NULL;
343 
344  struct Mailbox *m = mx_path_resolve(C_Postponed);
345  if (ctx && (ctx->mailbox == m))
346  ctx_post = ctx;
347  else
348  ctx_post = mx_mbox_open(m, MUTT_NOSORT);
349 
350  if (!ctx_post)
351  {
352  PostCount = 0;
353  mutt_error(_("No postponed messages"));
354  mailbox_free(&m);
355  return -1;
356  }
357 
358  /* TODO:
359  * mx_mbox_open() for IMAP leaves IMAP_REOPEN_ALLOW set. For the
360  * index this is papered-over because it calls mx_check_mailbox()
361  * every event loop(which resets that flag).
362  *
363  * For a stable-branch fix, I'm doing the same here, to prevent
364  * context changes from occuring behind the scenes and causing
365  * segvs, but probably the flag needs to be reset after downloading
366  * headers in imap_open_mailbox().
367  */
368  mx_mbox_check(ctx_post->mailbox, NULL);
369 
370  if (ctx_post->mailbox->msg_count == 0)
371  {
372  PostCount = 0;
373  if (ctx_post == ctx)
374  ctx_post = NULL;
375  else
376  mx_mbox_close(&ctx_post);
377  mutt_error(_("No postponed messages"));
378  return -1;
379  }
380 
381  if (ctx_post->mailbox->msg_count == 1)
382  {
383  /* only one message, so just use that one. */
384  e = ctx_post->mailbox->emails[0];
385  }
386  else if (!(e = select_msg(ctx_post)))
387  {
388  if (ctx_post == ctx)
389  ctx_post = NULL;
390  else
391  mx_mbox_close(&ctx_post);
392  return -1;
393  }
394 
395  if (mutt_prepare_template(NULL, ctx_post->mailbox, hdr, e, false) < 0)
396  {
397  if (ctx_post != ctx)
398  {
399  mx_fastclose_mailbox(ctx_post->mailbox);
400  FREE(&ctx_post);
401  }
402  return -1;
403  }
404 
405  /* finished with this message, so delete it. */
406  mutt_set_flag(ctx_post->mailbox, e, MUTT_DELETE, true);
407  mutt_set_flag(ctx_post->mailbox, e, MUTT_PURGE, true);
408 
409  /* update the count for the status display */
410  PostCount = ctx_post->mailbox->msg_count - ctx_post->mailbox->msg_deleted;
411 
412  /* avoid the "purge deleted messages" prompt */
413  int opt_delete = C_Delete;
414  C_Delete = MUTT_YES;
415  if (ctx_post == ctx)
416  ctx_post = NULL;
417  else
418  mx_mbox_close(&ctx_post);
419  C_Delete = opt_delete;
420 
421  struct ListNode *np = NULL, *tmp = NULL;
422  STAILQ_FOREACH_SAFE(np, &hdr->env->userhdrs, entries, tmp)
423  {
424  size_t plen = mutt_istr_startswith(np->data, "X-Mutt-References:");
425  if (plen)
426  {
427  /* if a mailbox is currently open, look to see if the original message
428  * the user attempted to reply to is in this mailbox */
429  p = mutt_str_skip_email_wsp(np->data + plen);
430  if (!ctx->mailbox->id_hash)
432  *cur = mutt_hash_find(ctx->mailbox->id_hash, p);
433 
434  if (*cur)
435  rc |= SEND_REPLY;
436  }
437  else if ((plen = mutt_istr_startswith(np->data, "X-Mutt-Fcc:")))
438  {
439  p = mutt_str_skip_email_wsp(np->data + plen);
440  mutt_buffer_strcpy(fcc, p);
442 
443  /* note that x-mutt-fcc was present. we do this because we want to add a
444  * default fcc if the header was missing, but preserve the request of the
445  * user to not make a copy if the header field is present, but empty.
446  * see http://dev.mutt.org/trac/ticket/3653 */
447  rc |= SEND_POSTPONED_FCC;
448  }
449  else if (((WithCrypto & APPLICATION_PGP) != 0) &&
450  /* this is generated by old neomutt versions */
451  (mutt_str_startswith(np->data, "Pgp:") ||
452  /* this is the new way */
453  mutt_str_startswith(np->data, "X-Mutt-PGP:")))
454  {
455  hdr->security = mutt_parse_crypt_hdr(strchr(np->data, ':') + 1, true, APPLICATION_PGP);
456  hdr->security |= APPLICATION_PGP;
457  }
458  else if (((WithCrypto & APPLICATION_SMIME) != 0) &&
459  mutt_str_startswith(np->data, "X-Mutt-SMIME:"))
460  {
461  hdr->security = mutt_parse_crypt_hdr(strchr(np->data, ':') + 1, true, APPLICATION_SMIME);
462  hdr->security |= APPLICATION_SMIME;
463  }
464 #ifdef MIXMASTER
465  else if (mutt_str_startswith(np->data, "X-Mutt-Mix:"))
466  {
467  mutt_list_free(&hdr->chain);
468 
469  char *t = strtok(np->data + 11, " \t\n");
470  while (t)
471  {
473  t = strtok(NULL, " \t\n");
474  }
475  }
476 #endif
477  else
478  {
479  // skip header removal
480  continue;
481  }
482 
483  // remove the header
484  STAILQ_REMOVE(&hdr->env->userhdrs, np, ListNode, entries);
485  FREE(&np->data);
486  FREE(&np);
487  }
488 
491 
492  return rc;
493 }
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
Definition: hash.c:354
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
The "current" mailbox.
Definition: context.h:37
#define STAILQ_REMOVE(head, elm, type, field)
Definition: queue.h:399
int msg_count
Total number of messages.
Definition: mailbox.h:91
#define mutt_set_flag(m, e, flag, bf)
Definition: protos.h:68
#define WithCrypto
Definition: lib.h:163
#define SEND_POSTPONED_FCC
Used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present.
Definition: send.h:97
The envelope/body of an email.
Definition: email.h:37
static struct Email * select_msg(struct Context *ctx)
Create a Menu to select a postponed message.
Definition: postpone.c:221
int mx_mbox_check(struct Mailbox *m, int *index_hint)
Check for new mail - Wrapper for MxOps::mbox_check()
Definition: mx.c:1114
int msg_deleted
Number of deleted messages.
Definition: mailbox.h:96
int mx_mbox_close(struct Context **ptr)
Save changes and close mailbox.
Definition: mx.c:603
User answered &#39;Yes&#39;, or assume &#39;Yes&#39;.
Definition: quad.h:40
static size_t plen
Length of cached packet.
Definition: pgppacket.c:39
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for message-ids.
Definition: mutt_thread.c:1455
WHERE unsigned char C_Delete
Config: Really delete messages, when the mailbox is closed.
Definition: globals.h:176
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:375
struct ListHead userhdrs
user defined headers
Definition: envelope.h:83
#define _(a)
Definition: message.h:28
struct Context * mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:265
Messages to be purged (bypass trash)
Definition: mutt.h:100
#define SEND_POSTPONED
Recall a postponed email.
Definition: send.h:92
void mutt_buffer_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using &#39;~&#39; or &#39;=&#39;.
Definition: muttlib.c:688
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
struct Mailbox * mailbox
Definition: context.h:50
struct HashTable * id_hash
Hash Table by msg id.
Definition: mailbox.h:127
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition: mailbox.c:60
struct Envelope * env
Envelope information.
Definition: email.h:89
void mx_fastclose_mailbox(struct Mailbox *m)
free up memory associated with the Mailbox
Definition: mx.c:424
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:359
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:138
struct ListHead chain
Mixmaster chain.
Definition: email.h:99
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
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:165
Messages to be deleted.
Definition: mutt.h:98
A mailbox.
Definition: mailbox.h:81
#define MUTT_NOSORT
Do not sort the mailbox after opening it.
Definition: mx.h:53
static short PostCount
Definition: postpone.c:75
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
Definition: string.c:751
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
Definition: string.c:177
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
#define SEND_REPLY
Reply to sender.
Definition: send.h:88
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:312
SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, SecurityFlags crypt_app)
Parse a crypto header string.
Definition: postpone.c:502
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
Definition: crypt.c:1031
char * data
String.
Definition: list.h:36
#define mutt_error(...)
Definition: logging.h:84
#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
WHERE char * C_Postponed
Config: Folder to store postponed messages.
Definition: globals.h:130
A List node for strings.
Definition: list.h:34
int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend)
Prepare a message template.
Definition: postpone.c:658
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_parse_crypt_hdr()

SecurityFlags mutt_parse_crypt_hdr ( const char *  p,
bool  set_empty_signas,
SecurityFlags  crypt_app 
)

Parse a crypto header string.

Parameters
pHeader string to parse
set_empty_signasAllow an empty "Sign as"
crypt_appApp, e.g. APPLICATION_PGP
Return values
numSecurityFlags, see SecurityFlags

Definition at line 502 of file postpone.c.

503 {
504  char smime_cryptalg[1024] = { 0 };
505  char sign_as[1024] = { 0 };
506  char *q = NULL;
507  SecurityFlags flags = SEC_NO_FLAGS;
508 
509  if (!WithCrypto)
510  return SEC_NO_FLAGS;
511 
513  for (; p[0] != '\0'; p++)
514  {
515  switch (p[0])
516  {
517  case 'c':
518  case 'C':
519  q = smime_cryptalg;
520 
521  if (p[1] == '<')
522  {
523  for (p += 2; (p[0] != '\0') && (p[0] != '>') &&
524  (q < (smime_cryptalg + sizeof(smime_cryptalg) - 1));
525  *q++ = *p++)
526  {
527  }
528 
529  if (p[0] != '>')
530  {
531  mutt_error(_("Illegal S/MIME header"));
532  return SEC_NO_FLAGS;
533  }
534  }
535 
536  *q = '\0';
537  break;
538 
539  case 'e':
540  case 'E':
541  flags |= SEC_ENCRYPT;
542  break;
543 
544  case 'i':
545  case 'I':
546  flags |= SEC_INLINE;
547  break;
548 
549  /* This used to be the micalg parameter.
550  *
551  * It's no longer needed, so we just skip the parameter in order
552  * to be able to recall old messages. */
553  case 'm':
554  case 'M':
555  if (p[1] != '<')
556  break;
557 
558  for (p += 2; (p[0] != '\0') && (p[0] != '>'); p++)
559  ; // do nothing
560 
561  if (p[0] != '>')
562  {
563  mutt_error(_("Illegal crypto header"));
564  return SEC_NO_FLAGS;
565  }
566  break;
567 
568  case 'o':
569  case 'O':
570  flags |= SEC_OPPENCRYPT;
571  break;
572 
573  case 'a':
574  case 'A':
575 #ifdef USE_AUTOCRYPT
576  flags |= SEC_AUTOCRYPT;
577 #endif
578  break;
579 
580  case 'z':
581  case 'Z':
582 #ifdef USE_AUTOCRYPT
583  flags |= SEC_AUTOCRYPT_OVERRIDE;
584 #endif
585  break;
586 
587  case 's':
588  case 'S':
589  flags |= SEC_SIGN;
590  q = sign_as;
591 
592  if (p[1] == '<')
593  {
594  for (p += 2;
595  (p[0] != '\0') && (*p != '>') && (q < (sign_as + sizeof(sign_as) - 1));
596  *q++ = *p++)
597  {
598  }
599 
600  if (p[0] != '>')
601  {
602  mutt_error(_("Illegal crypto header"));
603  return SEC_NO_FLAGS;
604  }
605  }
606 
607  q[0] = '\0';
608  break;
609 
610  default:
611  mutt_error(_("Illegal crypto header"));
612  return SEC_NO_FLAGS;
613  }
614  }
615 
616  /* the cryptalg field must not be empty */
617  if (((WithCrypto & APPLICATION_SMIME) != 0) && *smime_cryptalg)
618  {
619  struct Buffer errmsg = mutt_buffer_make(0);
620  int rc = cs_subset_str_string_set(NeoMutt->sub, "smime_encrypt_with",
621  smime_cryptalg, &errmsg);
622 
623  if ((CSR_RESULT(rc) != CSR_SUCCESS) && !mutt_buffer_is_empty(&errmsg))
624  mutt_error("%s", mutt_b2s(&errmsg));
625 
626  mutt_buffer_dealloc(&errmsg);
627  }
628 
629  /* Set {Smime,Pgp}SignAs, if desired. */
630 
631  if (((WithCrypto & APPLICATION_PGP) != 0) && (crypt_app == APPLICATION_PGP) &&
632  (flags & SEC_SIGN) && (set_empty_signas || *sign_as))
633  {
634  mutt_str_replace(&C_PgpSignAs, sign_as);
635  }
636 
637  if (((WithCrypto & APPLICATION_SMIME) != 0) && (crypt_app == APPLICATION_SMIME) &&
638  (flags & SEC_SIGN) && (set_empty_signas || *sign_as))
639  {
640  mutt_str_replace(&C_SmimeSignAs, sign_as);
641  }
642 
643  return flags;
644 }
#define WithCrypto
Definition: lib.h:163
#define CSR_RESULT(x)
Definition: set.h:52
#define SEC_NO_FLAGS
No flags are set.
Definition: lib.h:124
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:125
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
Definition: buffer.c:61
String manipulation buffer.
Definition: buffer.h:33
#define _(a)
Definition: message.h:28
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:134
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
Definition: lib.h:123
int cs_subset_str_string_set(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Set a config item by string.
Definition: subset.c:395
Container for Accounts, Notifications.
Definition: neomutt.h:36
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:132
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition: buffer.c:294
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
#define mutt_b2s(buf)
Definition: buffer.h:41
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:138
#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
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
Definition: string.c:751
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:450
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
Definition: lib.h:133
#define SEC_SIGN
Email is signed.
Definition: lib.h:126
#define mutt_error(...)
Definition: logging.h:84
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
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
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:252
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_prepare_template()

int mutt_prepare_template ( FILE *  fp,
struct Mailbox m,
struct Email e_new,
struct Email e,
bool  resend 
)

Prepare a message template.

Parameters
fpIf not NULL, file containing the template
mIf fp is NULL, the Mailbox containing the header with the template
e_newThe template is read into this Header
eEmail to recall/resend
resendSet if resending (as opposed to recalling a postponed msg) Resent messages enable header weeding, and also discard any existing Message-ID and Mail-Followup-To
Return values
0Success
-1Error

Definition at line 658 of file postpone.c.

660 {
661  struct Message *msg = NULL;
662  struct Body *b = NULL;
663  FILE *fp_body = NULL;
664  int rc = -1;
665  struct State s = { 0 };
666  SecurityFlags sec_type;
667  struct Envelope *protected_headers = NULL;
668 
669  if (!fp && !(msg = mx_msg_open(m, e->msgno)))
670  return -1;
671 
672  if (!fp)
673  fp = msg->fp;
674 
675  fp_body = fp;
676 
677  /* parse the message header and MIME structure */
678 
679  fseeko(fp, e->offset, SEEK_SET);
680  e_new->offset = e->offset;
681  /* enable header weeding for resent messages */
682  e_new->env = mutt_rfc822_read_header(fp, e_new, true, resend);
683  e_new->content->length = e->content->length;
684  mutt_parse_part(fp, e_new->content);
685 
686  /* If resending a message, don't keep message_id or mail_followup_to.
687  * Otherwise, we are resuming a postponed message, and want to keep those
688  * headers if they exist. */
689  if (resend)
690  {
691  FREE(&e_new->env->message_id);
692  FREE(&e_new->env->mail_followup_to);
693  }
694 
695  /* decrypt pgp/mime encoded messages */
696 
697  if (((WithCrypto & APPLICATION_PGP) != 0) &&
698  (sec_type = mutt_is_multipart_encrypted(e_new->content)))
699  {
700  e_new->security |= sec_type;
701  if (!crypt_valid_passphrase(sec_type))
702  goto bail;
703 
704  mutt_message(_("Decrypting message..."));
705  if ((crypt_pgp_decrypt_mime(fp, &fp_body, e_new->content, &b) == -1) || !b)
706  {
707  goto bail;
708  }
709 
710  mutt_body_free(&e_new->content);
711  e_new->content = b;
712 
713  if (b->mime_headers)
714  {
715  protected_headers = b->mime_headers;
716  b->mime_headers = NULL;
717  }
718 
720  }
721 
722  /* remove a potential multipart/signed layer - useful when
723  * resending messages */
724  if ((WithCrypto != 0) && mutt_is_multipart_signed(e_new->content))
725  {
726  e_new->security |= SEC_SIGN;
727  if (((WithCrypto & APPLICATION_PGP) != 0) &&
728  mutt_istr_equal(mutt_param_get(&e_new->content->parameter, "protocol"),
729  "application/pgp-signature"))
730  {
731  e_new->security |= APPLICATION_PGP;
732  }
733  else if (WithCrypto & APPLICATION_SMIME)
734  e_new->security |= APPLICATION_SMIME;
735 
736  /* destroy the signature */
737  mutt_body_free(&e_new->content->parts->next);
738  e_new->content = mutt_remove_multipart(e_new->content);
739 
740  if (e_new->content->mime_headers)
741  {
742  mutt_env_free(&protected_headers);
743  protected_headers = e_new->content->mime_headers;
744  e_new->content->mime_headers = NULL;
745  }
746  }
747 
748  /* We don't need no primary multipart.
749  * Note: We _do_ preserve messages!
750  *
751  * XXX - we don't handle multipart/alternative in any
752  * smart way when sending messages. However, one may
753  * consider this a feature. */
754  if (e_new->content->type == TYPE_MULTIPART)
755  e_new->content = mutt_remove_multipart(e_new->content);
756 
757  s.fp_in = fp_body;
758 
759  struct Buffer *file = mutt_buffer_pool_get();
760 
761  /* create temporary files for all attachments */
762  for (b = e_new->content; b; b = b->next)
763  {
764  /* what follows is roughly a receive-mode variant of
765  * mutt_get_tmp_attachment () from muttlib.c */
766 
767  mutt_buffer_reset(file);
768  if (b->filename)
769  {
770  mutt_buffer_strcpy(file, b->filename);
772  }
773  else
774  {
775  /* avoid Content-Disposition: header with temporary filename */
776  b->use_disp = false;
777  }
778 
779  /* set up state flags */
780 
781  s.flags = 0;
782 
783  if (b->type == TYPE_TEXT)
784  {
785  if (mutt_istr_equal("yes",
786  mutt_param_get(&b->parameter, "x-mutt-noconv")))
787  {
788  b->noconv = true;
789  }
790  else
791  {
792  s.flags |= MUTT_CHARCONV;
793  b->noconv = false;
794  }
795 
796  mutt_param_delete(&b->parameter, "x-mutt-noconv");
797  }
798 
799  mutt_adv_mktemp(file);
800  s.fp_out = mutt_file_fopen(mutt_b2s(file), "w");
801  if (!s.fp_out)
802  goto bail;
803 
804  if (((WithCrypto & APPLICATION_PGP) != 0) &&
805  ((sec_type = mutt_is_application_pgp(b)) & (SEC_ENCRYPT | SEC_SIGN)))
806  {
807  if (sec_type & SEC_ENCRYPT)
808  {
809  if (!crypt_valid_passphrase(APPLICATION_PGP))
810  goto bail;
811  mutt_message(_("Decrypting message..."));
812  }
813 
814  if (mutt_body_handler(b, &s) < 0)
815  {
816  mutt_error(_("Decryption failed"));
817  goto bail;
818  }
819 
820  if ((b == e_new->content) && !protected_headers)
821  {
822  protected_headers = b->mime_headers;
823  b->mime_headers = NULL;
824  }
825 
826  e_new->security |= sec_type;
827  b->type = TYPE_TEXT;
828  mutt_str_replace(&b->subtype, "plain");
829  mutt_param_delete(&b->parameter, "x-action");
830  }
831  else if (((WithCrypto & APPLICATION_SMIME) != 0) &&
832  ((sec_type = mutt_is_application_smime(b)) & (SEC_ENCRYPT | SEC_SIGN)))
833  {
834  if (sec_type & SEC_ENCRYPT)
835  {
836  if (!crypt_valid_passphrase(APPLICATION_SMIME))
837  goto bail;
838  crypt_smime_getkeys(e_new->env);
839  mutt_message(_("Decrypting message..."));
840  }
841 
842  if (mutt_body_handler(b, &s) < 0)
843  {
844  mutt_error(_("Decryption failed"));
845  goto bail;
846  }
847 
848  e_new->security |= sec_type;
849  b->type = TYPE_TEXT;
850  mutt_str_replace(&b->subtype, "plain");
851  }
852  else
853  mutt_decode_attachment(b, &s);
854 
855  if (mutt_file_fclose(&s.fp_out) != 0)
856  goto bail;
857 
858  mutt_str_replace(&b->filename, mutt_b2s(file));
859  b->unlink = true;
860 
862 
863  mutt_body_free(&b->parts);
864  if (b->email)
865  b->email->content = NULL; /* avoid dangling pointer */
866  }
867 
868  if (C_CryptProtectedHeadersRead && protected_headers && protected_headers->subject &&
869  !mutt_str_equal(e_new->env->subject, protected_headers->subject))
870  {
871  mutt_str_replace(&e_new->env->subject, protected_headers->subject);
872  }
873  mutt_env_free(&protected_headers);
874 
875  /* Fix encryption flags. */
876 
877  /* No inline if multipart. */
878  if ((WithCrypto != 0) && (e_new->security & SEC_INLINE) && e_new->content->next)
879  e_new->security &= ~SEC_INLINE;
880 
881  /* Do we even support multiple mechanisms? */
882  e_new->security &= WithCrypto | ~(APPLICATION_PGP | APPLICATION_SMIME);
883 
884  /* Theoretically, both could be set. Take the one the user wants to set by default. */
885  if ((e_new->security & APPLICATION_PGP) && (e_new->security & APPLICATION_SMIME))
886  {
887  if (C_SmimeIsDefault)
888  e_new->security &= ~APPLICATION_PGP;
889  else
890  e_new->security &= ~APPLICATION_SMIME;
891  }
892 
894 
895  rc = 0;
896 
897 bail:
898 
899  /* that's it. */
901  if (fp_body != fp)
902  mutt_file_fclose(&fp_body);
903  if (msg)
904  mx_msg_close(m, &msg);
905 
906  if (rc == -1)
907  {
908  mutt_env_free(&e_new->env);
909  mutt_body_free(&e_new->content);
910  }
911 
912  return rc;
913 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:879
void mutt_decode_attachment(struct Body *b, struct State *s)
Decode an email&#39;s attachment.
Definition: handler.c:1835
void mutt_stamp_attachment(struct Body *a)
Timestamp an Attachment.
Definition: sendlib.c:1449
char * filename
when sending a message, this is the file to which this structure refers
Definition: body.h:46
struct Envelope * mime_headers
Memory hole protected headers.
Definition: body.h:63
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
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:101
struct AddressList mail_followup_to
Email&#39;s &#39;mail-followup-to&#39;.
Definition: envelope.h:63
#define MUTT_CHARCONV
Do character set conversions.
Definition: state.h:36
#define mutt_message(...)
Definition: logging.h:83
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:125
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
Definition: pool.c:112
struct Body * content
List of MIME parts.
Definition: email.h:90
bool noconv
Don&#39;t do character set conversion.
Definition: body.h:73
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
struct Body * next
next attachment in the list
Definition: body.h:53
FILE * fp_out
File to write to.
Definition: state.h:47
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
Definition: lib.h:123
FILE * fp_in
File to read from.
Definition: state.h:46
The body of an email.
Definition: body.h:34
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:132
WHERE bool C_SmimeIsDefault
Config: Use SMIME rather than PGP by default.
Definition: globals.h:268
StateFlags flags
Flags, e.g. MUTT_DISPLAY.
Definition: state.h:49
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
Definition: mx.c:1181
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
Definition: crypt.c:146
char * message_id
Message ID.
Definition: envelope.h:69
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
Definition: crypt.c:457
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
SecurityFlags mutt_is_multipart_signed(struct Body *b)
Is a message signed?
Definition: crypt.c:417
void mutt_rfc3676_space_unstuff(struct Email *e)
Remove RFC3676 space stuffing.
Definition: rfc3676.c:480
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:113
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
Definition: string.c:891
char * subtype
content-type subtype
Definition: body.h:37
void mutt_param_delete(struct ParameterList *pl, const char *attribute)
Delete a matching Parameter.
Definition: parameter.c:142
#define mutt_b2s(buf)
Definition: buffer.h:41
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:138
SecurityFlags mutt_is_application_pgp(struct Body *m)
Does the message use PGP?
Definition: crypt.c:562
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:137
A local copy of an email.
Definition: mx.h:83
LOFF_T length
length (in bytes) of attachment
Definition: body.h:45
Type: &#39;text/*&#39;.
Definition: mime.h:38
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
Definition: envelope.c:96
void crypt_smime_getkeys(struct Envelope *env)
Wrapper for CryptModuleSpecs::smime_getkeys()
Definition: cryptglue.c:460
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
SecurityFlags mutt_is_application_smime(struct Body *m)
Does the message use S/MIME?
Definition: crypt.c:620
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
WHERE bool C_CryptProtectedHeadersRead
Config: Display protected headers (Memory Hole) in the pager.
Definition: globals.h:265
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:450
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
LOFF_T offset
Where in the stream does this message begin?
Definition: email.h:83
#define SEC_SIGN
Email is signed.
Definition: lib.h:126
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition: parse.c:1374
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:212
char * subject
Email&#39;s subject.
Definition: envelope.h:66
Type: &#39;multipart/*&#39;.
Definition: mime.h:37
bool use_disp
Content-Disposition uses filename= ?
Definition: body.h:68
#define mutt_error(...)
Definition: logging.h:84
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
Definition: body.h:69
FILE * fp
pointer to the message data
Definition: mx.h:85
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
Definition: muttlib.c:94
#define FREE(x)
Definition: memory.h:40
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
Definition: parameter.c:84
Keep track when processing files.
Definition: state.h:44
int mutt_body_handler(struct Body *b, struct State *s)
Handler for the Body of an email.
Definition: handler.c:1585
char * d_filename
filename to be used for the content-disposition header.
Definition: body.h:47
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition: body.c:57
int const char * file
Definition: acutest.h:617
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
Definition: file.c:588
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
parses an RFC822 header
Definition: parse.c:1105
struct ParameterList parameter
parameters of the content-type
Definition: body.h:39
struct Email * email
header information for message/rfc822
Definition: body.h:55
struct Message * mx_msg_open(struct Mailbox *m, int msgno)
return a stream pointer for a message
Definition: mx.c:1133
The header of an Email.
Definition: envelope.h:54
int msgno
Number displayed to the user.
Definition: email.h:86
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ PostponeHelp

const struct Mapping PostponeHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}
#define N_(a)
Definition: message.h:32

Definition at line 67 of file postpone.c.

◆ PostCount

short PostCount = 0
static

Definition at line 75 of file postpone.c.

◆ UpdateNumPostponed

bool UpdateNumPostponed = false
static

Definition at line 76 of file postpone.c.