GMimeFormatOptions: GMime 3.0 Reference Manual

## GMimeFormatOptions

GMimeFormatOptions — Format options

## Functions

GMimeFormatOptions * | g_mime_format_options_new ()
void | g_mime_format_options_free ()
GMimeFormatOptions * | g_mime_format_options_clone ()
GMimeFormatOptions * | g_mime_format_options_get_default ()
GMimeParamEncodingMethod | g_mime_format_options_get_param_encoding_method ()
void | g_mime_format_options_set_param_encoding_method ()
GMimeNewLineFormat | g_mime_format_options_get_newline_format ()
void | g_mime_format_options_set_newline_format ()
const char * | g_mime_format_options_get_newline ()
GMimeFilter * | g_mime_format_options_create_newline_filter ()
gboolean | g_mime_format_options_is_hidden_header ()
void | g_mime_format_options_add_hidden_header ()
void | g_mime_format_options_remove_hidden_header ()
void | g_mime_format_options_clear_hidden_headers ()

## Types and Values

enum | GMimeParamEncodingMethod
enum | GMimeNewLineFormat
| GMimeFormatOptions

## Description

A GMimeFormatOptions is used by GMime to determine how to serialize various objects and headers.

## Functions

### g_mime_format_options_new ()

    GMimeFormatOptions *
    g_mime_format_options_new (void);

Creates a new set of GMimeFormatOptions.

#### Returns

a newly allocated set of GMimeFormatOptions with the default values.

### g_mime_format_options_free ()

    void
    g_mime_format_options_free (GMimeFormatOptions *options);

Frees a set of GMimeFormatOptions.

#### Parameters

options | a GMimeFormatOptions |

### g_mime_format_options_clone ()

    GMimeFormatOptions *
    g_mime_format_options_clone (GMimeFormatOptions *options);

Clones a GMimeFormatOptions.

#### Parameters

options | a GMimeFormatOptions or `NULL`. | [nullable]

#### Returns

a newly allocated GMimeFormatOptions.

[transfer full]

### g_mime_format_options_get_default ()

    GMimeFormatOptions *
    g_mime_format_options_get_default (void);

Gets the default format options.

#### Returns

the default format options.

### g_mime_format_options_get_param_encoding_method ()

    GMimeParamEncodingMethod
    g_mime_format_options_get_param_encoding_method
                                   (GMimeFormatOptions *options);

Gets the parameter encoding method to use for GMimeParam parameters that do not already have an encoding method specified.

#### Parameters

options | a GMimeFormatOptions or `NULL`. | [nullable]

#### Returns

the encoding method that is currently set.

### g_mime_format_options_set_param_encoding_method ()

    void
    g_mime_format_options_set_param_encoding_method
                                   (GMimeFormatOptions *options,
                                    GMimeParamEncodingMethod method);

Sets the parameter encoding method to use when encoding parameters which do not have an encoding method specified.

Note: GMIME_PARAM_ENCODING_METHOD_DEFAULT is not allowed.

#### Parameters

options | a GMimeFormatOptions |
method | a GMimeParamEncodingMethod |

### g_mime_format_options_get_newline_format ()

    GMimeNewLineFormat
    g_mime_format_options_get_newline_format
                                   (GMimeFormatOptions *options);

Gets the new-line format to use when writing out messages and headers.

#### Parameters

options | a GMimeFormatOptions or `NULL`. | [nullable]

#### Returns

the new-line format that is currently set.

### g_mime_format_options_set_newline_format ()

    void
    g_mime_format_options_set_newline_format
                                   (GMimeFormatOptions *options,
                                    GMimeNewLineFormat newline);

Sets the new-line format that should be used when writing headers and messages.

#### Parameters

options | a GMimeFormatOptions |
newline | a GMimeNewLineFormat |

### g_mime_format_options_get_newline ()

    const char *
    g_mime_format_options_get_newline (GMimeFormatOptions *options);

Gets a string representing the currently set new-line format.

#### Parameters

options | a GMimeFormatOptions or `NULL`. | [nullable]

#### Returns

a new-line character sequence.

### g_mime_format_options_create_newline_filter ()

    GMimeFilter *
    g_mime_format_options_create_newline_filter
                                   (GMimeFormatOptions *options,
                                    gboolean ensure_newline);

Creates a GMimeFilter suitable for converting line-endings to the currently set new-line format.

#### Parameters

options | a GMimeFormatOptions or `NULL`. | [nullable]
ensure_newline | `TRUE` if the output must *always* end with a new line |

#### Returns

a GMimeFilter to convert to the specified new-line format.

[transfer full]

### g_mime_format_options_is_hidden_header ()

    gboolean
    g_mime_format_options_is_hidden_header
                                   (GMimeFormatOptions *options,
                                    const char *header);

Gets whether or not the specified header should be hidden.

#### Parameters

options | a GMimeFormatOptions or `NULL`. | [nullable]
header | the name of a header |

#### Returns

`TRUE` if the header should be hidden or `FALSE` otherwise.

### g_mime_format_options_add_hidden_header ()

    void
    g_mime_format_options_add_hidden_header
                                   (GMimeFormatOptions *options,
                                    const char *header);

Adds the given header to the list of headers that should be hidden.

#### Parameters

options | a GMimeFormatOptions |
header | a header name |

### g_mime_format_options_remove_hidden_header ()

    void
    g_mime_format_options_remove_hidden_header
                                   (GMimeFormatOptions *options,
                                    const char *header);

Removes the given header from the list of headers that should be hidden.

#### Parameters

options | a GMimeFormatOptions |
header | a header name |

### g_mime_format_options_clear_hidden_headers ()

    void
    g_mime_format_options_clear_hidden_headers
                                   (GMimeFormatOptions *options);

Clears the list of headers that should be hidden.

#### Parameters

options | a GMimeFormatOptions |

## Types and Values

### enum GMimeParamEncodingMethod

The MIME specifications specify that the proper method for encoding Content-Type and Content-Disposition parameter values is the method described in

<a>rfc2231</a>. However, it is common for

some older email clients to improperly encode using the method described in

<a>rfc2047</a> instead.

#### Members

GMIME_PARAM_ENCODING_METHOD_DEFAULT | Use the default encoding method set on the GMimeFormatOptions. |
GMIME_PARAM_ENCODING_METHOD_RFC2231 | Use the encoding method described in rfc2231. |
GMIME_PARAM_ENCODING_METHOD_RFC2047 | Use the encoding method described in rfc2047. |

### enum GMimeNewLineFormat

There are two commonly used line-endings used by modern Operating Systems. Unix-based systems such as Linux and Mac OS use a single character ('\n' aka LF) to represent the end of line where-as Windows (or DOS) uses a sequence of two characters ("\r\n" aka CRLF). Most text-based network protocols such as SMTP, POP3, and IMAP use the CRLF sequence as well.

#### Members

GMIME_NEWLINE_FORMAT_UNIX | The Unix New-Line format ("\n"). |
GMIME_NEWLINE_FORMAT_DOS | The DOS New-Line format ("\r\n"). |

### GMimeFormatOptions

    typedef struct _GMimeFormatOptions GMimeFormatOptions;

Format options for serializing various GMime objects.