72 struct stat st = { 0 };
74 static time_t LastModify = 0;
75 static char *OldPostponed = NULL;
123 if (stat(c_postponed, &st) == -1)
130 if (S_ISDIR(st.st_mode))
146 if (LastModify < st.st_mtime)
149 LastModify = st.st_mtime;
151 if (access(c_postponed, R_OK | F_OK) != 0)
206 char smime_cryptalg[1024] = { 0 };
207 char sign_as[1024] = { 0 };
215 for (; p[0] !=
'\0'; p++)
225 for (p += 2; (p[0] !=
'\0') && (p[0] !=
'>') &&
226 (q < (smime_cryptalg +
sizeof(smime_cryptalg) - 1));
260 for (p += 2; (p[0] !=
'\0') && (p[0] !=
'>'); p++)
297 (p[0] !=
'\0') && (*p !=
'>') && (q < (sign_as +
sizeof(sign_as) - 1));
323 smime_cryptalg, errmsg);
334 (flags &
SEC_SIGN) && (set_empty_signas || *sign_as))
340 (flags &
SEC_SIGN) && (set_empty_signas || *sign_as))
362 struct Body *b = NULL;
363 struct State state = { 0 };
365 state.
fp_in = fp_body;
367 for (b = body; b; b = b->
next)
437 if ((b == body) && !protected_headers)
484 struct Email *e,
bool resend)
487 struct Body *b = NULL;
488 FILE *fp_body = NULL;
490 struct Envelope *protected_headers = NULL;
491 struct Buffer *file = NULL;
539 if ((ret == -1) || !b)
541 mutt_error(
_(
"Could not decrypt postponed message"));
599 if (c_crypt_protected_headers_read && protected_headers && protected_headers->
subject &&
619 if (c_smime_is_default)
620 e_new->
security &= ~APPLICATION_PGP;
622 e_new->
security &= ~APPLICATION_SMIME;
664 struct Email *e = NULL;
666 const char *p = NULL;
722 struct ListNode *np = NULL, *tmp = NULL;
786 if (c_crypt_opportunistic_encrypt)
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
enum QuadOption cs_subset_quad(const struct ConfigSubset *sub, const char *name)
Get a quad-value config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
#define CSR_SUCCESS
Action completed successfully.
Convenience wrapper for the core headers.
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
@ MUTT_IMAP
'IMAP' Mailbox type
void crypt_opportunistic_encrypt(struct Email *e)
Can all recipients be determined.
SecurityFlags mutt_is_multipart_signed(struct Body *b)
Is a message signed?
SecurityFlags mutt_is_application_smime(struct Body *b)
Does the message use S/MIME?
bool crypt_valid_passphrase(SecurityFlags flags)
Check that we have a usable passphrase, ask if not.
SecurityFlags mutt_is_multipart_encrypted(struct Body *b)
Does the message have encrypted parts?
SecurityFlags mutt_is_application_pgp(const struct Body *b)
Does the message use PGP?
int crypt_pgp_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Wrapper for CryptModuleSpecs::decrypt_mime()
void crypt_smime_getkeys(struct Envelope *env)
Wrapper for CryptModuleSpecs::smime_getkeys()
int crypt_smime_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **b_dec)
Wrapper for CryptModuleSpecs::decrypt_mime()
void mutt_body_free(struct Body **ptr)
Free a Body.
Structs that make up an email.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
void mutt_env_free(struct Envelope **ptr)
Free an Envelope.
void mutt_env_set_subject(struct Envelope *env, const char *subj)
Set both subject and real_subj to subj.
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
bool OptNews
(pseudo) used to change reader mode
struct Email * dlg_postponed(struct Mailbox *m)
Create a Menu to select a postponed message -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
int mutt_body_handler(struct Body *b, struct State *state)
Handler for the Body of an email.
void mutt_decode_attachment(const struct Body *b, struct State *state)
Decode an email's attachment.
Decide how to display email content.
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
int imap_path_status(const char *path, bool queue)
Refresh the number of total and new messages.
@ LL_DEBUG3
Log at debug level 3.
@ TYPE_MULTIPART
Type: 'multipart/*'.
@ TYPE_TEXT
Type: 'text/*'.
struct Body * mutt_remove_multipart(struct Body *b)
Extract the multipart body if it exists.
Convenience wrapper for the library headers.
#define STATE_CHARCONV
Do character set conversions.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Many unsorted constants and some structs.
@ MUTT_PURGE
Messages to be purged (bypass trash)
@ MUTT_DELETE
Messages to be deleted.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
struct HashTable * mutt_make_id_hash(struct Mailbox *m)
Create a Hash Table for message-ids.
Create/manipulate threading in emails.
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
void mutt_adv_mktemp(struct Buffer *buf)
Create a temporary file.
Some miscellaneous functions.
int mx_msg_close(struct Mailbox *m, struct Message **ptr)
Close a message.
void mx_fastclose_mailbox(struct Mailbox *m, bool keep_account)
Free up memory associated with the Mailbox.
bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
struct Message * mx_msg_open(struct Mailbox *m, struct Email *e)
Return a stream pointer for a message.
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
enum MxStatus mx_mbox_close(struct Mailbox *m)
Save changes and close mailbox.
#define MUTT_QUIET
Do not print any messages.
#define MUTT_NOSORT
Do not sort the mailbox after opening it.
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_sync(), and mbox_close()
@ MX_STATUS_ERROR
An error occurred.
@ MX_STATUS_OK
No changes.
API for encryption/signing of emails.
#define SEC_INLINE
Email has an inline signature.
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
#define SEC_NO_FLAGS
No flags are set.
#define SEC_ENCRYPT
Email is encrypted.
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
#define SEC_SIGN
Email is signed.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
void mutt_param_delete(struct ParameterList *pl, const char *attribute)
Delete a matching Parameter.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
SecurityFlags mutt_parse_crypt_hdr(const char *p, bool set_empty_signas, SecurityFlags crypt_app)
Parse a crypto header string.
int mutt_num_postponed(struct Mailbox *m, bool force)
Return the number of postponed messages.
void mutt_update_num_postponed(void)
Force the update of the number of postponed messages.
short PostCount
Number of postponed (draft) emails.
static bool UpdateNumPostponed
When true, force a recount of the postponed (draft) emails.
int mutt_get_postponed(struct Mailbox *m_cur, struct Email *hdr, struct Email **cur, struct Buffer *fcc)
Recall a postponed message.
int mutt_prepare_template(FILE *fp, struct Mailbox *m, struct Email *e_new, struct Email *e, bool resend)
Prepare a message template.
static void hardclose(struct Mailbox *m)
Try hard to close a mailbox.
static int create_tmp_files_for_attachments(FILE *fp_body, struct Buffer *file, struct Email *e_new, struct Body *body, struct Envelope *protected_headers)
Create temporary files for all attachments.
Prototypes for many functions.
QuadOption
Possible values for a quad-option.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
#define STAILQ_REMOVE(head, elm, type, field)
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
void mutt_rfc3676_space_unstuff(struct Email *e)
Remove RFC3676 space stuffing.
RFC3676 Format Flowed routines.
Convenience wrapper for the send headers.
#define SEND_POSTPONED_FCC
Used by mutt_get_postponed() to signal that the Mutt-Fcc header field was present.
#define SEND_POSTPONED
Recall a postponed email.
#define SEND_REPLY
Reply to sender.
void mutt_stamp_attachment(struct Body *b)
Timestamp an Attachment.
char * d_filename
filename to be used for the content-disposition header If NULL, filename is used instead.
struct Body * parts
parts of a multipart or message/rfc822
bool noconv
Don't do character set conversion.
bool unlink
If true, filename should be unlink()ed before free()ing this structure.
struct Envelope * mime_headers
Memory hole protected headers.
LOFF_T length
length (in bytes) of attachment
struct ParameterList parameter
Parameters of the content-type.
bool use_disp
Content-Disposition uses filename= ?
struct Email * email
header information for message/rfc822
struct Body * next
next attachment in the list
char * subtype
content-type subtype
unsigned int type
content-type primary type, ContentType
char * filename
When sending a message, this is the file to which this structure refers.
String manipulation buffer.
The envelope/body of an email.
struct Envelope * env
Envelope information.
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
struct Body * body
List of MIME parts.
LOFF_T offset
Where in the stream does this message begin?
struct ListHead userhdrs
user defined headers
char *const subject
Email's subject.
char * message_id
Message ID.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
int msg_count
Total number of messages.
struct Email ** emails
Array of Emails.
struct HashTable * id_hash
Hash Table: "message-id" -> Email.
int msg_deleted
Number of deleted messages.
A local copy of an email.
FILE * fp
pointer to the message data
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Keep track when processing files.
StateFlags flags
Flags, e.g. STATE_DISPLAY.
FILE * fp_out
File to write to.
FILE * fp_in
File to read from.
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
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.