jstedfast / gmime

A C/C++ MIME creation and parser library with support for S/MIME, PGP, and Unix mbox spools.
GNU Lesser General Public License v2.1
118 stars 38 forks source link

Make the function for unfolding a header (RFC 5322, sect. 2.2.3) publicly available #37

Closed albrechtd closed 6 years ago

albrechtd commented 6 years ago

Rationale: GMime 2.6 functions like g_mime_header_iter_get_value() returned the unfolded, RFC 2047 encoded value. GMime 3 has only functions for reading the raw, folded (g_mime_header_get_raw_value) or the completely processed (unfolded, decoded) value (g_mime_header_get_value). Using the g_mime_utils_header_value_unfold() function, applied to the raw value, it is easier to migrate old GMime 2.6 code which needs the unfolded, but still encoded headers to GMime 3.

The patch simply shifts the function unfold() from gmime/gmime-header.c to gmime/gmime-utils.c and renames it to g_mime_utils_header_value_unfold().

jstedfast commented 6 years ago

I like this, but I think I'd call the function g_mime_utils_header_unfold() and forget the _value bit for brevity.

I'll just make that last minor change myself and merge this now.