Creating and destroying MIME parts | |
| mm_mimepart * | mm_mimepart_new (void) |
| mm_mimepart * | mm_mimepart_fromfile (const char *filename) |
| void | mm_mimepart_free (struct mm_mimepart *part) |
Accessing the MIME part's mail header | |
| int | mm_mimepart_attachheader (struct mm_mimepart *part, struct mm_mimeheader *header) |
| int | mm_mimepart_countheaders (struct mm_mimepart *part) |
| int | mm_mimepart_countheaderbyname (struct mm_mimepart *part, const char *name) |
| mm_mimeheader * | mm_mimepart_getheaderbyname (struct mm_mimepart *part, const char *name, int idx) |
| const char * | mm_mimepart_getheadervalue (struct mm_mimepart *part, const char *name, int idx) |
| int | mm_mimepart_headers_start (struct mm_mimepart *part, struct mm_mimeheader **id) |
| mm_mimeheader * | mm_mimepart_headers_next (struct mm_mimepart *part, struct mm_mimeheader **id) |
Accessing and manipulating the MIME part's body | |
| char * | mm_mimepart_getbody (struct mm_mimepart *part, int opaque) |
| void | mm_mimepart_setbody (struct mm_mimepart *part, const char *data, int opaque) |
| size_t | mm_mimepart_getlength (struct mm_mimepart *part) |
| char * | mm_mimepart_decode (struct mm_mimepart *part) |
| int | mm_mimepart_flatten (struct mm_mimepart *part, char **result, size_t *length, int opaque) |
| int | mm_mimepart_setdefaultcontenttype (struct mm_mimepart *part, int composite) |
Accessing the MIME part's Content-Type information | |
| void | mm_mimepart_attachcontenttype (struct mm_mimepart *part, struct mm_content *ct) |
| mm_content * | mm_mimepart_gettype (struct mm_mimepart *part) |
Provided here are functions to easily access all informations from a MIME part, including their specific headers and bodies.
| void mm_mimepart_attachcontenttype | ( | struct mm_mimepart * | part, | |
| struct mm_content * | ct | |||
| ) |
Attaches a context type object to a MIME part
| part | A valid MIME part object | |
| ct | The content type object to attach |
| int mm_mimepart_attachheader | ( | struct mm_mimepart * | part, | |
| struct mm_mimeheader * | header | |||
| ) |
Attaches a mm_mimeheader object to a MIME part
| part | A valid MIME part object | |
| header | A valid MIME header object |
| int mm_mimepart_countheaderbyname | ( | struct mm_mimepart * | part, | |
| const char * | name | |||
| ) |
Retrieves the number of MIME headers with a given name in a MIME part
| part | A valid MIME part object | |
| name | The name of the MIME header which to count for |
| int mm_mimepart_countheaders | ( | struct mm_mimepart * | part | ) |
Retrieves the number of MIME headers available in a MIME part
| part | A valid MIME part object |
| char* mm_mimepart_decode | ( | struct mm_mimepart * | part | ) |
Decodes a MIME part according to it's encoding using MiniMIME codecs
| A | valid MIME part object |
| int mm_mimepart_flatten | ( | struct mm_mimepart * | part, | |
| char ** | result, | |||
| size_t * | length, | |||
| int | opaque | |||
| ) |
Creates an ASCII representation of the given MIME part
| part | A valid MIME part object | |
| result | Where to store the result | |
| length | Where to store the length of the result | |
| opaque | Whether to use the opaque MIME part 0 on success or -1 on error. |
| void mm_mimepart_free | ( | struct mm_mimepart * | part | ) |
Frees all memory allocated by a mm_mimepart object.
| part | A pointer to an allocated mm_mimepart object |
| struct mm_mimepart* mm_mimepart_fromfile | ( | const char * | filename | ) |
Creates a MIME part from a file
| filename | The name of the file to create the MIME part from |
| char* mm_mimepart_getbody | ( | struct mm_mimepart * | part, | |
| int | opaque | |||
| ) |
Gets the pointer to the MIME part's body data
| part | A valid MIME part object | |
| opaque | Whether to get the opaque part or not |
| struct mm_mimeheader* mm_mimepart_getheaderbyname | ( | struct mm_mimepart * | part, | |
| const char * | name, | |||
| int | idx | |||
| ) |
Get a MIME header object from a MIME part
| part | A valid MIME part object | |
| name | The name of the MIME header which to retrieve | |
| idx | Which header field to get (in case of multiple headers of the same name). |
| const char* mm_mimepart_getheadervalue | ( | struct mm_mimepart * | part, | |
| const char * | name, | |||
| int | idx | |||
| ) |
Gets the value of a MIME header object
| part | A valid MIME part object | |
| name | The name of the header field to get the value from | |
| idx | The index of the header field to get, in case there are multiple headers with the same name. |
| size_t mm_mimepart_getlength | ( | struct mm_mimepart * | part | ) |
Gets the length of a given MIME part object
| part | A valid MIME part object |
| struct mm_content* mm_mimepart_gettype | ( | struct mm_mimepart * | part | ) |
Gets the Content-Type of a given MIME part object
| part | A valid MIME part object |
| struct mm_mimeheader* mm_mimepart_headers_next | ( | struct mm_mimepart * | part, | |
| struct mm_mimeheader ** | id | |||
| ) |
Returns the next MIME header of a given MIME part object
| part | A valid MIME part object | |
| id | A previously initialized MIME header object |
| int mm_mimepart_headers_start | ( | struct mm_mimepart * | part, | |
| struct mm_mimeheader ** | id | |||
| ) |
Initializes a header loop for a given MIME part
| part | A valid MIME part object | |
| id | The address of a MIME header object (to allow reentrance) |
struct mm_mimeheader *header, *lheader; mm_mimepart_headers_start(part, &lheader); while ((header = mm_mimepart_headers_next(part, &lheader)) != NULL) { printf("%s: %s\n", header->name, header->value); }
For convienience, the macro mm_mimepart_headers_foreach() can be used to loop through headers in a one-shot manner.
| struct mm_mimepart* mm_mimepart_new | ( | void | ) |
Allocates memory for a new mm_mimepart structure and initializes it.
| void mm_mimepart_setbody | ( | struct mm_mimepart * | part, | |
| const char * | data, | |||
| int | opaque | |||
| ) |
Sets the MIME part's body data
| part | A valid MIME part object | |
| data | A pointer to the data which to set |
| int mm_mimepart_setdefaultcontenttype | ( | struct mm_mimepart * | part, | |
| int | composite | |||
| ) |
Sets the default Content-Type for a given MIME part
| part | A valid MIME part object | |
| part | Whether the Content-Type should be for composite or not |
1.5.1