97 struct Buffer *scratch = NULL;
110 mutt_error(
_(
"Warning: message contains no From: header"));
118 buf_strcpy(prompt,
_(
"Bounce tagged messages to: "));
143#define EXTRA_SPACE (15 + 7 + 2)
145 buf_printf(scratch, ngettext(
"Bounce message to %s?",
"Bounce messages to %s?", msg_count),
164 mutt_message(ngettext(
"Message not bounced",
"Messages not bounced", msg_count));
188 if ((rc == 0) || (rc ==
S_BKG))
189 mutt_message(ngettext(
"Message bounced",
"Messages bounced", msg_count));
215 if (print ? c_print_decode_weed : c_pipe_decode_weed)
242 FILE *
fp,
bool decode,
bool print)
256 const bool own_msg = !msg;
294 bool decode,
bool print,
bool split,
const char *sep)
411 if ((rc != 0) || c_wait_key)
429 NULL, NULL, NULL) != 0)
459 if (c_print && !c_print_command)
473 _(
"Print tagged messages?")) !=
MUTT_YES)
480 if (
pipe_message(m, el, c_print_command, c_print_decode,
true, c_print_split,
"\f") == 0)
482 mutt_message(ngettext(
"Message printed",
"Messages printed", msg_count));
487 "Messages could not be printed", msg_count));
503 _(
"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?") :
505 _(
"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?"),
573 switch (c_use_threads)
606 NULL, NULL, NULL) != 0)
630 if ((rc2 != 0) || c_wait_key)
683 const char *pfx = NULL;
724 else if (need_decrypt && want_pgp && is_pgp)
729 else if (need_decrypt && want_smime && is_smime)
739 if (c_copy_decode_weed)
805 int tagged_progress_count = 0;
806 unsigned int msg_count = 0;
810 struct stat st = { 0 };
820 const bool is_passphrase_needed = security_flags &
SEC_ENCRYPT;
822 const char *prompt = NULL;
823 const char *progress_msg = NULL;
830 progress_msg = (msg_count > 1) ?
_(
"Copying tagged messages...") : NULL;
831 switch (transform_opt)
834 prompt = (msg_count > 1) ?
_(
"Copy tagged to mailbox") :
_(
"Copy to mailbox");
837 prompt = (msg_count > 1) ?
_(
"Decrypt-copy tagged to mailbox") :
838 _(
"Decrypt-copy to mailbox");
841 prompt = (msg_count > 1) ?
_(
"Decode-copy tagged to mailbox") :
842 _(
"Decode-copy to mailbox");
849 progress_msg = (msg_count > 1) ?
_(
"Saving tagged messages...") : NULL;
850 switch (transform_opt)
853 prompt = (msg_count > 1) ?
_(
"Save tagged to mailbox") :
_(
"Save to mailbox");
856 prompt = (msg_count > 1) ?
_(
"Decrypt-save tagged to mailbox") :
857 _(
"Decrypt-save to mailbox");
860 prompt = (msg_count > 1) ?
_(
"Decode-save tagged to mailbox") :
861 _(
"Decode-save to mailbox");
882 if (buf->
data[pathlen - 1] ==
'/')
883 buf->
data[pathlen - 1] =
'\0';
933 bool old_append = m_save->
append;
965 m_save->
append = old_append;
1024 m_save->
append = old_append;
1029 const bool need_mailbox_cleanup = ((m_save->
type ==
MUTT_MBOX) ||
1033 m_save->
append = old_append;
1035 if (need_mailbox_cleanup)
1097 bool charset_changed =
false;
1098 bool type_changed =
false;
1099 bool structure_changed =
false;
1154 _(
"Character set changed to %s; converting"),
1162 structure_changed =
true;
1167 structure_changed =
true;
1174 structure_changed =
true;
1186 rc = structure_changed | type_changed;
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.
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.
GUI display the mailboxes in a side panel.
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
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?
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
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 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.
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.
SecurityFlags mutt_is_application_pgp(struct Body *b)
Does the message use PGP?
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 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()
void mutt_simple_format(char *buf, size_t buflen, int min_width, int max_width, enum FormatJustify justify, char pad_char, const char *s, size_t n, bool arboreal)
Format a string, like snprintf()
int mutt_any_key_to_continue(const char *s)
Prompt the user to 'press any key' and wait.
void mutt_endwin(void)
Shutdown curses.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
int buf_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.
@ JUSTIFY_LEFT
Left justify the text.
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.
int buf_get_field(const char *field, struct Buffer *buf, CompletionFlags complete, bool multiple, struct Mailbox *m, char ***files, int *numfiles)
Ask the user for a string.
bool mutt_select_sort(bool reverse)
Ask the user for a sort method.
void mutt_print_message(struct Mailbox *m, struct EmailList *el)
Print a message.
int mutt_save_message(struct Mailbox *m, struct EmailList *el, enum MessageSaveOpt save_opt, enum MessageTransformOpt transform_opt)
Save an email.
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.
void index_bounce_message(struct Mailbox *m, struct EmailList *el)
Bounce an email.
void mutt_enter_command(void)
Enter a neomutt command.
int mutt_save_message_ctx(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.
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.
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.
bool mutt_check_traditional_pgp(struct Mailbox *m, struct EmailList *el)
Check if a message has inline PGP content.
void commands_cleanup(void)
Clean up commands globals.
void mutt_pipe_message(struct Mailbox *m, struct EmailList *el)
Pipe a message.
static void pipe_msg(struct Mailbox *m, struct Email *e, struct Message *msg, FILE *fp, bool decode, bool print)
Pipe a message.
static int pipe_message(struct Mailbox *m, struct EmailList *el, const char *cmd, bool decode, bool print, bool split, const char *sep)
Pipe message to a command.
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.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
void mutt_file_resolve_symlink(struct Buffer *buf)
Resolve a symlink in place.
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)
Set up filter program.
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
#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.
void mutt_default_save(char *path, size_t pathlen, 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 EmailList *el, const char *dest, enum MessageSaveOpt save_opt)
Server COPY messages to another folder.
@ LL_DEBUG1
Log at debug level 1.
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
const char MimeSpecials[]
Characters that need special treatment in MIME.
@ TYPE_TEXT
Type: 'text/*'.
#define is_multipart(body)
size_t msgwin_get_width(void)
Get the width of the Message Window.
void msgwin_clear_text(void)
Clear the text in the Message Window.
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_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_ALIAS
Alias completion (in alias dialog)
#define MUTT_COMP_COMMAND
Complete a NeoMutt command.
#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.
#define MUTT_COMP_FILE_SIMPLE
File completion (no browser)
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void mutt_mailbox_cleanup(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 **msg)
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.
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
void mutt_parse_content_type(const char *s, struct Body *ct)
Parse a content type.
bool mutt_is_message_type(int type, const char *subtype)
Determine if a mime type matches a message or not.
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
void progress_free(struct Progress **ptr)
Free a Progress Bar.
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
struct Progress * progress_new(const char *msg, enum ProgressType type, size_t size)
Create a new 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 mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
int mutt_multi_choice(const char *prompt, const char *letters)
Offer the user a multiple choice question.
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
#define TAILQ_FOREACH(var, head, field)
#define STAILQ_FIRST(head)
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_EMPTY(head)
#define TAILQ_HEAD_INITIALIZER(head)
#define TAILQ_EMPTY(head)
#define STAILQ_NEXT(elm, field)
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.
#define SORT_MASK
Mask for the sort id.
#define SORT_LAST
Sort thread by last-X, e.g. received date.
SortType
Methods for sorting.
@ SORT_SUBJECT
Sort by the email's subject.
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
@ SORT_THREADS
Sort by email threads.
@ SORT_SPAM
Sort by the email's spam score.
@ SORT_LABEL
Sort by the emails label.
@ SORT_FROM
Sort by the email's From field.
@ SORT_SIZE
Sort by the size of the email.
@ SORT_RECEIVED
Sort by when the message were delivered locally.
@ SORT_TO
Sort by the email's To field.
@ SORT_DATE
Sort by the date the email was sent.
@ SORT_SCORE
Sort by the email's score.
#define SORT_REVERSE
Reverse the order of the sort.
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.
struct Email * email
Email in the list.
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.