GMimeMultipartRelated

GMimeMultipartRelated — Related MIME parts with a root document

Functions

Types and Values

Description

A multipart/related container with root-document selection.

Functions

g_mime_multipart_related_new ()

GMimeMultipartRelated *
g_mime_multipart_related_new (void);

Creates an empty multipart/related container.


g_mime_multipart_related_get_root ()

GMimeEntity *
g_mime_multipart_related_get_root (GMimeMultipartRelated *related);

Selects the immediate child identified by the Content-Type start parameter. If start is absent, selects the first child matching the type parameter, ignoring ASCII case. An unmatched selector falls back to the first child. This does not modify headers or traverse descendants.

Parameters

related

a GMimeMultipartRelated

 

Returns

the root document, or NULL if empty.

[nullable][transfer none]


g_mime_multipart_related_set_root ()

void
g_mime_multipart_related_set_root (GMimeMultipartRelated *related,
                                   GMimeEntity *root);

Replaces the explicitly selected child, or inserts root first if no selector matches. Sets the type parameter to the root's MIME type. A root at index zero removes start; a later root uses its Content-Id, generating one if necessary. The container retains root without removing other occurrences of that entity from the child list.

Parameters

related

a GMimeMultipartRelated

 

root

the new root document.

[transfer none]

g_mime_multipart_related_index_of_uri ()

int
g_mime_multipart_related_index_of_uri (GMimeMultipartRelated *related,
                                       const char *uri,
                                       GError **error);

Finds the first immediate child matching uri . CID URIs compare their escaped path to Content-Id, case-sensitively. Other absolute URIs match Content-Location, resolving relative locations against the child's Content-Base, or the container's Content-Base if the child has none. Relative queries compare literal relative Content-Location strings.

Absolute comparisons use GLib URI normalization, ignore user information and fragments, and compare scheme and host ignoring ASCII case. Paths and queries remain case-sensitive. No network or filesystem access occurs.

Parameters

related

a GMimeMultipartRelated

 

uri

an absolute or relative UTF-8 URI string

 

error

return location for an error, or NULL

 

Returns

the child index, or -1 if not found or if parsing or resolution fails. On failure error is set; a missing resource is not an error.


g_mime_multipart_related_contains_uri ()

gboolean
g_mime_multipart_related_contains_uri (GMimeMultipartRelated *related,
                                       const char *uri,
                                       GError **error);

Tests whether g_mime_multipart_related_index_of_uri() finds a resource.

Parameters

related

a GMimeMultipartRelated

 

uri

an absolute or relative UTF-8 URI string

 

error

return location for an error, or NULL

 

Returns

TRUE if a matching child exists, otherwise FALSE.


g_mime_multipart_related_open ()

GMimeStream *
g_mime_multipart_related_open (GMimeMultipartRelated *related,
                               const char *uri,
                               char **mime_type,
                               char **charset,
                               GError **error);

Opens a lazy decoded reader for the first matching child. A missing resource, non-leaf child, or leaf without content reports GMIME_ERROR with ENOENT. A content object without a backing stream reports GMIME_ERROR_INVALID_OPERATION. URI parsing/resolution and backing-stream rewind errors are propagated. Both metadata outputs are NULL on failure.

The stream retains its source, not the multipart or child. Reader state, backing-stream position, and subsequent read errors follow g_mime_content_open(). No external URI is fetched.

Parameters

related

a GMimeMultipartRelated

 

uri

an absolute or relative UTF-8 URI string

 

mime_type

the allocated MIME type.

[out][optional][nullable][transfer full]

charset

the allocated charset, if present.

[out][optional][nullable][transfer full]

error

return location for an error, or NULL

 

Returns

a decoded stream, or NULL on error.

[nullable][transfer full]

Types and Values

GMimeMultipartRelated

typedef struct _GMimeMultipartRelated GMimeMultipartRelated;

A multipart/related whose root document references its other parts.

See Also

GMimeMultipart