GMimeMultipart

GMimeMultipart — MIME multiparts

Functions

Types and Values

Description

A GMimeMultipart represents all multipart MIME container parts.

Functions

g_mime_multipart_new ()

GMimeMultipart *
g_mime_multipart_new (void);

Creates a new MIME multipart object with a default content-type of multipart/mixed.

Returns

an empty MIME multipart object with a default content-type of multipart/mixed.


g_mime_multipart_new_with_subtype ()

GMimeMultipart *
g_mime_multipart_new_with_subtype (const char *subtype);

Creates a new MIME multipart object with a content-type of multipart/subtype .

Parameters

subtype

content-type subtype

 

Returns

an empty MIME multipart object with a content-type of multipart/subtype .


g_mime_multipart_set_preamble ()

void
g_mime_multipart_set_preamble (GMimeMultipart *multipart,
                               const char *preamble);

Sets the preamble on the multipart, folding at linear whitespace using the default formatting options and ending a nonempty final line with a newline. Oversized words remain intact. Assigning the current decoded value preserves the original bytes instead of refolding them.

Parameters

multipart

a GMimeMultipart object

 

preamble

UTF-8 preamble, or NULL to remove it.

[nullable]

g_mime_multipart_get_preamble ()

const char *
g_mime_multipart_get_preamble (GMimeMultipart *multipart);

Gets the preamble on the multipart.

Parsed bytes are retained separately from this decoded UTF-8 view. Embedded NUL characters become U+FFFD so the rest of the text remains visible without changing the original bytes. Assigning this same view back preserves them.

Parameters

multipart

a GMimeMultipart object

 

Returns

the preamble string, or NULL if absent.

[nullable][transfer none]


g_mime_multipart_set_epilogue ()

void
g_mime_multipart_set_epilogue (GMimeMultipart *multipart,
                               const char *epilogue);

Sets the epilogue on the multipart, folding at linear whitespace using the default formatting options and ending a nonempty final line with a newline. The raw bytes include the closing boundary's newline, which is omitted from the decoded view. Assigning the current decoded value preserves the bytes.

Parameters

multipart

a GMimeMultipart object

 

epilogue

UTF-8 epilogue, or NULL to remove it.

[nullable]

g_mime_multipart_get_epilogue ()

const char *
g_mime_multipart_get_epilogue (GMimeMultipart *multipart);

Gets the epilogue on the multipart.

The parsed UTF-8 view omits the closing boundary's first newline. Embedded NUL characters become U+FFFD without changing the original bytes. Assigning this same view back preserves them.

Parameters

multipart

a GMimeMultipart object

 

Returns

the epilogue string, or NULL if absent.

[nullable][transfer none]


g_mime_multipart_set_boundary ()

void
g_mime_multipart_set_boundary (GMimeMultipart *multipart,
                               const char *boundary);

Sets boundary as the boundary on the multipart. If boundary is NULL, then a boundary will be auto-generated for you. Valid boundary values are preserved without trimming, including leading spaces.

Parameters

multipart

a GMimeMultipart object

 

boundary

a valid MIME boundary (1 to 70 ASCII characters), or NULL to autogenerate one

 

g_mime_multipart_get_boundary ()

const char *
g_mime_multipart_get_boundary (GMimeMultipart *multipart);

Gets the boundary on the multipart. If the internal boundary is NULL, then an auto-generated boundary will be set on the multipart and returned.

Parameters

multipart

a GMimeMultipart object

 

Returns

the boundary on the multipart.


g_mime_multipart_get_count ()

int
g_mime_multipart_get_count (GMimeMultipart *multipart);

Gets the number of parts contained within multipart .

Parameters

multipart

a GMimeMultipart object

 

Returns

the number of parts contained within multipart .


g_mime_multipart_contains ()

gboolean
g_mime_multipart_contains (GMimeMultipart *multipart,
                           GMimeEntity *part);

Checks if part is contained within multipart .

Parameters

multipart

a GMimeMultipart object

 

part

a GMimeEntity

 

Returns

TRUE if part is a subpart of multipart or FALSE otherwise.


g_mime_multipart_index_of ()

int
g_mime_multipart_index_of (GMimeMultipart *multipart,
                           GMimeEntity *part);

Gets the 0-based index of part within multipart .

Parameters

multipart

a GMimeMultipart object

 

part

a GMimeEntity

 

Returns

the 0-based index of part within multipart or -1 if not found.


g_mime_multipart_add ()

void
g_mime_multipart_add (GMimeMultipart *multipart,
                      GMimeEntity *part);

Appends a mime part to multipart .

Parameters

multipart

a GMimeMultipart object

 

part

a GMimeEntity

 

g_mime_multipart_clear ()

void
g_mime_multipart_clear (GMimeMultipart *multipart);

Removes all subparts from multipart .

Parameters

multipart

a GMimeMultipart object

 

g_mime_multipart_insert ()

void
g_mime_multipart_insert (GMimeMultipart *multipart,
                         int index,
                         GMimeEntity *part);

Inserts part into multipart at the specified index .

Parameters

multipart

a GMimeMultipart object

 

part

a GMimeEntity

 

index

an index between zero and the part count, inclusive

 

g_mime_multipart_remove ()

gboolean
g_mime_multipart_remove (GMimeMultipart *multipart,
                         GMimeEntity *part);

Removes the specified part from multipart .

Parameters

multipart

a GMimeMultipart object

 

part

a GMimeEntity

 

Returns

TRUE if the part was removed or FALSE otherwise.


g_mime_multipart_remove_at ()

GMimeEntity *
g_mime_multipart_remove_at (GMimeMultipart *multipart,
                            int index);

Removes the part at the specified index from multipart .

Parameters

multipart

a GMimeMultipart object

 

index

the 0-based index of the part to remove

 

Returns

the mime part that was removed or NULL if the part was not contained within the multipart.

[transfer full]


g_mime_multipart_replace ()

GMimeEntity *
g_mime_multipart_replace (GMimeMultipart *multipart,
                          int index,
                          GMimeEntity *replacement);

Replaces the part at the specified index within multipart with replacement .

Parameters

multipart

a GMimeMultipart object

 

index

the 0-based index of the part to replace

 

replacement

a GMimeEntity to use as the replacement

 

Returns

the part that was replaced or NULL if the part was not contained within the multipart.

[transfer full]


g_mime_multipart_get_part ()

GMimeEntity *
g_mime_multipart_get_part (GMimeMultipart *multipart,
                           int index);

Gets the part at the specified index within the multipart.

Parameters

multipart

a GMimeMultipart object

 

index

the 0-based index of the part

 

Returns

the part at position index .

[transfer none]


g_mime_multipart_try_get_value ()

gboolean
g_mime_multipart_try_get_value (GMimeMultipart *multipart,
                                GMimeTextFormat format,
                                GMimeTextPart **body);

Finds a body part in format without decoding or copying its content. The default implementation scans forwards, skipping non-text parts and attached text parts. It stops after the first nested multipart, even if that multipart has no match, or the first non-attachment text part, even if it has the wrong format. Embedded messages are not entered.

Subclasses may override selection. GMimeMultipartAlternative searches backwards and considers attached text parts. Selection follows the object's class, not changes to its Content-Type subtype.

Plain format also matches flowed text. Compressed rich text and unknown formats do not match any text part. No match returns FALSE and sets body to NULL.

Parameters

multipart

a GMimeMultipart

 

format

the requested text format

 

body

the selected original text part.

[out][nullable][transfer none]

Returns

TRUE if a text part was found, otherwise FALSE.


g_mime_multipart_foreach ()

void
g_mime_multipart_foreach (GMimeMultipart *multipart,
                          GMimeEntityForeachFunc callback,
                          gpointer user_data);

Recursively calls callback on each of multipart 's subparts.

Parameters

multipart

a GMimeMultipart

 

callback

function to call for each of multipart 's subparts.

[scope call]

user_data

user-supplied callback data

 

g_mime_multipart_get_subpart_from_content_id ()

GMimeEntity *
g_mime_multipart_get_subpart_from_content_id
                               (GMimeMultipart *multipart,
                                const char *content_id);

Gets the mime part with the content-id content_id from the multipart multipart .

Parameters

multipart

a multipart

 

content_id

the content id of the part to look for

 

Returns

the GMimeEntity whose content-id matches the search string, or NULL if a match cannot be found.

[transfer none]

Types and Values

GMimeMultipart

typedef struct _GMimeMultipart GMimeMultipart;

A base MIME multipart object.