NeoMutt  2024-03-23-147-g885fbc
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
address.h
Go to the documentation of this file.
1
24#ifndef MUTT_ADDRESS_ADDRESS_H
25#define MUTT_ADDRESS_ADDRESS_H
26
27#include <stddef.h>
28#include <stdbool.h>
29#include <stdio.h>
30#include "mutt/lib.h"
31
35struct Address
36{
37 struct Buffer *personal;
38 struct Buffer *mailbox;
39 bool group : 1;
40 bool is_intl : 1;
41 bool intl_checked : 1;
43};
44TAILQ_HEAD(AddressList, Address);
45
46extern const char AddressSpecials[];
47
56typedef bool (*addr_predicate_t)(const struct Address *a);
57
58/* Utility functions that don't use struct Address or struct AddressList */
59void mutt_addr_cat (char *buf, size_t buflen, const char *value, const char *specials);
60bool mutt_addr_valid_msgid(const char *msgid);
61
62/* Functions that work on a single struct Address */
63bool mutt_addr_cmp (const struct Address *a, const struct Address *b);
64struct Address *mutt_addr_copy (const struct Address *addr);
65struct Address *mutt_addr_create (const char *personal, const char *mailbox);
66const char * mutt_addr_for_display(const struct Address *a);
67void mutt_addr_free (struct Address **ptr);
68struct Address *mutt_addr_new (void);
69bool mutt_addr_to_intl (struct Address *a);
70bool mutt_addr_to_local (struct Address *a);
71bool mutt_addr_uses_unicode(const char *str);
72size_t mutt_addr_write (struct Buffer *buf, struct Address *addr, bool display);
73
74/* Functions that work on struct AddressList */
75void mutt_addrlist_append (struct AddressList *al, struct Address *a);
76void mutt_addrlist_clear (struct AddressList *al);
77void mutt_addrlist_copy (struct AddressList *dst, const struct AddressList *src, bool prune);
78int mutt_addrlist_count_recips(const struct AddressList *al);
79void mutt_addrlist_dedupe (struct AddressList *al);
80bool mutt_addrlist_equal (const struct AddressList *ala, const struct AddressList *alb);
81int mutt_addrlist_parse (struct AddressList *al, const char *s);
82int mutt_addrlist_parse2 (struct AddressList *al, const char *s);
83void mutt_addrlist_prepend (struct AddressList *al, struct Address *a);
84void mutt_addrlist_qualify (struct AddressList *al, const char *host);
85int mutt_addrlist_remove (struct AddressList *al, const char *mailbox);
86void mutt_addrlist_remove_xrefs(const struct AddressList *a, struct AddressList *b);
87bool mutt_addrlist_search (const struct AddressList *haystack, const struct Address *needle);
88int mutt_addrlist_to_intl (struct AddressList *al, char **err);
89int mutt_addrlist_to_local (struct AddressList *al);
90bool mutt_addrlist_uses_unicode(const struct AddressList *al);
91size_t mutt_addrlist_write (const struct AddressList *al, struct Buffer *buf, bool display);
92size_t mutt_addrlist_write_wrap (const struct AddressList *al, struct Buffer *buf, const char *header);
93void mutt_addrlist_write_file (const struct AddressList *al, FILE *fp, const char *header);
94size_t mutt_addrlist_write_list (const struct AddressList *al, struct ListHead *list);
95
96#endif /* MUTT_ADDRESS_ADDRESS_H */
struct Address * mutt_addr_create(const char *personal, const char *mailbox)
Create and populate a new Address.
Definition: address.c:414
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
Definition: address.c:765
void mutt_addrlist_qualify(struct AddressList *al, const char *host)
Expand local names in an Address list using a hostname.
Definition: address.c:680
bool mutt_addrlist_equal(const struct AddressList *ala, const struct AddressList *alb)
Compare two Address lists for equality.
Definition: address.c:840
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1460
size_t mutt_addrlist_write_list(const struct AddressList *al, struct ListHead *list)
Write Addresses to a List.
Definition: address.c:1217
void mutt_addr_free(struct Address **ptr)
Free a single Address.
Definition: address.c:462
bool mutt_addr_valid_msgid(const char *msgid)
Is this a valid Message ID?
Definition: address.c:792
size_t mutt_addr_write(struct Buffer *buf, struct Address *addr, bool display)
Write a single Address to a buffer.
Definition: address.c:1050
bool mutt_addrlist_uses_unicode(const struct AddressList *al)
Do any of a list of addresses use Unicode characters.
Definition: address.c:1522
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.
Definition: address.c:708
bool mutt_addr_cmp(const struct Address *a, const struct Address *b)
Compare two e-mail addresses.
Definition: address.c:892
void mutt_addrlist_append(struct AddressList *al, struct Address *a)
Append an Address to an AddressList.
Definition: address.c:1480
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.
Definition: address.c:1189
struct Address * mutt_addr_new(void)
Create a new Address.
Definition: address.c:401
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
Definition: address.c:1378
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
Definition: address.c:1206
bool mutt_addr_uses_unicode(const char *str)
Does this address use Unicode character.
Definition: address.c:1502
int mutt_addrlist_parse2(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:644
struct Address * mutt_addr_copy(const struct Address *addr)
Copy the real address.
Definition: address.c:745
const char AddressSpecials[]
Characters with special meaning for email addresses.
Definition: address.c:45
bool mutt_addr_to_local(struct Address *a)
Convert an Address from Punycode.
Definition: address.c:1340
void mutt_addrlist_remove_xrefs(const struct AddressList *a, struct AddressList *b)
Remove cross-references.
Definition: address.c:1433
int mutt_addrlist_count_recips(const struct AddressList *al)
Count the number of Addresses with valid recipients.
Definition: address.c:872
int mutt_addrlist_parse(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition: address.c:480
void mutt_addrlist_prepend(struct AddressList *al, struct Address *a)
Prepend an Address to an AddressList.
Definition: address.c:1491
void mutt_addrlist_write_file(const struct AddressList *al, FILE *fp, const char *header)
Wrapper for mutt_write_address()
Definition: address.c:1248
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition: address.c:1293
bool mutt_addr_to_intl(struct Address *a)
Convert an Address to Punycode.
Definition: address.c:1263
int mutt_addrlist_remove(struct AddressList *al, const char *mailbox)
Remove an Address from a list.
Definition: address.c:435
bool mutt_addrlist_search(const struct AddressList *haystack, const struct Address *needle)
Search for an e-mail address in a list.
Definition: address.c:909
bool(* addr_predicate_t)(const struct Address *a)
Definition: address.h:56
const char * mutt_addr_for_display(const struct Address *a)
Convert an Address for display purposes.
Definition: address.c:1012
void mutt_addrlist_dedupe(struct AddressList *al)
Remove duplicate addresses.
Definition: address.c:1397
Convenience wrapper for the library headers.
#define TAILQ_HEAD(name, type)
Definition: queue.h:623
An email address.
Definition: address.h:36
struct Buffer * personal
Real name of address.
Definition: address.h:37
bool group
Group mailbox?
Definition: address.h:39
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
bool intl_checked
Checked for IDN?
Definition: address.h:41
TAILQ_ENTRY(Address) entries
Linked list.
bool is_intl
International Domain Name.
Definition: address.h:40
String manipulation buffer.
Definition: buffer.h:36