102 struct Email **ep = NULL;
105 struct Email *e = *ep;
109 mutt_error(
_(
"Warning: message contains no From: header"));
117 buf_strcpy(prompt,
_(
"Bounce tagged messages to: "));
143 buf_printf(prompt, ngettext(
"Bounce message to %s?",
"Bounce messages to %s?", msg_count),
149 mutt_message(ngettext(
"Message not bounced",
"Messages not bounced", msg_count));
158 struct Email *e = *ep;
174 if ((rc == 0) || (rc ==
S_BKG))
175 mutt_message(ngettext(
"Message bounced",
"Messages bounced", msg_count));
200 if (print ? c_print_decode_weed : c_pipe_decode_weed)
227 FILE *fp,
bool decode,
bool print)
241 const bool own_msg = !msg;
279 bool decode,
bool print,
bool split,
const char *sep)
315 pipe_msg(m, e, msg, fp_out, decode, print);
326 struct Email **ep = NULL;
329 struct Email *e = *ep;
346 struct Email **ep = NULL;
349 struct Email *e = *ep;
359 pipe_msg(m, e, NULL, fp_out, decode, print);
379 struct Email **ep = NULL;
382 struct Email *e = *ep;
384 pipe_msg(m, e, NULL, fp_out, decode, print);
397 if ((rc != 0) || c_wait_key)
445 if (c_print && !c_print_command)
452 const char *msg = ngettext(
"Print message?",
"Print tagged messages?", msg_count);
460 if (
pipe_message(m, ea, c_print_command, c_print_decode,
true, c_print_split,
"\f") == 0)
462 mutt_message(ngettext(
"Message printed",
"Messages printed", msg_count));
467 "Messages could not be printed", msg_count));
482 _(
"Rev-Sort (d)ate,(f)rm,(r)ecv,(s)ubj,t(o),(t)hread,(u)nsort,si(z)e,s(c)ore,s(p)am,(l)abel?") :
484 _(
"Sort (d)ate,(f)rm,(r)ecv,(s)ubj,t(o),(t)hread,(u)nsort,si(z)e,s(c)ore,s(p)am,(l)abel?"),
552 switch (c_use_threads)
609 if ((rc2 != 0) || c_wait_key)
663 const char *pfx = NULL;
704 else if (need_decrypt && want_pgp && is_pgp)
709 else if (need_decrypt && want_smime && is_smime)
719 if (c_copy_decode_weed)
785 int tagged_progress_count = 0;
790 struct stat st = { 0 };
794 const bool is_passphrase_needed = security_flags &
SEC_ENCRYPT;
796 const char *prompt = NULL;
797 const char *progress_msg = NULL;
804 progress_msg = (msg_count > 1) ?
_(
"Copying tagged messages...") : NULL;
805 switch (transform_opt)
808 prompt = (msg_count > 1) ?
_(
"Copy tagged to mailbox") :
_(
"Copy to mailbox");
811 prompt = (msg_count > 1) ?
_(
"Decrypt-copy tagged to mailbox") :
812 _(
"Decrypt-copy to mailbox");
815 prompt = (msg_count > 1) ?
_(
"Decode-copy tagged to mailbox") :
816 _(
"Decode-copy to mailbox");
823 progress_msg = (msg_count > 1) ?
_(
"Saving tagged messages...") : NULL;
824 switch (transform_opt)
827 prompt = (msg_count > 1) ?
_(
"Save tagged to mailbox") :
_(
"Save to mailbox");
830 prompt = (msg_count > 1) ?
_(
"Decrypt-save tagged to mailbox") :
831 _(
"Decrypt-save to mailbox");
834 prompt = (msg_count > 1) ?
_(
"Decode-save tagged to mailbox") :
835 _(
"Decode-save to mailbox");
895 struct Email **ep = NULL;
914 bool old_append = m_save->
append;
945 m_save->
append = old_append;
972 struct Email **ep = NULL;
975 struct Email *e = *ep;
984 struct Email *e2 = e;
1005 m_save->
append = old_append;
1010 const bool need_mailbox_cleanup = ((m_save->
type ==
MUTT_MBOX) ||
1014 m_save->
append = old_append;
1016 if (need_mailbox_cleanup)
1078 bool charset_changed =
false;
1079 bool type_changed =
false;
1080 bool structure_changed =
false;
1135 _(
"Character set changed to %s; converting"),
1143 structure_changed =
true;
1148 structure_changed =
true;
1155 structure_changed =
true;
1167 rc = structure_changed | type_changed;
1215 struct Email **ep = NULL;
1218 struct Email *e = *ep;
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
void mutt_addr_cat(char *buf, size_t buflen, const char *value, const char *specials)
Copy a string and wrap it in quotes if it contains special characters.
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
const struct CompleteOps CompleteAliasOps
Auto-Completion of Aliases.
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
struct AddressList * mutt_get_address(struct Envelope *env, const char **prefix)
Get an Address from an Envelope.
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_EMPTY(head)
Check if an array is empty.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_GET(head, idx)
Return the element at index.
GUI display the mailboxes in a side panel.
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
const struct CompleteOps CompleteFileOps
Auto-Completion of Files.
Select a Mailbox from a list.
#define MUTT_SEL_NO_FLAGS
No flags are set.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by 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.
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
CommandResult
Error codes for command_t parse functions.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
const struct CompleteOps CompleteCommandOps
Auto-Completion of Commands.
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.
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Convenience wrapper for the config headers.
#define CSR_SUC_NO_CHANGE
The value hasn't changed.
#define CSR_ERR_CODE
Problem with the code.
#define CSR_SUCCESS
Action completed successfully.
#define SORT_MASK
Mask for the sort id.
#define SORT_LAST
Sort thread by last-X, e.g. received date.
#define SORT_REVERSE
Reverse the order of the sort.
int mutt_append_message(struct Mailbox *m_dst, struct Mailbox *m_src, struct Email *e, struct Message *msg, CopyMessageFlags cmflags, CopyHeaderFlags chflags)
Append a message.
int mutt_copy_message(FILE *fp_out, struct Email *e, struct Message *msg, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen)
Copy a message from a Mailbox.
Duplicate the structure of an entire email.
#define CH_DECODE
Do RFC2047 header decoding.
#define MUTT_CM_WEED
Weed message/rfc822 attachment headers.
#define CH_XMIT
Transmitting this message? (Ignore Lines: and Content-Length:)
#define CH_FROM
Retain the "From " message separator?
#define MUTT_CM_DECODE_PGP
Used for decoding PGP messages.
#define MUTT_CM_DECODE
Decode the message body into text/plain.
#define CH_NONEWLINE
Don't output terminating newline after the header.
#define CH_WEED
Weed the headers?
#define CH_REORDER
Re-order output of headers (specified by 'hdr_order')
#define MUTT_CM_CHARCONV
Perform character set conversions.
#define MUTT_CM_DECODE_SMIME
Used for decoding S/MIME messages.
#define CH_MIME
Ignore MIME fields.
uint32_t CopyHeaderFlags
Flags for mutt_copy_header(), e.g. CH_UPDATE.
#define CH_UPDATE_LEN
Update Lines: and Content-Length:
#define MUTT_CM_PRINTING
Printing the message - display light.
#define MUTT_CM_NO_FLAGS
No flags are set.
#define CH_TXTPLAIN
Generate text/plain MIME headers.
uint16_t CopyMessageFlags
Flags for mutt_copy_message(), e.g. MUTT_CM_NOHEADER.
#define CH_NO_FLAGS
No flags are set.
Convenience wrapper for the core headers.
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
struct Mailbox * mailbox_find(const char *path)
Find the mailbox with a given path.
MailboxType
Supported mailbox formats.
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
@ MUTT_MMDF
'mmdf' Mailbox type
@ MUTT_IMAP
'IMAP' Mailbox type
@ MUTT_MBOX
'mbox' Mailbox type
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?
SecurityFlags crypt_query(struct Body *b)
Check out the type of encryption used.
bool crypt_pgp_check_traditional(FILE *fp, struct Body *b, bool just_one)
Wrapper for CryptModuleSpecs::pgp_check_traditional()
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
void mutt_endwin(void)
Shutdown curses.
void mutt_body_free(struct Body **ptr)
Free a Body.
void email_free(struct Email **ptr)
Free an Email.
Structs that make up an email.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
void mutt_parse_content_type(const char *s, struct Body *b)
Parse a content type.
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
EmailSortType
Methods for sorting Emails.
@ EMAIL_SORT_LABEL
Sort by the emails label.
@ EMAIL_SORT_DATE_RECEIVED
Sort by when the message were delivered locally.
@ EMAIL_SORT_SPAM
Sort by the email's spam score.
@ EMAIL_SORT_SCORE
Sort by the email's score.
@ EMAIL_SORT_DATE
Sort by the date the email was sent.
@ EMAIL_SORT_THREADS
Sort by email threads.
@ EMAIL_SORT_SUBJECT
Sort by the email's subject.
@ EMAIL_SORT_FROM
Sort by the email's From field.
@ EMAIL_SORT_UNSORTED
Sort by the order the messages appear in the mailbox.
@ EMAIL_SORT_SIZE
Sort by the size of the email.
@ EMAIL_SORT_TO
Sort by the email's To field.
void mutt_print_message(struct Mailbox *m, struct EmailArray *ea)
Print a message.
bool mutt_select_sort(bool reverse)
Ask the user for a sort method.
void mutt_pipe_message(struct Mailbox *m, struct EmailArray *ea)
Pipe a message.
bool mutt_check_traditional_pgp(struct Mailbox *m, struct EmailArray *ea)
Check if a message has inline PGP content.
static bool check_traditional_pgp(struct Mailbox *m, struct Email *e)
Check for an inline PGP content.
static void pipe_set_flags(bool decode, bool print, CopyMessageFlags *cmflags, CopyHeaderFlags *chflags)
Generate flags for copy header/message.
int mutt_save_message_mbox(struct Mailbox *m_src, struct Email *e, enum MessageSaveOpt save_opt, enum MessageTransformOpt transform_opt, struct Mailbox *m_dst)
Save a message to a given mailbox.
void index_bounce_message(struct Mailbox *m, struct EmailArray *ea)
Bounce an email.
void mutt_enter_command(void)
Enter a neomutt command.
int mutt_save_message(struct Mailbox *m, struct EmailArray *ea, enum MessageSaveOpt save_opt, enum MessageTransformOpt transform_opt)
Save an email.
static struct Buffer LastSaveFolder
The folder the user last saved to. Used by ci_save_message()
bool mutt_shell_escape(void)
Invoke a command in a subshell.
void external_cleanup(void)
Clean up commands globals.
static void set_copy_flags(struct Email *e, enum MessageTransformOpt transform_opt, CopyMessageFlags *cmflags, CopyHeaderFlags *chflags)
Set the flags for a message copy.
bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp)
Edit the content type of an attachment.
static int pipe_message(struct Mailbox *m, struct EmailArray *ea, const char *cmd, bool decode, bool print, bool split, const char *sep)
Pipe message to a command.
static void pipe_msg(struct Mailbox *m, struct Email *e, struct Message *msg, FILE *fp, bool decode, bool print)
Pipe a message.
void mutt_display_address(struct Envelope *env)
Display the address of a message.
Manage where the email is piped to external commands.
MessageTransformOpt
Message transformation option.
@ TRANSFORM_NONE
No transformation.
@ TRANSFORM_DECODE
Decode message.
@ TRANSFORM_DECRYPT
Decrypt message.
MessageSaveOpt
Message save option.
@ SAVE_MOVE
Move message to another mailbox, removing the original.
@ SAVE_COPY
Copy message, making a duplicate in another mailbox.
void mutt_file_resolve_symlink(struct Buffer *buf)
Resolve a symlink in place.
#define mutt_file_fclose(FP)
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 OptKeepQuiet
(pseudo) shut up the message and refresh functions while we are executing an external program
char ** EnvList
Private copy of the environment variables.
int mw_enter_fname(const char *prompt, struct Buffer *fname, bool mailbox, struct Mailbox *m, bool multiple, char ***files, int *numfiles, SelectFileFlags flags)
Ask the user to select a file -.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
int mw_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question -.
#define mutt_warning(...)
#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() -.
Convenience wrapper for the gui headers.
Read/write command history from/to a file.
@ HC_EXT_COMMAND
External commands.
@ HC_NEO_COMMAND
NeoMutt commands.
@ HC_OTHER
Miscellaneous strings.
void mutt_default_save(struct Buffer *path, struct Email *e)
Find the default save path for an email.
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Parse and execute user-defined hooks.
#define MUTT_MESSAGE_HOOK
message-hook: run before displaying a message
int imap_copy_messages(struct Mailbox *m, struct EmailArray *ea, const char *dest, enum MessageSaveOpt save_opt)
Server COPY messages to another folder.
@ LL_DEBUG1
Log at debug level 1.
const char MimeSpecials[]
Characters that need special treatment in MIME.
@ TYPE_TEXT
Type: 'text/*'.
#define is_multipart(body)
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
pid_t filter_create(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err, char **envlist)
Set up filter program.
Convenience wrapper for the library headers.
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
bool mutt_path_tidy(struct Buffer *path, bool is_dir)
Remove unnecessary parts of a path.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Many unsorted constants and some structs.
#define MUTT_COMP_NO_FLAGS
No flags are set.
@ MUTT_PURGE
Messages to be purged (bypass trash)
@ MUTT_TAG
Tagged messages.
@ MUTT_DELETE
Messages to be deleted.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void mailbox_restore_timestamp(const char *path, struct stat *st)
Restore the timestamp of a mailbox.
Mailbox helper functions.
Create/manipulate threading in emails.
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
@ UT_THREADS
Normal threading (root above subthreads)
@ UT_REVERSE
Reverse threading (subthreads above root)
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_sleep(short s)
Sleep for a while.
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
int mutt_save_confirm(const char *s, struct stat *st)
Ask the user to save.
Some miscellaneous functions.
int mx_msg_close(struct Mailbox *m, struct Message **ptr)
Close a message.
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_close(struct Mailbox *m)
Save changes and close mailbox.
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
#define MUTT_NEWFOLDER
Create a new folder - same as MUTT_APPEND, but uses mutt_file_fopen() with mode "w" for mbox-style fo...
#define MUTT_QUIET
Do not print any messages.
API for encryption/signing of emails.
uint16_t SecurityFlags
Flags, e.g. SEC_ENCRYPT.
#define PGP_TRADITIONAL_CHECKED
Email has a traditional (inline) signature.
#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.
@ NT_GLOBAL_COMMAND
A NeoMutt command.
@ NT_GLOBAL
Not object-related, NotifyGlobal.
void nm_db_longrun_done(struct Mailbox *m)
Finish a long transaction.
void nm_db_longrun_init(struct Mailbox *m, bool writable)
Start a long transaction.
Notmuch virtual mailbox type.
char * mutt_param_get(const struct ParameterList *pl, const char *s)
Find a matching Parameter.
void mutt_param_free(struct ParameterList *pl)
Free a ParameterList.
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.
@ MUTT_PROGRESS_WRITE
Progress tracks elements, according to $write_inc
struct Progress * progress_new(enum ProgressType type, size_t size)
Create a new Progress Bar.
void progress_free(struct Progress **ptr)
Free a Progress Bar.
void progress_set_message(struct Progress *progress, const char *fmt,...) __attribute__((__format__(__printf__
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
Prototypes for many functions.
int mutt_system(const char *cmd)
Run an external command.
QuadOption
Possible values for a quad-option.
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
@ MUTT_NO
User answered 'No', or assume 'No'.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_HEAD_INITIALIZER(head)
#define TAILQ_EMPTY(head)
enum CommandResult parse_rc_line(const char *line, struct Buffer *err)
Parse a line of user config.
Convenience wrapper for the send headers.
int mutt_bounce_message(FILE *fp, struct Mailbox *m, struct Email *e, struct AddressList *to, struct ConfigSubset *sub)
Bounce an email message.
struct Body * parts
parts of a multipart or message/rfc822
bool noconv
Don't do character set conversion.
struct ParameterList parameter
Parameters of the content-type.
struct Email * email
header information for message/rfc822
bool force_charset
Send mode: don't adjust the character set when in send-mode.
char * subtype
content-type subtype
unsigned int type
content-type primary type, ContentType
String manipulation buffer.
size_t dsize
Length of data.
char * data
Pointer to data.
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.
bool old
Email is seen, but unread.
bool flagged
Marked important?
struct AddressList from
Email's 'From' list.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
bool append
Mailbox is opened in append mode.
int msg_new
Number of new messages.
int msg_count
Total number of messages.
enum MailboxType type
Mailbox type.
int msg_flagged
Number of flagged messages.
void * compress_info
Compressed mbox module private data.
int msg_unread
Number of unread messages.
A local copy of an email.
FILE * fp
pointer to the message data
Container for Accounts, Notifications.
struct Notify * notify
Notifications handler.
struct ConfigSubset * sub
Inherited config items.
Attribute associated with a MIME part.
char * attribute
Parameter name.
char * value
Parameter value.
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.