Representation of an email address. More...
Go to the source code of this file.
Data Structures | |
struct | Address |
An email address. More... | |
Typedefs | |
typedef bool(* | addr_predicate_t) (const struct Address *a) |
Functions | |
TAILQ_HEAD (AddressList, Address) | |
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. | |
bool | mutt_addr_valid_msgid (const char *msgid) |
Is this a valid Message ID? | |
bool | mutt_addr_cmp (const struct Address *a, const struct Address *b) |
Compare two e-mail addresses. | |
struct Address * | mutt_addr_copy (const struct Address *addr) |
Copy the real address. | |
struct Address * | mutt_addr_create (const char *personal, const char *mailbox) |
Create and populate a new Address. | |
const char * | mutt_addr_for_display (const struct Address *a) |
Convert an Address for display purposes. | |
void | mutt_addr_free (struct Address **ptr) |
Free a single Address. | |
struct Address * | mutt_addr_new (void) |
Create a new Address. | |
bool | mutt_addr_to_intl (struct Address *a) |
Convert an Address to Punycode. | |
bool | mutt_addr_to_local (struct Address *a) |
Convert an Address from Punycode. | |
bool | mutt_addr_uses_unicode (const char *str) |
Does this address use Unicode character. | |
size_t | mutt_addr_write (struct Buffer *buf, struct Address *addr, bool display) |
Write a single Address to a buffer. | |
void | mutt_addrlist_append (struct AddressList *al, struct Address *a) |
Append an Address to an AddressList. | |
void | mutt_addrlist_clear (struct AddressList *al) |
Unlink and free all Address in an AddressList. | |
void | mutt_addrlist_copy (struct AddressList *dst, const struct AddressList *src, bool prune) |
Copy a list of addresses into another list. | |
int | mutt_addrlist_count_recips (const struct AddressList *al) |
Count the number of Addresses with valid recipients. | |
void | mutt_addrlist_dedupe (struct AddressList *al) |
Remove duplicate addresses. | |
bool | mutt_addrlist_equal (const struct AddressList *ala, const struct AddressList *alb) |
Compare two Address lists for equality. | |
int | mutt_addrlist_parse (struct AddressList *al, const char *s) |
Parse a list of email addresses. | |
int | mutt_addrlist_parse2 (struct AddressList *al, const char *s) |
Parse a list of email addresses. | |
void | mutt_addrlist_prepend (struct AddressList *al, struct Address *a) |
Prepend an Address to an AddressList. | |
void | mutt_addrlist_qualify (struct AddressList *al, const char *host) |
Expand local names in an Address list using a hostname. | |
int | mutt_addrlist_remove (struct AddressList *al, const char *mailbox) |
Remove an Address from a list. | |
void | mutt_addrlist_remove_xrefs (const struct AddressList *a, struct AddressList *b) |
Remove cross-references. | |
bool | mutt_addrlist_search (const struct AddressList *haystack, const struct Address *needle) |
Search for an e-mail address in a list. | |
int | mutt_addrlist_to_intl (struct AddressList *al, char **err) |
Convert an Address list to Punycode. | |
int | mutt_addrlist_to_local (struct AddressList *al) |
Convert an Address list from Punycode. | |
bool | mutt_addrlist_uses_unicode (const struct AddressList *al) |
Do any of a list of addresses use Unicode characters. | |
size_t | mutt_addrlist_write (const struct AddressList *al, struct Buffer *buf, bool display) |
Write an Address to a buffer. | |
size_t | mutt_addrlist_write_wrap (const struct AddressList *al, struct Buffer *buf, const char *header) |
Write an AddressList to a buffer, perform line wrapping. | |
void | mutt_addrlist_write_file (const struct AddressList *al, FILE *fp, const char *header) |
Wrapper for mutt_write_address() | |
size_t | mutt_addrlist_write_list (const struct AddressList *al, struct ListHead *list) |
Write Addresses to a List. | |
Variables | |
const char | AddressSpecials [] |
Characters with special meaning for email addresses. | |
Representation of an email address.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file address.h.
TAILQ_HEAD | ( | AddressList | , |
Address | |||
) |
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.
buf | Buffer for the result |
buflen | Length of the result buffer |
value | String to copy |
specials | Characters to lookup |
This function copies the string in the "value" parameter in the buffer pointed to by "buf" parameter. If the input string contains any of the characters specified in the "specials" parameters, the output string is wrapped in double quoted. Additionally, any backslashes or quotes inside the input string are backslash-escaped.
Definition at line 708 of file address.c.
bool mutt_addr_valid_msgid | ( | const char * | msgid | ) |
Is this a valid Message ID?
msgid | Message ID |
true | It is a valid message ID |
Incomplete. Only used to thwart the APOP MD5 attack
Definition at line 792 of file address.c.
Compare two e-mail addresses.
true | They are equivalent |
Definition at line 892 of file address.c.
Copy the real address.
addr | Address to copy |
ptr | New Address |
Definition at line 745 of file address.c.
struct Address * mutt_addr_create | ( | const char * | personal, |
const char * | mailbox | ||
) |
Create and populate a new Address.
[in] | personal | The personal name for the Address (can be NULL) |
[in] | mailbox | The mailbox for the Address (can be NULL) |
ptr | Newly allocated Address |
Definition at line 414 of file address.c.
const char * mutt_addr_for_display | ( | const struct Address * | a | ) |
Convert an Address for display purposes.
a | Address to convert |
ptr | Address to display |
Definition at line 1012 of file address.c.
void mutt_addr_free | ( | struct Address ** | ptr | ) |
struct Address * mutt_addr_new | ( | void | ) |
Create a new Address.
ptr | Newly allocated Address |
Free the result with mutt_addr_free()
Definition at line 401 of file address.c.
bool mutt_addr_to_intl | ( | struct Address * | a | ) |
Convert an Address to Punycode.
a | Address to convert |
true | Success |
false | Otherwise |
Definition at line 1263 of file address.c.
bool mutt_addr_to_local | ( | struct Address * | a | ) |
Convert an Address from Punycode.
a | Address to convert |
true | Success |
false | Otherwise |
Definition at line 1340 of file address.c.
bool mutt_addr_uses_unicode | ( | const char * | str | ) |
Does this address use Unicode character.
str | Address string to check |
true | The string uses 8-bit characters |
Definition at line 1502 of file address.c.
Write a single Address to a buffer.
buf | Buffer for the Address |
addr | Address to display |
display | This address will be displayed to the user |
num | Length of the string written to buf |
If 'display' is set, then it doesn't matter if the transformation isn't reversible.
Definition at line 1050 of file address.c.
void mutt_addrlist_append | ( | struct AddressList * | al, |
struct Address * | a | ||
) |
Append an Address to an AddressList.
al | AddressList |
a | Address |
Definition at line 1480 of file address.c.
void mutt_addrlist_clear | ( | struct AddressList * | al | ) |
Unlink and free all Address in an AddressList.
al | AddressList |
Definition at line 1460 of file address.c.
void mutt_addrlist_copy | ( | struct AddressList * | dst, |
const struct AddressList * | src, | ||
bool | prune | ||
) |
Copy a list of addresses into another list.
dst | Destination Address list |
src | Source Address list |
prune | Skip groups if there are more addresses |
Definition at line 765 of file address.c.
int mutt_addrlist_count_recips | ( | const struct AddressList * | al | ) |
Count the number of Addresses with valid recipients.
al | Address list |
num | Number of valid Addresses |
An Address has a recipient if the mailbox is set and is not a group
Definition at line 872 of file address.c.
void mutt_addrlist_dedupe | ( | struct AddressList * | al | ) |
Remove duplicate addresses.
al | Address list to de-dupe |
Given a list of addresses, return a list of unique addresses
Definition at line 1397 of file address.c.
bool mutt_addrlist_equal | ( | const struct AddressList * | ala, |
const struct AddressList * | alb | ||
) |
Compare two Address lists for equality.
true | Address lists are strictly identical |
Definition at line 840 of file address.c.
int mutt_addrlist_parse | ( | struct AddressList * | al, |
const char * | s | ||
) |
Parse a list of email addresses.
al | AddressList to append addresses |
s | String to parse |
num | Number of parsed addresses |
Definition at line 480 of file address.c.
int mutt_addrlist_parse2 | ( | struct AddressList * | al, |
const char * | s | ||
) |
Parse a list of email addresses.
al | Add to this List of Addresses |
s | String to parse |
num | Number of parsed addresses |
Simple email addresses (without any personal name or grouping) can be separated by whitespace or commas.
Definition at line 644 of file address.c.
void mutt_addrlist_prepend | ( | struct AddressList * | al, |
struct Address * | a | ||
) |
Prepend an Address to an AddressList.
al | AddressList |
a | Address |
Definition at line 1491 of file address.c.
void mutt_addrlist_qualify | ( | struct AddressList * | al, |
const char * | host | ||
) |
Expand local names in an Address list using a hostname.
al | Address list |
host | Hostname |
Any addresses containing a bare name will be expanded using the hostname. e.g. "john", "example.com" -> 'john@.nosp@m.exam.nosp@m.ple.c.nosp@m.om'. This function has no effect if host is NULL or the empty string.
Definition at line 680 of file address.c.
int mutt_addrlist_remove | ( | struct AddressList * | al, |
const char * | mailbox | ||
) |
Remove an Address from a list.
[in,out] | al | AddressList |
[in] | mailbox | Email address to match |
0 | Success |
-1 | Error, or email not found |
Definition at line 435 of file address.c.
void mutt_addrlist_remove_xrefs | ( | const struct AddressList * | a, |
struct AddressList * | b | ||
) |
Remove cross-references.
a | Reference AddressList |
b | AddressLis to trim |
Remove addresses from "b" which are contained in "a"
Definition at line 1433 of file address.c.
bool mutt_addrlist_search | ( | const struct AddressList * | haystack, |
const struct Address * | needle | ||
) |
Search for an e-mail address in a list.
true | The Address is in the list |
Definition at line 909 of file address.c.
int mutt_addrlist_to_intl | ( | struct AddressList * | al, |
char ** | err | ||
) |
Convert an Address list to Punycode.
[in] | al | Address list to modify |
[out] | err | Pointer for failed addresses |
0 | Success, all addresses converted |
-1 | Error, err will be set to the failed address |
Definition at line 1293 of file address.c.
int mutt_addrlist_to_local | ( | struct AddressList * | al | ) |
Convert an Address list from Punycode.
al | Address list to modify |
0 | Always |
Definition at line 1378 of file address.c.
bool mutt_addrlist_uses_unicode | ( | const struct AddressList * | al | ) |
Do any of a list of addresses use Unicode characters.
al | Address list to check |
true | Any use 8-bit characters |
Definition at line 1522 of file address.c.
size_t mutt_addrlist_write | ( | const struct AddressList * | al, |
struct Buffer * | buf, | ||
bool | display | ||
) |
Write an Address to a buffer.
al | AddressList to display |
buf | Buffer for the Address |
display | This address will be displayed to the user |
num | Length of the string written to buf |
If 'display' is set, then it doesn't matter if the transformation isn't reversible.
Definition at line 1206 of file address.c.
size_t mutt_addrlist_write_wrap | ( | const struct AddressList * | al, |
struct Buffer * | buf, | ||
const char * | header | ||
) |
Write an AddressList to a buffer, perform line wrapping.
al | AddressList to display |
buf | Buffer for the Address |
header | Header name; if present, addresses we be written after ": " |
num | Length of the string written to buf |
Definition at line 1189 of file address.c.
void mutt_addrlist_write_file | ( | const struct AddressList * | al, |
FILE * | fp, | ||
const char * | header | ||
) |
Wrapper for mutt_write_address()
al | Address list |
fp | File to write to |
header | Header name; if present, addresses we be written after ": " |
So we can handle very large recipient lists without needing a huge temporary buffer in memory
Definition at line 1248 of file address.c.
size_t mutt_addrlist_write_list | ( | const struct AddressList * | al, |
struct ListHead * | list | ||
) |
Write Addresses to a List.
al | AddressList to write |
list | List for the Addresses |
num | Number of addresses written |
Definition at line 1217 of file address.c.