TNEF to MIME conversion

TNEF to MIME conversion — Convert a TNEF message and inspect conversion losses

Functions

GMimeStream * (*GMimeTnefOleObjectConverter) ()
char * (*GMimeTnefAttachmentPlaceholderCallback) ()
GMimeTnefConversionResult * g_mime_tnef_message_convert_to_mime ()
GMimeTnefConversionOptions * g_mime_tnef_conversion_options_new ()
GMimeTnefConversionOptions * g_mime_tnef_conversion_options_ref ()
void g_mime_tnef_conversion_options_unref ()
GMimeTnefConversionOptions * g_mime_tnef_conversion_options_clone ()
gboolean g_mime_tnef_conversion_options_get_convert_embedded_messages ()
void g_mime_tnef_conversion_options_set_convert_embedded_messages ()
gboolean g_mime_tnef_conversion_options_get_generate_calendar ()
void g_mime_tnef_conversion_options_set_generate_calendar ()
guint g_mime_tnef_conversion_options_get_max_calendar_exceptions ()
void g_mime_tnef_conversion_options_set_max_calendar_exceptions ()
guint64 g_mime_tnef_conversion_options_get_max_calendar_exceptions_size ()
void g_mime_tnef_conversion_options_set_max_calendar_exceptions_size ()
void g_mime_tnef_conversion_options_set_ole_object_converter ()
GMimeTnefOleObjectConverter g_mime_tnef_conversion_options_get_ole_object_converter ()
void g_mime_tnef_conversion_options_set_attachment_placeholder_callback ()
GMimeTnefAttachmentPlaceholderCallback g_mime_tnef_conversion_options_get_attachment_placeholder_callback ()
GMimeTnefConversionResult * g_mime_tnef_conversion_result_ref ()
void g_mime_tnef_conversion_result_unref ()
GMimeMessage * g_mime_tnef_conversion_result_get_message ()
guint g_mime_tnef_conversion_result_get_loss_count ()
const GMimeTnefConversionLoss * g_mime_tnef_conversion_result_get_loss ()

Types and Values

Description

Functions

GMimeTnefOleObjectConverter ()

GMimeStream *
(*GMimeTnefOleObjectConverter) (GMimeTnefAttachment *attachment,
                                gpointer user_data);

Parameters

attachment

OLE attachment.

[transfer none]

user_data

caller data.

[closure][nullable]

Returns

PNG, JPEG, GIF, BMP or WebP stream, read from its current position; NULL leaves the compound file intact.

[transfer full][nullable]


GMimeTnefAttachmentPlaceholderCallback ()

char *
(*GMimeTnefAttachmentPlaceholderCallback)
                               (GMimeTnefAttachment *attachment,
                                GMimeEntity *entity,
                                gpointer user_data);

Parameters

attachment

attachment positioned in the RTF body.

[transfer none]

entity

converted MIME attachment, if any.

[transfer none][nullable]

user_data

caller data.

[closure][nullable]

Returns

replacement plain text. The converter escapes this value when writing HTML.

[transfer full][nullable]


g_mime_tnef_message_convert_to_mime ()

GMimeTnefConversionResult *
g_mime_tnef_message_convert_to_mime (GMimeTnefMessage *message,
                                     const GMimeTnefConversionOptions *options,
                                     GError **error);

Restores the MIME skeleton when all promoted parts can be matched. Otherwise reconstructs the headers, bodies and attachments from message properties. Recoverable losses (including those of nested messages) are available in the result. All output payloads outlive the TNEF input.

Parameters

message

a loaded TNEF message

 

options

conversion options, or NULL for defaults.

[nullable]

error

return location for a fatal conversion error, or NULL

 

Returns

result, or NULL on fatal error.

[transfer full][nullable]


g_mime_tnef_conversion_options_new ()

GMimeTnefConversionOptions *
g_mime_tnef_conversion_options_new (void);

Returns

new options with calendar generation enabled, limited to 1024 exceptions and 16 MiB of exception data.

[transfer full]


g_mime_tnef_conversion_options_ref ()

GMimeTnefConversionOptions *
g_mime_tnef_conversion_options_ref (GMimeTnefConversionOptions *options);

Parameters

options

conversion settings

 

Returns

options with another reference.

[transfer full]


g_mime_tnef_conversion_options_unref ()

void
g_mime_tnef_conversion_options_unref (GMimeTnefConversionOptions *options);

Releases one reference.

Parameters

options

conversion settings

 

g_mime_tnef_conversion_options_clone ()

GMimeTnefConversionOptions *
g_mime_tnef_conversion_options_clone (const GMimeTnefConversionOptions *options);

Parameters

options

conversion settings

 

Returns

an independent copy. Callback data is shared until the last copy releases the callback.

[transfer full]


g_mime_tnef_conversion_options_get_convert_embedded_messages ()

gboolean
g_mime_tnef_conversion_options_get_convert_embedded_messages
                               (const GMimeTnefConversionOptions *options);

Parameters

options

conversion settings

 

Returns

whether nested TNEF is converted to message/rfc822.


g_mime_tnef_conversion_options_set_convert_embedded_messages ()

void
g_mime_tnef_conversion_options_set_convert_embedded_messages
                               (GMimeTnefConversionOptions *options,
                                gboolean enable);

Parameters

options

conversion settings

 

enable

whether to convert nested messages rather than preserve TNEF

 

g_mime_tnef_conversion_options_get_generate_calendar ()

gboolean
g_mime_tnef_conversion_options_get_generate_calendar
                               (const GMimeTnefConversionOptions *options);

Parameters

options

conversion settings

 

Returns

whether appointments get a text/calendar alternative.


g_mime_tnef_conversion_options_set_generate_calendar ()

void
g_mime_tnef_conversion_options_set_generate_calendar
                               (GMimeTnefConversionOptions *options,
                                gboolean enable);

Parameters

options

conversion settings

 

enable

whether to generate calendar content

 

g_mime_tnef_conversion_options_get_max_calendar_exceptions ()

guint
g_mime_tnef_conversion_options_get_max_calendar_exceptions
                               (const GMimeTnefConversionOptions *options);

Parameters

options

conversion settings

 

Returns

maximum modified occurrences to export.


g_mime_tnef_conversion_options_set_max_calendar_exceptions ()

void
g_mime_tnef_conversion_options_set_max_calendar_exceptions
                               (GMimeTnefConversionOptions *options,
                                guint maximum);

Parameters

options

conversion settings

 

maximum

maximum modified occurrences to export

 

g_mime_tnef_conversion_options_get_max_calendar_exceptions_size ()

guint64
g_mime_tnef_conversion_options_get_max_calendar_exceptions_size
                               (const GMimeTnefConversionOptions *options);

Parameters

options

conversion settings

 

Returns

maximum combined size of calendar exceptions, in bytes.


g_mime_tnef_conversion_options_set_max_calendar_exceptions_size ()

void
g_mime_tnef_conversion_options_set_max_calendar_exceptions_size
                               (GMimeTnefConversionOptions *options,
                                guint64 maximum);

Parameters

options

conversion settings

 

maximum

maximum combined size of exceptions, in bytes

 

g_mime_tnef_conversion_options_set_ole_object_converter ()

void
g_mime_tnef_conversion_options_set_ole_object_converter
                               (GMimeTnefConversionOptions *options,
                                GMimeTnefOleObjectConverter callback,
                                gpointer user_data,
                                GDestroyNotify destroy);

Parameters

options

conversion settings

 

callback

renderer, or NULL to disable.

[scope notified][nullable]

user_data

renderer data.

[nullable]

destroy

releases the data.

[nullable]

g_mime_tnef_conversion_options_get_ole_object_converter ()

GMimeTnefOleObjectConverter
g_mime_tnef_conversion_options_get_ole_object_converter
                               (const GMimeTnefConversionOptions *options,
                                gpointer *user_data);

[skip]

Parameters

options

conversion settings

 

user_data

renderer data.

[out][optional][transfer none]

Returns

registered OLE renderer.

[nullable]


g_mime_tnef_conversion_options_set_attachment_placeholder_callback ()

void
g_mime_tnef_conversion_options_set_attachment_placeholder_callback
                               (GMimeTnefConversionOptions *options,
                                GMimeTnefAttachmentPlaceholderCallback callback,
                                gpointer user_data,
                                GDestroyNotify destroy);

Parameters

options

conversion settings

 

callback

placeholder callback, or NULL.

[scope notified][nullable]

user_data

callback data.

[nullable]

destroy

releases the data.

[nullable]

g_mime_tnef_conversion_options_get_attachment_placeholder_callback ()

GMimeTnefAttachmentPlaceholderCallback
g_mime_tnef_conversion_options_get_attachment_placeholder_callback
                               (const GMimeTnefConversionOptions *options,
                                gpointer *user_data);

[skip]

Parameters

options

conversion settings

 

user_data

callback data.

[out][optional][transfer none]

Returns

registered placeholder callback.

[nullable]


g_mime_tnef_conversion_result_ref ()

GMimeTnefConversionResult *
g_mime_tnef_conversion_result_ref (GMimeTnefConversionResult *result);

Parameters

result

conversion result

 

Returns

result with another reference.

[transfer full]


g_mime_tnef_conversion_result_unref ()

void
g_mime_tnef_conversion_result_unref (GMimeTnefConversionResult *result);

Releases one reference.

Parameters

result

conversion result

 

g_mime_tnef_conversion_result_get_message ()

GMimeMessage *
g_mime_tnef_conversion_result_get_message
                               (GMimeTnefConversionResult *result);

Parameters

result

conversion result

 

Returns

the converted message. Take a reference to retain the message and all its content beyond the lifetime of result .

[transfer none]


g_mime_tnef_conversion_result_get_loss_count ()

guint
g_mime_tnef_conversion_result_get_loss_count
                               (const GMimeTnefConversionResult *result);

Parameters

result

conversion result

 

Returns

number of recoverable losses across the message tree.


g_mime_tnef_conversion_result_get_loss ()

const GMimeTnefConversionLoss *
g_mime_tnef_conversion_result_get_loss
                               (const GMimeTnefConversionResult *result,
                                guint index);

Parameters

result

conversion result

 

index

zero-based loss index

 

Returns

loss owned by result .

[transfer none]

Types and Values

GMimeTnefConversionResult

typedef struct _GMimeTnefConversionResult GMimeTnefConversionResult;

Owns an independent MIME message and all recoverable conversion losses.


GMimeTnefConversionOptions

typedef struct _GMimeTnefConversionOptions GMimeTnefConversionOptions;

Reference-counted MIME conversion settings. By default calendar generation is enabled, nested TNEF is preserved and neither callback is installed.


enum GMimeTnefConversionLossKind

Identifies a recoverable difference between the source message and its MIME representation.

Members

GMIME_TNEF_CONVERSION_LOSS_INVALID_MIME_SKELETON

The original MIME structure could not be restored.

 

GMIME_TNEF_CONVERSION_LOSS_UNPARSABLE_RECIPIENT

No Internet mailbox could be recovered.

 

GMIME_TNEF_CONVERSION_LOSS_INVALID_MESSAGE_ID

An invalid message or content identifier was omitted.

 

GMIME_TNEF_CONVERSION_LOSS_UNSUPPORTED_ATTACH_METHOD

An unsupported attachment method was encountered.

 

GMIME_TNEF_CONVERSION_LOSS_ATTACHMENT_WITHOUT_CONTENT

An attachment lacked data.

 

GMIME_TNEF_CONVERSION_LOSS_INVALID_HEADER

An invalid Internet header was omitted.

 

GMIME_TNEF_CONVERSION_LOSS_INVALID_EMBEDDED_MESSAGE

An embedded message could not be decoded.

 

GMIME_TNEF_CONVERSION_LOSS_INVALID_RTF_BODY

An unusable rich-text body was dropped.

 

GMIME_TNEF_CONVERSION_LOSS_RTF_CHECKSUM_MISMATCH

The rich-text body may be corrupt.

 

GMIME_TNEF_CONVERSION_LOSS_INVALID_CALENDAR_DATA

Invalid appointment data was encountered.

 

GMIME_TNEF_CONVERSION_LOSS_UNSUPPORTED_CALENDAR_DATA

Unsupported appointment data was encountered.

 

GMIME_TNEF_CONVERSION_LOSS_CALENDAR_EXCEPTION_LIMIT_EXCEEDED

Calendar exception limits were reached.

 

GMIME_TNEF_CONVERSION_LOSS_OLE_OBJECT_NOT_RENDERED

Original OLE bytes were retained instead of an image.

 

GMimeTnefConversionLoss

typedef struct {
	GMimeTnefConversionLossKind kind;
	const char *description;
} GMimeTnefConversionLoss;

One nonfatal loss encountered during conversion.

Members

GMimeTnefConversionLossKind kind;

machine-readable reason

 

const char *description;

human-readable detail, borrowed from the result