GMimeMessagePartial

GMimeMessagePartial — Partial MIME parts

Functions

Types and Values

Description

A GMimeMessagePartial represents the message/partial MIME part.

Functions

g_mime_message_partial_new ()

GMimeMessagePartial *
g_mime_message_partial_new (const char *id,
                            int number,
                            int total);

Creates a new MIME message/partial object. The id may be empty, but must be a non-NULL UTF-8 string.

Parameters

id

message/partial part id

 

number

message/partial part number, starting at 1

 

total

total number of message/partial parts, at least number

 

Returns

an empty MIME message/partial object.


g_mime_message_partial_get_id ()

const char *
g_mime_message_partial_get_id (GMimeMessagePartial *partial);

Gets the message/partial id parameter value.

Parameters

partial

message/partial object

 

Returns

the borrowed message/partial id, or NULL if absent. The value is valid until the Content-Type or its parameters change.

[nullable]


g_mime_message_partial_get_number ()

int
g_mime_message_partial_get_number (GMimeMessagePartial *partial);

Gets the message/partial part number.

Parameters

partial

message/partial object

 

Returns

the message/partial part number or -1 if absent, malformed, or outside the nonnegative 32-bit integer range. Surrounding ASCII linear whitespace is allowed, but signs and trailing non-whitespace are not.


g_mime_message_partial_get_total ()

int
g_mime_message_partial_get_total (GMimeMessagePartial *partial);

Gets the total number of message/partial parts needed to reconstruct the original message.

Parameters

partial

message/partial object

 

Returns

the total number of message/partial parts needed to reconstruct the original message or -1 if absent, malformed, or outside the nonnegative 32-bit integer range. Surrounding ASCII linear whitespace is allowed, but signs and trailing non-whitespace are not.


g_mime_message_partial_join ()

GMimeMessage *
g_mime_message_partial_join (GMimeParserOptions *options,
                             GMimeMessage *message,
                             GMimeMessagePartial **partials,
                             size_t num,
                             GError **error);

Reconstructs the GMimeMessage from the given message/partial parts in partials without changing their order in the caller's array. Each fragment's content is decoded before concatenation; fragments without content contribute no bytes. Only the last fragment is required to specify the total number of parts. Parsed body content is stored in memory rather than as substreams of the decoded readers. Envelope headers are combined with those from message using RFC 2046 rules. The source message and fragments are not changed. Matching absent fragment ids are permitted.

Parameters

options

parser options, or NULL for the defaults.

[nullable]

message

the message containing the first numbered fragment

 

partials

an array of message/partial mime parts, or NULL when num is zero.

[nullable][array length=num][element-type GMimeMessagePartial]

num

the number of elements in partials

 

error

return location for a GError.

[nullable]

Returns

the joined message, or NULL for an empty array or on failure. Invalid fragment metadata and I/O or parsing failures set error ; an empty array does not.

[nullable][transfer full]


g_mime_message_partial_split ()

GMimeMessage **
g_mime_message_partial_split (GMimeMessage *message,
                              size_t max_size,
                              size_t *nparts,
                              GError **error);

Splits message into an array of GMimeMessage objects each containing a single GMimeMessagePartial object containing max_size bytes or fewer, preferring whole lines. A newline at the target boundary is included in the preceding fragment, which can make it one byte larger. nparts is set to the number of messages returned. If no splitting is needed, the returned array contains a reference to the original message.

Each fragment message has a new Message-Id, distinct from the original and from the id shared by the message/partial bodies. The original headers are otherwise cloned without changing the source message. The serialized fragment payload excludes envelope headers, including unrecognized extension fields; join() restores them from the first enclosing message.

Parameters

message

message object

 

max_size

positive target size for each fragment

 

nparts

number of parts.

[out]

error

return location for a GError.

[nullable]

Returns

an array of GMimeMessage objects and sets nparts to the number of messages returned or NULL on fail.

[nullable][transfer full][array length=nparts]

Types and Values

GMimeMessagePartial

typedef struct _GMimeMessagePartial GMimeMessagePartial;

A message/partial MIME part.