92 if ((*s ==
'\\') || (*s ==
'`') || (*s ==
'\'') || (*s ==
'"') || (*s ==
'$'))
116 bool duplicate =
false;
150 struct Address *a2 = NULL, *tmp = NULL;
166 char namebuf[256] = { 0 };
176 const char *fqdn = NULL;
219 mbstate_t mbstate = { 0 };
226 for (; s && *s && (l = mbrtowc(&wc, s, MB_CUR_MAX, &mbstate)) != 0; s += l)
230 bad = bad || (!strchr(
"-_+=.", *s) && !iswalnum(wc));
232 bad = bad || !iswalnum(wc);
238 memset(&mbstate, 0,
sizeof(mbstate_t));
260 char buf[1024] = { 0 };
262 snprintf(buf,
sizeof(buf),
"%s@%s",
NONULL(user),
NONULL(domain));
279 struct Alias *a = NULL;
329 struct AddressList *al = NULL;
330 const char *pfx = NULL;
371 struct Buffer *prompt = NULL;
377 FILE *fp_alias = NULL;
405 mutt_error(
_(
"You already have an alias defined with that name"));
488 if (alias->
comment || has_tags)
514 const char *
const c_alias_file =
cs_subset_path(sub,
"alias_file");
536 if (ftell(fp_alias) > 0)
542 if (fread(buf->
data, 1, 1, fp_alias) != 1)
551 if (buf->
data[0] !=
'\n')
552 fputc(
'\n', fp_alias);
561 fprintf(fp_alias,
"alias %s ",
buf_string(buf));
568 fprintf(fp_alias,
" # %s", alias->
comment);
571 fprintf(fp_alias,
" tags:");
573 struct Tag *tag = NULL;
576 fprintf(fp_alias,
"%s", tag->
name);
578 fprintf(fp_alias,
",");
581 fputc(
'\n', fp_alias);
677 struct Alias *alias = *ptr;
702 struct Alias *np = NULL, *tmp = NULL;
724 struct Alias *np = NULL;
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
void mutt_addrlist_qualify(struct AddressList *al, const char *host)
Expand local names in an Address list using a hostname.
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
void mutt_addr_free(struct Address **ptr)
Free a single Address.
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
int mutt_addrlist_parse(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_addrlist_dedupe(struct AddressList *al)
Remove duplicate addresses.
const struct Address * cs_subset_address(const struct ConfigSubset *sub, const char *name)
Get an Address config item by name.
void parse_alias_tags(const char *tags, struct TagList *tl)
Parse a comma-separated list of tags.
void alias_tags_to_buffer(struct TagList *tl, struct Buffer *buf)
Write a comma-separated list of tags to a Buffer.
void alias_cleanup(void)
Clean up the Alias globals.
void alias_free(struct Alias **ptr)
Free an Alias.
struct AliasList Aliases
List of all the user's email aliases.
static int check_alias_name(const char *s, struct Buffer *dest)
Sanity-check an alias name.
static bool string_is_address(const char *str, const char *user, const char *domain)
Does an email address match a user and domain?
struct AddressList * alias_lookup(const char *name)
Find an Alias.
void mutt_expand_aliases(struct AddressList *al)
Expand aliases in a List of Addresses.
static void recode_buf(struct Buffer *buf)
Convert some text between two character sets.
void alias_create(struct AddressList *al, const struct ConfigSubset *sub)
Create a new Alias from an Address.
bool mutt_addr_is_user(const struct Address *addr)
Does the address belong to the user.
void alias_init(void)
Set up the Alias globals.
struct Alias * alias_new(void)
Create a new Alias.
void mutt_expand_aliases_env(struct Envelope *env)
Expand aliases in all the fields of an Envelope.
struct AddressList * mutt_get_address(struct Envelope *env, const char **prefix)
Get an Address from an Envelope.
void aliaslist_clear(struct AliasList *al)
Empty a List of Aliases.
static void write_safe_address(FILE *fp, const char *s)
Defang malicious email addresses.
static void expand_aliases_r(struct AddressList *al, struct ListHead *expn)
Expand aliases, recursively.
Representation of a single alias to an email address.
@ NT_ALIAS_DELETE
Alias is about to be deleted.
bool mutt_alternates_match(const char *addr)
Compare an Address to the Un/Alternates lists.
Alternate address handling.
const struct CompleteOps CompleteFileOps
Auto-Completion of Files.
Select a Mailbox from a list.
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_addstr_n(struct Buffer *buf, const char *s, size_t len)
Add a string to a Buffer, expanding it if necessary.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
struct Buffer * buf_new(const char *str)
Allocate a new Buffer.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
const char * buf_find_char(const struct Buffer *buf, const char c)
Return a pointer to a char found in the 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.
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.
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path 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.
const char * cc_charset(void)
Get the cached value of $charset.
Convenience wrapper for the core headers.
void mutt_beep(bool force)
Irritate the user.
Structs that make up an email.
void buf_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
int mutt_file_fsync_close(FILE **fp)
Flush the data, before closing a file (and NULL the pointer)
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
char * ShortHostname
Short version of the hostname.
char * Username
User's login name.
bool mutt_is_mail_list(const struct Address *addr)
Is this the email address of a mailing list? - Implements addr_predicate_t -.
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 -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
Convenience wrapper for the gui headers.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
struct ListNode * mutt_list_insert_head(struct ListHead *h, char *s)
Insert a string at the beginning of a List.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
@ LL_NOTIFY
Log of notifications.
#define MUTT_MEM_CALLOC(n, type)
int mutt_ch_convert_string(char **ps, const char *from, const char *to, uint8_t flags)
Convert a string between encodings.
#define ICONV_BUF_TOO_SMALL
Error value for iconv() - Buffer too small.
#define MUTT_ICONV_NO_FLAGS
No flags are set.
#define ICONV_ILLEGAL_SEQ
Error value for iconv() - Illegal sequence.
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.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Many unsorted constants and some structs.
#define MUTT_COMP_NO_FLAGS
No flags are set.
#define MUTT_COMP_CLEAR
Clear input if printable character is pressed.
char * mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw)
Lookup a user's real name in /etc/passwd.
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Some miscellaneous functions.
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
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_ABORT
User aborted the question (with Ctrl-G)
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
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_FOREACH_SAFE(var, head, field, tvar)
#define STAILQ_INIT(head)
#define STAILQ_HEAD_INITIALIZER(head)
#define STAILQ_FIRST(head)
#define TAILQ_INSERT_TAIL(head, elm, field)
#define TAILQ_PREV(elm, headname, field)
#define STAILQ_FOREACH(var, head, field)
#define TAILQ_FIRST(head)
#define TAILQ_REMOVE(head, elm, field)
#define TAILQ_NEXT(elm, field)
#define TAILQ_HEAD_INITIALIZER(head)
#define TAILQ_EMPTY(head)
#define TAILQ_INSERT_BEFORE(listelm, elm, field)
#define STAILQ_NEXT(elm, field)
void alias_reverse_add(struct Alias *alias)
Add an email address lookup for an Alias.
void alias_reverse_shutdown(void)
Clear up the Reverse Alias Hash Table.
void alias_reverse_delete(struct Alias *alias)
Remove an email address lookup for an Alias.
void alias_reverse_init(void)
Set up the Reverse Alias Hash Table.
Manage alias reverse lookups.
Convenience wrapper for the send headers.
const char * mutt_fqdn(bool may_hide_host, const struct ConfigSubset *sub)
Get the Fully-Qualified Domain Name.
struct Buffer * personal
Real name of address.
struct Buffer * mailbox
Mailbox and host address.
A shortcut for an email address or addresses.
char * comment
Free-form comment string.
struct AddressList addr
List of Addresses the Alias expands to.
String manipulation buffer.
char * data
Pointer to data.
A set of inherited config items.
struct AddressList to
Email's 'To' list.
struct AddressList reply_to
Email's 'reply-to'.
struct AddressList mail_followup_to
Email's 'mail-followup-to'.
struct AddressList cc
Email's 'Cc' list.
struct AddressList bcc
Email's 'Bcc' list.
struct AddressList from
Email's 'From' list.
struct Alias * alias
Alias that changed.
Input for the file completion function.
Container for Accounts, Notifications.
struct Notify * notify
Notifications handler.
struct ConfigSubset * sub
Inherited config items.