NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config_type.h File Reference

Config type representing an email address. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct Addressaddress_new (const char *addr)
 Create an Address from a string.
 
const struct Addresscs_subset_address (const struct ConfigSubset *sub, const char *name)
 Get an Address config item by name.
 

Detailed Description

Config type representing an email address.

Authors
  • Richard Russon

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 config_type.h.

Function Documentation

◆ address_new()

struct Address * address_new ( const char *  addr)

Create an Address from a string.

Parameters
addrEmail address to parse
Return values
ptrNew Address object

Definition at line 52 of file config_type.c.

53{
54 struct Address *a = mutt_mem_calloc(1, sizeof(*a));
55 a->mailbox = buf_new(addr);
56 return a;
57}
struct Buffer * buf_new(const char *str)
Allocate a new Buffer.
Definition: buffer.c:304
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
An email address.
Definition: address.h:36
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cs_subset_address()

const struct Address * cs_subset_address ( const struct ConfigSubset sub,
const char *  name 
)

Get an Address config item by name.

Parameters
subConfig Subset
nameName of config item
Return values
ptrAddress
NULLEmpty address

Definition at line 272 of file config_type.c.

273{
274 ASSERT(sub && name);
275
276 struct HashElem *he = cs_subset_create_inheritance(sub, name);
277 ASSERT(he);
278
279#ifndef NDEBUG
280 struct HashElem *he_base = cs_get_base(he);
281 ASSERT(DTYPE(he_base->type) == DT_ADDRESS);
282#endif
283
284 intptr_t value = cs_subset_he_native_get(sub, he, NULL);
285 ASSERT(value != INT_MIN);
286
287 return (const struct Address *) value;
288}
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
Definition: set.c:160
#define ASSERT(COND)
Definition: signal2.h:58
The item stored in a Hash Table.
Definition: hash.h:43
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:44
intptr_t cs_subset_he_native_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Natively get the value of a HashElem config item.
Definition: subset.c:258
struct HashElem * cs_subset_create_inheritance(const struct ConfigSubset *sub, const char *name)
Create a Subset config item (inherited)
Definition: subset.c:208
#define DTYPE(t)
Definition: types.h:50
@ DT_ADDRESS
e-mail address
Definition: types.h:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function: