libcmime  
A lightweight C mime library
cmime_address.h
Go to the documentation of this file.
1 /* libcmime - A C mime library
2  * Copyright (C) 2013 SpaceNet AG and Axel Steiner <ast@treibsand.com>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
29 #ifndef _CMIME_ADDRESS_H
30 #define _CMIME_ADDRESS_H
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include <assert.h>
40 
41 
46 typedef enum _CMimeAddressType {
52 
57 typedef struct {
58  char *name;
59  char *email;
61  int parsed;
63 
70 
77 void cmime_address_set_name(CMimeAddress_T *ca, const char *name);
78 
85 void cmime_address_set_email(CMimeAddress_T *ca, const char *email);
86 
94 
102 
110 
117 
122 #define cmime_address_get_name(ca) (ca->name)
123 
128 #define cmime_address_get_email(ca) (ca->email)
129 
134 #define cmime_address_get_type(ca) (ca->type)
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif /* _CMIME_ADDRESS_H */
char * email
Definition: cmime_address.h:59
char * name
Definition: cmime_address.h:58
CMimeAddress_T * cmime_address_parse_string(const char *s)
Parse given string and create CMimeAddress_T object.
Definition: cmime_address.c:85
Definition: cmime_address.h:49
Represents an email address.
Definition: cmime_address.h:57
void cmime_address_free(CMimeAddress_T *ca)
Free a CMimeAddress_T object.
Definition: cmime_address.c:115
CMimeAddress_T * cmime_address_new(void)
Creates a new CMimeAddress_T object.
Definition: cmime_address.c:30
CMimeAddressType_T
Possible types of email addresses.
Definition: cmime_address.h:46
Definition: cmime_address.h:50
Definition: cmime_address.h:47
void cmime_address_set_type(CMimeAddress_T *ca, CMimeAddressType_T t)
Set the address type of CMimeAdress_T object.
Definition: cmime_address.c:78
void cmime_address_set_name(CMimeAddress_T *ca, const char *name)
Set the display name of CMimeAdresse_T object.
Definition: cmime_address.c:40
void cmime_address_set_email(CMimeAddress_T *ca, const char *email)
Set the email address of CMimeAdress_T object.
Definition: cmime_address.c:51
Definition: cmime_address.h:48
char * cmime_address_to_string(CMimeAddress_T *ca)
Allocates a string containing the contents of the CMimeAddress_T object.
Definition: cmime_address.c:62
CMimeAddressType_T type
Definition: cmime_address.h:60
int parsed
Definition: cmime_address.h:61