## gmime-header

gmime-header —

## Synopsis

    struct      GMimeHeader;
    void        (*GMimeHeaderForeachFunc)       (const char *name,
                                                 const char *value,
                                                 gpointer user_data);
    GMimeHeader* g_mime_header_new              (void);
    void        g_mime_header_destroy           (GMimeHeader *header);
    void        g_mime_header_add               (GMimeHeader *header,
                                                 const char *name,
                                                 const char *value);
    void        g_mime_header_set               (GMimeHeader *header,
                                                 const char *name,
                                                 const char *value);
    const char* g_mime_header_get               (const GMimeHeader *header,
                                                 const char *name);
    void        g_mime_header_remove            (GMimeHeader *header,
                                                 const char *name);
    ssize_t     g_mime_header_write_to_stream   (const GMimeHeader *header,
                                                 GMimeStream *stream);
    char*       g_mime_header_to_string         (const GMimeHeader *header);
    void        g_mime_header_foreach           (const GMimeHeader *header,
                                                 GMimeHeaderForeachFunc func,
                                                 gpointer user_data);

## Description

## Details

### struct GMimeHeader

    struct GMimeHeader;

### GMimeHeaderForeachFunc ()

    void        (*GMimeHeaderForeachFunc)       (const char *name,
                                                 const char *value,
                                                 gpointer user_data);

`name` : |
`value` : |
`user_data` : |

### g_mime_header_new ()

    GMimeHeader* g_mime_header_new              (void);

Creates a new GMimeHeader object.

Returns : | a new header object.

### g_mime_header_destroy ()

    void        g_mime_header_destroy           (GMimeHeader *header);

Destroy the header object

`header` : | header object

### g_mime_header_add ()

    void        g_mime_header_add               (GMimeHeader *header,
                                                 const char *name,
                                                 const char *value);

Adds a header. If `value` is `NULL`, a space will be set aside for it (useful for setting the order of headers before values can be obtained for them) otherwise the header will be unset.

`header` : | header object
`name` : | header name
`value` : | header value

### g_mime_header_set ()

    void        g_mime_header_set               (GMimeHeader *header,
                                                 const char *name,
                                                 const char *value);

Set the value of the specified header. If `value` is `NULL` and the header, `name`, had not been previously set, a space will be set aside for it (useful for setting the order of headers before values can be obtained for them) otherwise the header will be unset.

`header` : | header object
`name` : | header name
`value` : | header value

### g_mime_header_get ()

    const char* g_mime_header_get               (const GMimeHeader *header,
                                                 const char *name);

Gets the value of the header requested.

`header` : | header object
`name` : | header name
Returns : | the value of the header requested.

### g_mime_header_remove ()

    void        g_mime_header_remove            (GMimeHeader *header,
                                                 const char *name);

Remove the specified header.

`header` : | header object
`name` : | header name

### g_mime_header_write_to_stream ()

    ssize_t     g_mime_header_write_to_stream   (const GMimeHeader *header,
                                                 GMimeStream *stream);

Write the headers to a stream.

`header` : | header object
`stream` : | output stream
Returns : | the number of bytes written or -1 on fail.

### g_mime_header_to_string ()

    char*       g_mime_header_to_string         (const GMimeHeader *header);

Allocates a string buffer containing the raw rfc822 headers contained in `header`.

`header` : | header object
Returns : | a string containing the header block

### g_mime_header_foreach ()

    void        g_mime_header_foreach           (const GMimeHeader *header,
                                                 GMimeHeaderForeachFunc func,
                                                 gpointer user_data);

Calls `func` for each header name/value pair.

`header` : | header object
`func` : | function to be called for each header.
`user_data` : | User data to be passed to the func.