96 struct Hook *h = *ptr;
124 intptr_t data,
struct Buffer *err)
169 struct Hook *hook = NULL;
171 bool pat_not =
false;
172 bool use_regex =
true;
174 struct PatternList *pat = NULL;
237 buf_strcpy(err,
_(
"current mailbox shortcut '^' is unset"));
249 buf_strcpy(err,
_(
"mailbox shortcut expanded to empty regex"));
268 buf_strcpy(err,
_(
"badly formatted command string"));
363 regerror(rc2, rx, err->
data, err->
dsize);
400 struct Hook *h = NULL;
401 struct Hook *tmp = NULL;
418 struct HookList *hl = obj;
419 struct Hook *h = NULL;
420 struct Hook *tmp = NULL;
443 intptr_t data,
struct Buffer *err)
446 bool pat_not =
false;
497 struct Hook *hook = NULL;
589 buf_addstr(err,
_(
"unhook: Can't do unhook * from within a hook"));
612 buf_printf(err,
_(
"unhook: Can't delete a %s from within a %s"),
635 struct Hook *hook = NULL;
648 const char *match = NULL;
680 struct Hook *tmp = NULL;
701 struct Hook *hook = NULL;
712 if (hook->
type & type)
727 memset(&cache, 0,
sizeof(cache));
747 struct Hook *hook = NULL;
756 if (hook->
type & type)
788 const struct Address *addr = NULL;
791 if (!from_me && reply_to && reply_to->
mailbox)
793 else if (!from_me && from && from->
mailbox)
827 if ((c_save_name || c_force_name) && (to || cc || bcc))
829 const struct Address *addr = to ? to : (cc ? cc : bcc);
859 struct Hook *tmp = NULL;
891 static bool inhook =
false;
895 struct Hook *hook = NULL;
933 struct Hook *hook = NULL;
965 struct Hook *hook = NULL;
1002 const struct Expando *exp = NULL;
1003 struct Hook *hook = NULL;
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
GUI display the mailboxes in a side panel.
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.
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.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
size_t buf_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
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.
enum CommandResult parse_rc_line_cwd(const char *line, char *cwd, struct Buffer *err)
Parse and run a muttrc line in a relative directory.
char * mutt_get_sourced_cwd(void)
Get the current file path that is being parsed.
Functions to parse commands in a config file.
struct PatternList * mutt_pattern_comp(struct MailboxView *mv, struct Menu *menu, const char *s, PatternCompFlags flags, struct Buffer *err)
Create a Pattern.
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
int mutt_comp_valid_command(const char *cmd)
Is this command string allowed?
Compressed mbox local mailbox type.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string 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.
void commands_register(const struct Command *cmds, const size_t num_cmds)
Add commands to Commands array.
size_t commands_array(struct Command **first)
Get Commands array.
Convenience wrapper for the core headers.
int mutt_make_string(struct Buffer *buf, size_t max_cols, const struct Expando *exp, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
Structs that make up an email.
bool mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct PatternCache *cache)
Match a pattern against an email header.
struct Expando * expando_parse(const char *str, const struct ExpandoDefinition *defs, struct Buffer *err)
Parse an Expando string.
void expando_free(struct Expando **ptr)
Free an Expando object.
int mutt_file_sanitize_regex(struct Buffer *dest, const char *src)
Escape any regex-magic characters in a string.
char * CurrentFolder
Currently selected mailbox.
static enum CommandResult mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unhook' command - Implements Command::parse() -.
static enum CommandResult mutt_parse_idxfmt_hook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'index-format-hook' command - Implements Command::parse() -.
enum CommandResult mutt_parse_hook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'hook' family of commands - Implements Command::parse() -.
enum CommandResult mutt_parse_charset_iconv_hook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse 'charset-hook' and 'iconv-hook' commands - Implements Command::parse() -.
static void idxfmt_hashelem_free(int type, void *obj, intptr_t data)
Free our hash table data - Implements hash_hdata_free_t -.
#define mutt_debug(LEVEL,...)
struct HashElem * mutt_hash_insert(struct HashTable *table, const char *strkey, void *data)
Add a new element to the Hash Table (with string keys)
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
struct HashTable * mutt_hash_new(size_t num_elems, HashFlags flags)
Create a new Hash Table (with string keys)
void mutt_hash_set_destructor(struct HashTable *table, hash_hdata_free_t fn, intptr_t fn_data)
Set the destructor for a Hash Table.
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
#define MUTT_HASH_STRDUP_KEYS
make a copy of the keys
void mutt_default_save(struct Buffer *path, struct Email *e)
Find the default save path for an email.
void mutt_timeout_hook(void)
Execute any timeout hooks.
static struct HashTable * IdxFmtHooks
All Index Format hooks.
char * mutt_find_hook(HookFlags type, const char *pat)
Find a matching hook.
void mutt_startup_shutdown_hook(HookFlags type)
Execute any startup/shutdown hooks.
void mutt_delete_hooks(HookFlags type)
Delete matching hooks.
static void list_hook(struct ListHead *matches, const char *match, HookFlags type)
Find hook strings matching.
void mutt_account_hook(const char *url)
Perform an account hook.
static void delete_idxfmt_hooks(void)
Delete all the index-format-hooks.
static void hook_free(struct Hook **ptr)
Free a Hook.
void mutt_folder_hook(const char *path, const char *desc)
Perform a folder hook.
void mutt_select_fcc(struct Buffer *path, struct Email *e)
Select the FCC path for an email.
const struct Expando * mutt_idxfmt_hook(const char *name, struct Mailbox *m, struct Email *e)
Get index-format-hook format string.
static int addr_hook(struct Buffer *path, HookFlags type, struct Mailbox *m, struct Email *e)
Perform an address hook (get a path)
const struct ExpandoDefinition IndexFormatDef[]
Expando definitions.
void hooks_init(void)
Setup feature commands.
static struct HookList Hooks
All simple hooks, e.g. MUTT_FOLDER_HOOK.
static HookFlags mutt_get_hook_type(const char *name)
Find a hook by name.
static HookFlags CurrentHookType
The type of the hook currently being executed, e.g. MUTT_SAVE_HOOK.
static const struct Command HookCommands[]
Hook Commands.
void mutt_crypt_hook(struct ListHead *list, struct Address *addr)
Find crypto hooks for an Address.
static struct Hook * hook_new(void)
Create a Hook.
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Parse and execute user-defined hooks.
#define MUTT_OPEN_HOOK
open-hook: to read a compressed mailbox
#define MUTT_ICONV_HOOK
iconv-hook: create a system charset alias
#define MUTT_FOLDER_HOOK
folder-hook: when entering a mailbox
#define MUTT_SAVE_HOOK
save-hook: set a default folder when saving an email
#define MUTT_SEND_HOOK
send-hook: when composing a new email
uint32_t HookFlags
Flags for mutt_parse_hook(), e.g. MUTT_FOLDER_HOOK.
#define MUTT_FCC_HOOK
fcc-hook: to save outgoing email
#define MUTT_CLOSE_HOOK
close-hook: write to a compressed mailbox
#define MUTT_ACCOUNT_HOOK
account-hook: when changing between accounts
#define MUTT_APPEND_HOOK
append-hook: append to a compressed mailbox
#define MUTT_GLOBAL_HOOK
Hooks which don't take a regex.
#define MUTT_STARTUP_HOOK
startup-hook: run when starting NeoMutt
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
#define MUTT_CRYPT_HOOK
crypt-hook: automatically select a PGP/SMIME key
#define MUTT_MBOX_HOOK
mbox-hook: move messages after reading them
#define MUTT_REPLY_HOOK
reply-hook: when replying to an email
#define MUTT_TIMEOUT_HOOK
timeout-hook: run a command periodically
#define MUTT_MESSAGE_HOOK
message-hook: run before displaying a message
#define MUTT_SHUTDOWN_HOOK
shutdown-hook: run when leaving NeoMutt
#define MUTT_IDXFMTHOOK
index-format-hook: customise the format of the index
#define MUTT_CHARSET_HOOK
charset-hook: create a charset alias for malformed emails
#define MUTT_HOOK_NO_FLAGS
No flags are set.
GUI manage the main index (list of emails)
struct MailboxView * get_current_mailbox_view(void)
Get the current Mailbox view.
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
struct Menu * get_current_menu(void)
Get the current Menu.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
#define MUTT_MEM_CALLOC(n, type)
#define mutt_array_size(x)
void mutt_ch_lookup_remove(void)
Remove all the character set lookups.
bool mutt_ch_lookup_add(enum LookupType type, const char *pat, const char *replace, struct Buffer *err)
Add a new character set lookup.
LookupType
Types of character set lookups.
@ MUTT_LOOKUP_ICONV
Character set conversion.
@ MUTT_LOOKUP_CHARSET
Alias for another character set.
Convenience wrapper for the library headers.
bool mutt_regex_match(const struct Regex *regex, const char *str)
Shorthand to mutt_regex_capture()
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.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
void mutt_temp_attachments_cleanup(void)
Delete all temporary attachments.
void buf_expand_path_regex(struct Buffer *buf, bool regex)
Create the canonical path (with regex char escaping)
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
void mutt_safe_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Some miscellaneous functions.
int mx_access(const char *path, int flags)
Wrapper for access, checks permissions on a given mailbox.
API for encryption/signing of emails.
Match patterns to emails.
#define MUTT_PC_SEND_MODE_SEARCH
Allow send-mode body searching.
uint8_t PatternCompFlags
Flags for mutt_pattern_comp(), e.g. MUTT_PC_FULL_MSG.
#define MUTT_PC_FULL_MSG
Enable body and header matching.
void mutt_check_simple(struct Buffer *s, const char *simple)
Convert a simple search into a real request.
#define MUTT_PC_NO_FLAGS
No flags are set.
#define MUTT_PC_PATTERN_DYNAMIC
Enable runtime date range evaluation.
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.
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
#define TAILQ_HEAD(name, type)
#define TAILQ_INSERT_TAIL(head, elm, field)
#define TAILQ_FIRST(head)
#define SLIST_FIRST(head)
#define TAILQ_REMOVE(head, elm, field)
#define TAILQ_HEAD_INITIALIZER(head)
#define TAILQ_ENTRY(type)
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
#define MUTT_FORMAT_PLAIN
Do not prepend DISP_TO, DISP_CC ...
struct Buffer * mailbox
Mailbox and host address.
String manipulation buffer.
char * dptr
Current read/write position.
size_t dsize
Length of data.
char * data
Pointer to data.
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
intptr_t data
Data or flags to pass to the command.
const char * name
Name of the command.
The envelope/body of an email.
struct Envelope * env
Envelope information.
struct AddressList to
Email's 'To' list.
struct AddressList reply_to
Email's 'reply-to'.
struct AddressList cc
Email's 'Cc' list.
struct AddressList bcc
Email's 'Bcc' list.
struct AddressList from
Email's 'From' list.
Definition of a format string.
struct PatternList * pattern
Used for fcc,save,send-hook.
struct Regex regex
Regular expression.
char * command
Filename, command or pattern to execute.
struct Expando * expando
Used for format hooks.
char * source_file
Used for relative-directory source.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Cache commonly-used patterns.
A simple (non-regex) pattern.
Cached regular expression.
char * pattern
printable version
regex_t * regex
compiled expression