Go to the documentation of this file.
86 intptr_t data,
struct Buffer *err)
88 struct Hook *hook = NULL;
92 struct PatternList *pat = NULL;
262 regerror(rc2, rx, err->
data, err->
dsize);
309 struct Hook *h = NULL;
310 struct Hook *tmp = NULL;
327 struct HookList *hl = obj;
328 struct Hook *h = NULL;
329 struct Hook *tmp = NULL;
352 intptr_t data,
struct Buffer *err)
355 bool pat_not =
false;
400 struct Hook *hook = NULL;
419 struct PatternList *pat =
455 intptr_t data,
struct Buffer *err)
510 struct Hook *hook = NULL;
523 const char *match = NULL;
555 struct Hook *tmp = NULL;
576 struct Hook *hook = NULL;
587 if (hook->
type & type)
602 memset(&cache, 0,
sizeof(cache));
624 struct Hook *hook = NULL;
633 if (hook->
type & type)
666 const struct Address *addr = NULL;
669 if (!from_me && reply_to && reply_to->
mailbox)
671 else if (!from_me && from && from->
mailbox)
704 const struct Address *addr = to ? to : (cc ? cc : bcc);
729 struct Hook *tmp = NULL;
761 static bool inhook =
false;
765 struct Hook *hook = NULL;
803 struct Hook *hook = NULL;
809 err.
dsize =
sizeof(buf);
839 struct Hook *hook = NULL;
844 err.
dsize =
sizeof(buf);
879 const char *fmtstring = NULL;
880 struct Hook *hook = NULL;
static struct HashTable * IdxFmtHooks
struct AddressList bcc
Email's 'Bcc' list.
struct PatternList * mutt_pattern_comp(struct Context *ctx, const char *s, PatternCompFlags flags, struct Buffer *err)
Create a Pattern.
enum CommandResult mutt_parse_rc_line(const char *line, struct Buffer *err)
Parse a line of user config.
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
struct HashTable * mutt_hash_new(size_t num_elems, HashFlags flags)
Create a new Hash Table (with string keys)
int mx_access(const char *path, int flags)
Wrapper for access, checks permissions on a given mailbox.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
void mutt_timeout_hook(void)
Execute any timeout hooks.
#define MUTT_ICONV_HOOK
iconv-hook: create a system charset alias
void mutt_make_string(char *buf, size_t buflen, int cols, const char *s, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
Create formatted strings using mailbox expandos.
#define MUTT_SEND2_HOOK
send2-hook: when changing fields in the compose menu
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
#define MUTT_MBOX_HOOK
mbox-hook: move messages after reading them
#define MUTT_PC_PATTERN_DYNAMIC
Enable runtime date range evaluation.
#define MUTT_SAVE_HOOK
save-hook: set a default folder when saving an email
String manipulation buffer.
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_buffer_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
char * C_DefaultHook
Config: Pattern to use for hooks that only have a simple regex.
bool mutt_buffer_is_empty(const struct Buffer *buf)
Is the Buffer empty?
#define MUTT_SEND_HOOK
send-hook: when composing a new email
int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct PatternCache *cache)
Match a pattern against an email header.
void mutt_folder_hook(const char *path, const char *desc)
Perform a folder hook.
#define TAILQ_FOREACH(var, head, field)
struct Buffer * mutt_buffer_init(struct Buffer *buf)
Initialise a new Buffer.
Cached regular expression.
char * mutt_str_dup(const char *str)
Copy a string, safely.
@ LL_DEBUG1
Log at debug level 1.
#define TAILQ_INSERT_TAIL(head, elm, field)
#define MUTT_TOKEN_NO_FLAGS
No flags are set.
void mutt_crypt_hook(struct ListHead *list, struct Address *addr)
Find crypto hooks for an Address.
#define MUTT_APPEND_HOOK
append-hook: append to a compressed mailbox
char * dptr
Current read/write position.
int mutt_comp_valid_command(const char *cmd)
Is this command string allowed?
size_t dsize
Length of data.
@ LL_DEBUG5
Log at debug level 5.
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
#define MUTT_OPEN_HOOK
open-hook: to read a compressed mailbox
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
uint8_t PatternCompFlags
Flags for mutt_pattern_comp(), e.g. MUTT_PC_FULL_MSG.
struct Regex regex
Regular expression.
#define MUTT_PC_NO_FLAGS
No flags are set.
#define MUTT_STARTUP_HOOK
startup-hook: run when starting NeoMutt
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
void mutt_buffer_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
HookFlags mutt_get_hook_type(const char *name)
Find a hook by name.
#define TAILQ_ENTRY(type)
int msg_in_pager
Message currently shown in the pager.
void * mutt_hash_find(const struct HashTable *table, const char *strkey)
Find the HashElem data in a Hash Table element using a key.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
static void delete_hook(struct Hook *h)
Delete a Hook.
struct AddressList reply_to
Email's 'reply-to'.
void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
Create the canonical path (with regex char escaping)
#define TAILQ_HEAD_INITIALIZER(head)
#define TAILQ_REMOVE(head, elm, field)
int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags)
Extract one token from a string.
#define TAILQ_FIRST(head)
struct AddressList cc
Email's 'Cc' list.
#define MUTT_CLOSE_HOOK
close-hook: write to a compressed mailbox
#define MUTT_CHARSET_HOOK
charset-hook: create a charset alias for malformed emails
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
TAILQ_HEAD(HookList, Hook)
size_t mutt_buffer_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
void mutt_ch_lookup_remove(void)
Remove all the character set lookups.
WHERE char * C_Folder
Config: Base folder for a set of mailboxes.
char * command
Filename, command or pattern to execute.
void mutt_account_hook(const char *url)
Perform an account hook.
static int addr_hook(char *path, size_t pathlen, HookFlags type, struct Context *ctx, struct Email *e)
Perform an address hook (get a path)
static void list_hook(struct ListHead *matches, const char *match, HookFlags hook)
Find hook strings matching.
bool C_SaveName
Config: Save outgoing message to mailbox of recipient's name if it exists.
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_startup_shutdown_hook(HookFlags type)
Execute any startup/shutdown hooks.
void mutt_safe_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
#define MUTT_PC_FULL_MSG
Enable body and header matching.
void mutt_default_save(char *path, size_t pathlen, struct Email *e)
Find the default save path for an email.
struct AddressList to
Email's 'To' list.
static HookFlags current_hook_type
size_t mutt_buffer_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
struct Envelope * env
Envelope information.
#define MUTT_FCC_HOOK
fcc-hook: to save outgoing email
#define mutt_debug(LEVEL,...)
uint32_t HookFlags
Flags for mutt_parse_hook(), e.g. MUTT_FOLDER_HOOK.
@ MUTT_LOOKUP_ICONV
Character set conversion.
@ MUTT_CMD_SUCCESS
Success: Command worked.
#define REG_COMP(preg, regex, cflags)
Compile a regular expression.
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
bool mutt_regex_match(const struct Regex *regex, const char *str)
Shorthand to mutt_regex_capture()
char * mutt_find_hook(HookFlags type, const char *pat)
Find a matching hook.
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_LOOKUP_CHARSET
Alias for another character set.
#define SLIST_FIRST(head)
void mutt_check_simple(struct Buffer *s, const char *simple)
Convert a simple search into a real request.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
CommandResult
Error codes for command_t parse functions.
WHERE char * C_Record
Config: Folder to save 'sent' messages.
char * mailbox
Mailbox and host address.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
#define MUTT_SHUTDOWN_HOOK
shutdown-hook: run when leaving NeoMutt
struct AddressList from
Email's 'From' list.
static void delete_idxfmt_hooks(void)
Delete all the index-format-hooks.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
void mutt_unlink_temp_attachments(void)
Delete all temporary attachments.
#define MUTT_HASH_STRDUP_KEYS
make a copy of the keys
#define MUTT_GLOBAL_HOOK
Hooks which don't take a regex.
#define MUTT_MESSAGE_HOOK
message-hook: run before displaying a message
void mutt_buffer_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
const char * mutt_idxfmt_hook(const char *name, struct Mailbox *m, struct Email *e)
Get index-format-hook format string.
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()
static struct HookList Hooks
#define MUTT_PC_SEND_MODE_SEARCH
Allow send-mode body searching.
regex_t * regex
compiled expression
#define MUTT_ACCOUNT_HOOK
account-hook: when changing between accounts
LookupType
Types of character set lookups.
WHERE char * CurrentFolder
Currently selected mailbox.
void mutt_select_fcc(struct Buffer *path, struct Email *e)
Select the FCC path for an email.
void mutt_delete_hooks(HookFlags type)
Delete matching hooks.
bool C_ForceName
Config: Save outgoing mail in a folder of their name.
char * pattern
printable version
char * mutt_buffer_strdup(const struct Buffer *buf)
Copy a Buffer's string.
static void delete_idxfmt_hooklist(int type, void *obj, intptr_t data)
Delete a index-format-hook from the Hash Table - Implements hash_hdata_free_t.
char * data
Pointer to data.
struct PatternList * pattern
Used for fcc,save,send-hook.
The envelope/body of an email.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
bool mutt_ch_lookup_add(enum LookupType type, const char *pat, const char *replace, struct Buffer *err)
Add a new character set lookup.
#define MUTT_FOLDER_HOOK
folder-hook: when entering a mailbox
enum CommandResult mutt_parse_unhook(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unhook' command - Implements Command::parse()
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
#define MUTT_CRYPT_HOOK
crypt-hook: automatically select a PGP/SMIME key
#define MUTT_REPLY_HOOK
reply-hook: when replying to an email
A simple (non-regex) pattern.
void mutt_hash_free(struct HashTable **ptr)
Free a hash table.
#define MUTT_TOKEN_SPACE
Don't treat whitespace as a term.
#define MUTT_TIMEOUT_HOOK
timeout-hook: run a command periodically
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
Cache commonly-used patterns.
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()
#define MUTT_HOOK_NO_FLAGS
No flags are set.
#define MUTT_IDXFMTHOOK
index-format-hook: customise the format of the index