NeoMutt  2024-04-25-1-g3de005
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 53 of file config_type.c.

54{
55 struct Address *a = mutt_mem_calloc(1, sizeof(*a));
56 a->mailbox = buf_new(addr);
57 return a;
58}
struct Buffer * buf_new(const char *str)
Allocate a new Buffer.
Definition: buffer.c:303
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
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 273 of file config_type.c.

274{
275 assert(sub && name);
276
277 struct HashElem *he = cs_subset_create_inheritance(sub, name);
278 assert(he);
279
280#ifndef NDEBUG
281 struct HashElem *he_base = cs_get_base(he);
282 assert(DTYPE(he_base->type) == DT_ADDRESS);
283#endif
284
285 intptr_t value = cs_subset_he_native_get(sub, he, NULL);
286 assert(value != INT_MIN);
287
288 return (const struct Address *) value;
289}
struct HashElem * cs_get_base(struct HashElem *he)
Find the root Config Item.
Definition: set.c:160
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: