GMimeTextToHtml

GMimeTextToHtml — Quoting, hyperlink detection, and HTML callbacks

Functions

Types and Values

Description

Implements MimeKit's line-oriented plain and flowed HTML output algorithms. Input accepts CRLF, LF, and CR; generated output newlines are always LF. Headers and footers in text format are independently converted without the body's callback. HTML-format headers and footers are copied as raw markup.

Functions

g_mime_text_to_html_new ()

GMimeTextConverter *
g_mime_text_to_html_new (void);

Creates a plain-text to HTML converter. By default, the output includes html and body wrappers, and headers and footers are interpreted as text.

Returns

a new GMimeTextToHtml.

[transfer full]


g_mime_text_to_html_get_output_html_fragment ()

gboolean
g_mime_text_to_html_get_output_html_fragment
                               (GMimeTextToHtml *converter);

Gets whether the generated html and body wrappers are omitted.

Parameters

converter

a GMimeTextToHtml

 

Returns

TRUE for fragment output, or FALSE for document output (the default).


g_mime_text_to_html_set_output_html_fragment ()

void
g_mime_text_to_html_set_output_html_fragment
                               (GMimeTextToHtml *converter,
                                gboolean value);

Selects fragment or document output. Headers and footers are included in either mode. This setting cannot be changed during conversion.

Parameters

converter

a GMimeTextToHtml

 

value

whether to omit the generated html and body wrappers

 

g_mime_text_to_html_get_header_format ()

GMimeHeaderFooterFormat
g_mime_text_to_html_get_header_format (GMimeTextToHtml *converter);

Gets how the configured header is interpreted.

Parameters

converter

a GMimeTextToHtml

 

Returns

the header format, initially GMIME_HEADER_FOOTER_FORMAT_TEXT.


g_mime_text_to_html_set_header_format ()

void
g_mime_text_to_html_set_header_format (GMimeTextToHtml *converter,
                                       GMimeHeaderFooterFormat value);

Selects how the header set by g_mime_text_converter_set_header() is written. Text is converted to HTML without invoking the body's tag callback; HTML is copied verbatim and is not sanitized. This setting cannot be changed during conversion.

Parameters

converter

a GMimeTextToHtml

 

value

the format of the configured header

 

g_mime_text_to_html_get_footer_format ()

GMimeHeaderFooterFormat
g_mime_text_to_html_get_footer_format (GMimeTextToHtml *converter);

Gets how the configured footer is interpreted.

Parameters

converter

a GMimeTextToHtml

 

Returns

the footer format, initially GMIME_HEADER_FOOTER_FORMAT_TEXT.


g_mime_text_to_html_set_footer_format ()

void
g_mime_text_to_html_set_footer_format (GMimeTextToHtml *converter,
                                       GMimeHeaderFooterFormat value);

Selects how the footer set by g_mime_text_converter_set_footer() is written. Text is converted to HTML without invoking the body's tag callback; HTML is copied verbatim and is not sanitized. This setting cannot be changed during conversion.

Parameters

converter

a GMimeTextToHtml

 

value

the format of the configured footer

 

g_mime_text_to_html_get_html_tag_callback ()

GMimeHtmlTagCallback
g_mime_text_to_html_get_html_tag_callback
                               (GMimeTextToHtml *converter,
                                gpointer *user_data);

Gets the registered HTML tag callback. This function is C-only because introspection does not support returning callback function pointers.

[skip]

Parameters

converter

a GMimeTextToHtml

 

user_data

return location for the callback's borrowed user data.

[out][optional][nullable][transfer none]

Returns

the registered callback, or NULL if none is set.

[nullable]


g_mime_text_to_html_set_html_tag_callback ()

void
g_mime_text_to_html_set_html_tag_callback
                               (GMimeTextToHtml *converter,
                                GMimeHtmlTagCallback callback,
                                gpointer user_data,
                                GDestroyNotify destroy_notify);

Sets the callback for tags generated from the body, or restores default tag output if callback is NULL. The callback must explicitly write any desired tag; end-tag callbacks are opt-in through GMimeHtmlTagContext. Wrappers, headers and footers do not invoke the callback.

The previous destroy notifier is called when replacing the registration. destroy_notify is called when this registration is replaced or the converter is finalized. The callback cannot be changed during conversion.

Parameters

converter

a GMimeTextToHtml

 

callback

the tag callback.

[nullable][scope notified][closure user_data][destroy destroy_notify]

user_data

data passed to callback .

[nullable]

destroy_notify

destroy notifier for user_data .

[nullable]

Types and Values

GMimeTextToHtml

typedef struct _GMimeTextToHtml GMimeTextToHtml;

Converts plain text to HTML, including quoting and hyperlink detection.