GMime 2.4 Reference Manual | ||||
---|---|---|---|---|
GMimeHeaderIter; GMimeHeaderList; ssize_t (*GMimeHeaderWriter) (GMimeStream *stream, const char *name, const char *value); void (*GMimeHeaderForeachFunc) (const char *name, const char *value, gpointer user_data); GMimeHeaderIter* g_mime_header_iter_new (void); void g_mime_header_iter_free (GMimeHeaderIter *iter); GMimeHeaderIter* g_mime_header_iter_copy (GMimeHeaderIter *iter); void g_mime_header_iter_copy_to (GMimeHeaderIter *src, GMimeHeaderIter *dest); gboolean g_mime_header_iter_equal (GMimeHeaderIter *iter1, GMimeHeaderIter *iter2); gboolean g_mime_header_iter_first (GMimeHeaderIter *iter); gboolean g_mime_header_iter_last (GMimeHeaderIter *iter); gboolean g_mime_header_iter_next (GMimeHeaderIter *iter); gboolean g_mime_header_iter_prev (GMimeHeaderIter *iter); gboolean g_mime_header_iter_is_valid (GMimeHeaderIter *iter); const char* g_mime_header_iter_get_name (GMimeHeaderIter *iter); const char* g_mime_header_iter_get_value (GMimeHeaderIter *iter); gboolean g_mime_header_iter_set_value (GMimeHeaderIter *iter, const char *value); gboolean g_mime_header_iter_remove (GMimeHeaderIter *iter); GMimeHeaderList* g_mime_header_list_new (void); void g_mime_header_list_destroy (GMimeHeaderList *headers); void g_mime_header_list_prepend (GMimeHeaderList *headers, const char *name, const char *value); void g_mime_header_list_append (GMimeHeaderList *headers, const char *name, const char *value); gboolean g_mime_header_list_remove (GMimeHeaderList *headers, const char *name); void g_mime_header_list_set (GMimeHeaderList *headers, const char *name, const char *value); const char* g_mime_header_list_get (const GMimeHeaderList *headers, const char *name); gboolean g_mime_header_list_get_iter (GMimeHeaderList *headers, GMimeHeaderIter *iter); void g_mime_header_list_foreach (const GMimeHeaderList *headers, GMimeHeaderForeachFunc func, gpointer user_data); void g_mime_header_list_register_writer (GMimeHeaderList *headers, const char *name, GMimeHeaderWriter writer); ssize_t g_mime_header_list_write_to_stream (const GMimeHeaderList *headers, GMimeStream *stream); char* g_mime_header_list_to_string (const GMimeHeaderList *headers); gboolean g_mime_header_list_has_raw (const GMimeHeaderList *headers); void g_mime_header_list_set_raw (GMimeHeaderList *headers, const char *raw);
typedef struct { GMimeHeaderList *hdrlist; GMimeHeader *cursor; guint32 version; } GMimeHeaderIter;
A message or mime-part header iterator. All members should be considered private.
GMimeHeaderList * |
a GMimeHeaderList |
GMimeHeader * |
a GMimeHeader |
guint32 |
the version of hdrlist when initialized
|
ssize_t (*GMimeHeaderWriter) (GMimeStream *stream, const char *name, const char *value);
Function signature for the callback to
g_mime_header_register_writer()
.
|
The output stream. |
|
The field name. |
|
The field value. |
Returns : |
the number of bytes written or -1 on error.
|
void (*GMimeHeaderForeachFunc) (const char *name, const char *value, gpointer user_data);
Function signature for the callback to g_mime_header_list_foreach()
.
|
The field name. |
|
The field value. |
|
The user-supplied callback data. |
GMimeHeaderIter* g_mime_header_iter_new (void);
Dynamically allocates a GMimeHeaderIter on the heap. This is
intended for use in language bindings but may also be useful in
applications as well. You must free this iter with
g_mime_header_iter_free()
.
Returns : |
a newly-allocated GMimeHeaderIter. |
void g_mime_header_iter_free (GMimeHeaderIter *iter);
Frees a dynamically-allocated GMimeHeaderIter as created by
g_mime_header_iter_new()
or g_mime_header_iter_copy()
.
|
a GMimeHeaderIter |
GMimeHeaderIter* g_mime_header_iter_copy (GMimeHeaderIter *iter);
Creates a dynamically allocated header iterator as a copy of
iter
. You must free this iter with g_mime_header_iter_free()
.
|
a GMimeHeaderIter |
Returns : |
a newly-allocated copy of iter .
|
void g_mime_header_iter_copy_to (GMimeHeaderIter *src, GMimeHeaderIter *dest);
Copies src
to dest
.
|
a GMimeHeaderIter |
|
a GMimeHeaderIter |
gboolean g_mime_header_iter_equal (GMimeHeaderIter *iter1, GMimeHeaderIter *iter2);
Check that iter1
and iter2
reference the same header.
|
a GMimeHeaderIter |
|
a GMimeHeaderIter |
Returns : |
TRUE if iter1 and iter2 refer to the same header or
FALSE otherwise.
|
gboolean g_mime_header_iter_first (GMimeHeaderIter *iter);
Updates iter
to point to the first header.
|
a GMimeHeaderIter |
Returns : |
TRUE on success or FALSE otherwise.
|
gboolean g_mime_header_iter_last (GMimeHeaderIter *iter);
Updates iter
to point to the last header.
|
a GMimeHeaderIter |
Returns : |
TRUE on success or FALSE otherwise.
|
gboolean g_mime_header_iter_next (GMimeHeaderIter *iter);
Advances to the next header.
|
a GMimeHeaderIter |
Returns : |
TRUE on success or FALSE otherwise.
|
gboolean g_mime_header_iter_prev (GMimeHeaderIter *iter);
Advances to the previous header.
|
a GMimeHeaderIter |
Returns : |
TRUE on success or FALSE otherwise.
|
gboolean g_mime_header_iter_is_valid (GMimeHeaderIter *iter);
Checks if a GMimeHeaderIter is valid. An iterator may become invalid if the GMimeHeaderList that the iterator refers to changes.
|
a GMimeHeaderIter |
Returns : |
TRUE if iter is still valid or FALSE otherwise.
|
const char* g_mime_header_iter_get_name (GMimeHeaderIter *iter);
Gets the current header's name.
|
a GMimeHeaderIter |
Returns : |
the header name or NULL if invalid.
|
const char* g_mime_header_iter_get_value (GMimeHeaderIter *iter);
Gets the current header's name.
|
a GMimeHeaderIter |
Returns : |
the header name or NULL if invalid.
|
gboolean g_mime_header_iter_set_value (GMimeHeaderIter *iter, const char *value);
Sets the current header's value to the new value.
|
a GMimeHeaderIter |
|
new header value |
Returns : |
TRUE if the value was set or FALSE otherwise (indicates
invalid iter).
|
gboolean g_mime_header_iter_remove (GMimeHeaderIter *iter);
Removes the current header and advances to the next header.
Note: If you remove the last header in the list, then iter
will
become invalid regardless of whether or not other headers remain.
|
a GMimeHeaderIter |
Returns : |
TRUE on success or FALSE otherwise.
|
GMimeHeaderList* g_mime_header_list_new (void);
Creates a new GMimeHeaderList object.
Returns : |
a new header list object. |
void g_mime_header_list_destroy (GMimeHeaderList *headers);
Destroy the header list.
|
a GMimeHeaderList |
void g_mime_header_list_prepend (GMimeHeaderList *headers, const char *name, const char *value);
Prepends 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.
|
a GMimeHeaderList |
|
header name |
|
header value |
void g_mime_header_list_append (GMimeHeaderList *headers, const char *name, const char *value);
Appends 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.
|
a GMimeHeaderList |
|
header name |
|
header value |
gboolean g_mime_header_list_remove (GMimeHeaderList *headers, const char *name);
Remove the specified header.
|
a GMimeHeaderList |
|
header name |
Returns : |
TRUE if the header was successfully removed or FALSE if
the specified header could not be found.
|
void g_mime_header_list_set (GMimeHeaderList *headers, 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.
Note: If there are multiple headers with the specified field name, the first instance of the header will be replaced and further instances will be removed.
|
a GMimeHeaderList |
|
header name |
|
header value |
const char* g_mime_header_list_get (const GMimeHeaderList *headers, const char *name);
Gets the value of the first header with the name requested.
|
a GMimeHeaderList |
|
header name |
Returns : |
the value of the header requested. |
gboolean g_mime_header_list_get_iter (GMimeHeaderList *headers, GMimeHeaderIter *iter);
Initializes an iterator for traversing headers
.
|
a GMimeHeaderList |
|
a GMimeHeaderIter |
Returns : |
a TRUE if successful or FALSE if there are no headers to
traverse.
|
void g_mime_header_list_foreach (const GMimeHeaderList *headers, GMimeHeaderForeachFunc func, gpointer user_data);
Calls func
for each header name/value pair.
|
A GMimeHeaderList |
|
function to be called for each header. |
|
User data to be passed to the func. |
void g_mime_header_list_register_writer (GMimeHeaderList *headers, const char *name, GMimeHeaderWriter writer);
Changes the function used to write name
headers to writer
(or the
default if writer
is NULL
). This is useful if you want to change
the default header folding style for a particular header.
|
a GMimeHeaderList |
|
header name |
|
writer function |
ssize_t g_mime_header_list_write_to_stream (const GMimeHeaderList *headers, GMimeStream *stream);
Write the headers to a stream.
|
a GMimeHeaderList |
|
output stream |
Returns : |
the number of bytes written or -1 on fail.
|
char* g_mime_header_list_to_string (const GMimeHeaderList *headers);
Allocates a string buffer containing the raw rfc822 headers
contained in headers
.
|
a GMimeHeaderList |
Returns : |
a string containing the header block. |
gboolean g_mime_header_list_has_raw (const GMimeHeaderList *headers);
Gets whether or not a raw header has been set on headers
.
|
a GMimeHeaderList |
Returns : |
TRUE if a raw header is set or FALSE otherwise.
|
void g_mime_header_list_set_raw (GMimeHeaderList *headers, const char *raw);
Set the raw header.
|
a GMimeHeaderList |
|
raw mime part header |