/**
 * g_mime_header_iter_copy:
 * @iter: a #GMimeHeaderIter
 *
 * Creates a dynamically allocated header iterator as a copy of
 * @iter. You must free this iter with g_mime_header_iter_free().
 *
 * Returns: a newly-allocated copy of @iter.
 **/
GMimeHeaderIter *
g_mime_header_iter_copy (GMimeHeaderIter *iter)
{
	GMimeHeaderIter *copy;
	
	g_return_val_if_fail (iter != NULL, NULL);
	
	copy = g_mime_header_iter_new ();
	memcpy (copy, iter, sizeof (GMimeHeaderIter));
	
	return copy;
}
static GSList *gmime_fields_to_nameval(GMimeObject *part)
{
	GMimeHeaderList *headers = g_mime_object_get_header_list(part);
	GMimeHeaderIter *iter = g_mime_header_iter_new();
	GSList *fields = NULL;

	if (g_mime_header_list_get_iter(headers, iter)) {
		do {
			fields = sipe_utils_nameval_add(fields,
							g_mime_header_iter_get_name(iter),
							g_mime_header_iter_get_value(iter));

		} while (g_mime_header_iter_next(iter));
	}
	g_mime_header_iter_free(iter);

	return fields;
}