Top | ![]() |
![]() |
![]() |
![]() |
ssize_t (*GMimeHeaderWriter) (GMimeStream *stream
,const char *name
,const char *value
);
Function signature for the callback to
g_mime_header_list_register_writer()
.
void (*GMimeHeaderForeachFunc) (const char *name
,const char *value
,gpointer user_data
);
Function signature for the callback to g_mime_header_list_foreach()
.
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()
.
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()
.
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()
.
void g_mime_header_iter_copy_to (GMimeHeaderIter *src
,GMimeHeaderIter *dest
);
Copies src
to dest
.
gboolean g_mime_header_iter_equal (GMimeHeaderIter *iter1
,GMimeHeaderIter *iter2
);
Check that iter1
and iter2
reference the same header.
gboolean
g_mime_header_iter_first (GMimeHeaderIter *iter
);
Updates iter
to point to the first header.
gboolean
g_mime_header_iter_last (GMimeHeaderIter *iter
);
Updates iter
to point to the last header.
gboolean
g_mime_header_iter_next (GMimeHeaderIter *iter
);
Advances to the next header.
gboolean
g_mime_header_iter_prev (GMimeHeaderIter *iter
);
Advances to the previous header.
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.
const char *
g_mime_header_iter_get_name (GMimeHeaderIter *iter
);
Gets the current header's name.
const char *
g_mime_header_iter_get_value (GMimeHeaderIter *iter
);
Gets the current header's value.
the header's raw, unprocessed value or NULL
if invalid.
Note: The returned value should be decoded with a function such as
g_mime_utils_header_decode_text()
before displaying to the user.
gboolean g_mime_header_iter_set_value (GMimeHeaderIter *iter
,const char *value
);
Sets the current header's value to the new value.
TRUE
if the value was set or FALSE
otherwise (indicates
invalid iter).
Note: value
should be encoded with a function such as
g_mime_utils_header_encode_text()
.
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.
GMimeHeaderList *
g_mime_header_list_new (void
);
Creates a new GMimeHeaderList object.
void
g_mime_header_list_destroy (GMimeHeaderList *headers
);
Destroy the header list.
void
g_mime_header_list_clear (GMimeHeaderList *headers
);
Removes all of the headers from the GMimeHeaderList.
gboolean g_mime_header_list_contains (const GMimeHeaderList *headers
,const char *name
);
Checks whether or not a header exists.
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.
Note: value
should be encoded with a function such as
g_mime_utils_header_encode_text()
.
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.
Note: value
should be encoded with a function such as
g_mime_utils_header_encode_text()
.
gboolean g_mime_header_list_remove (GMimeHeaderList *headers
,const char *name
);
Remove the specified header.
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.
Additionally, value
should be encoded with a function such as
g_mime_utils_header_encode_text()
.
const char * g_mime_header_list_get (const GMimeHeaderList *headers
,const char *name
);
Gets the value of the first header with the specified name.
the value of the header requested.
Note: The returned value should be decoded with a function such as
g_mime_utils_header_decode_text()
before displaying to the user.
gboolean g_mime_header_list_get_iter (GMimeHeaderList *headers
,GMimeHeaderIter *iter
);
Initializes an iterator for traversing headers
.
void g_mime_header_list_foreach (const GMimeHeaderList *headers
,GMimeHeaderForeachFunc func
,gpointer user_data
);
Calls func
for each header name/value pair.
headers |
||
func |
function to be called for each header. |
[scope call] |
user_data |
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.
ssize_t g_mime_header_list_write_to_stream (const GMimeHeaderList *headers
,GMimeStream *stream
);
Write the headers to a stream.
char *
g_mime_header_list_to_string (const GMimeHeaderList *headers
);
Allocates a string buffer containing the raw rfc822 headers
contained in headers
.
GMimeStream *
g_mime_header_list_get_stream (GMimeHeaderList *headers
);
Gets the raw stream representing headers
.
void g_mime_header_list_set_stream (GMimeHeaderList *headers
,GMimeStream *stream
);
Set the raw header stream.
struct GMimeHeaderIter { GMimeHeaderList *hdrlist; GMimeHeader *cursor; guint32 version; };
A message or mime-part header iterator. All members should be considered private.
GMimeHeaderList * |
||
a GMimeHeader |
||
guint32 |
the version of |