| Top |
A GMimeContentDisposition represents the pre-parsed contents of a Content-Disposition header field.
GMimeContentDisposition *
g_mime_content_disposition_new (void);
Creates a new GMimeContentDisposition object.
GMimeContentDisposition * g_mime_content_disposition_parse (GMimeParserOptions *options,const char *str);
Parses the input string using best-effort recovery, accepting arbitrary
disposition text and retaining partial parameters. Use
g_mime_content_disposition_parse_full() for all-or-nothing parsing.
GMimeContentDisposition * g_mime_content_disposition_parse_full (GMimeParserOptions *options,const char *str,gssize length,GError **error);
Parses the complete input without recovering missing or quoted disposition
tokens or ignoring malformed parameters. Syntax errors return NULL with
GMIME_ERROR_PARSE_ERROR and a byte offset relative to str
.
Explicitly bounded input need not be NUL-terminated but cannot contain
embedded NUL bytes.
Comments and whitespace are accepted around the disposition atom.
Each non-ASCII atom byte becomes '?' following ASCII decoding.
Parameters use the compliance and duplicate precedence rules of
g_mime_param_list_parse_full().
GMimeContentDisposition *
g_mime_content_disposition_clone (GMimeContentDisposition *disposition);
Copies the disposition and all parameters, including their charset, language, encoding method, and quoting preference. Parameters are copied independently in their original order, retaining spelling and any duplicate names recovered by legacy parsing. Legacy disposition text is preserved.
char *
g_mime_content_disposition_to_string (GMimeContentDisposition *disposition);
Formats a display string beginning with "Content-Disposition: ".
Parameter values are always quoted and escaped, without transport
encoding, folding, or an appended newline. This is not a transport-safe
header; use g_mime_content_disposition_encode() when serializing a MIME
message.
gboolean
g_mime_content_disposition_is_attachment
(GMimeContentDisposition *disposition);
Determines if a Content-Disposition has a value of "attachment".
void g_mime_content_disposition_set_is_attachment (GMimeContentDisposition *disposition,gboolean attachment);
Sets the disposition to the lowercase "attachment" or "inline" token. Existing parameters are retained. Changes notify owning entities, while assigning an identical token leaves raw headers untouched.
void g_mime_content_disposition_set_disposition (GMimeContentDisposition *disposition,const char *value);
Sets the disposition to value
which may be one of
GMIME_DISPOSITION_ATTACHMENT or GMIME_DISPOSITION_INLINE or, by
your choice, any other string which would indicate how the MIME
part should be displayed by the MUA.
const char *
g_mime_content_disposition_get_disposition
(GMimeContentDisposition *disposition);
Gets the disposition or NULL on fail.
the disposition string which is probably one of GMIME_DISPOSITION_ATTACHMENT or GMIME_DISPOSITION_INLINE.
const char *
g_mime_content_disposition_get_filename
(GMimeContentDisposition *disposition);
Gets the filename parameter without falling back to an owning entity's Content-Type name parameter.
void g_mime_content_disposition_set_filename (GMimeContentDisposition *disposition,const char *filename);
Sets the filename parameter without trimming or otherwise normalizing it. An empty string remains an explicit empty value. This does not also set the name parameter on an owning entity's Content-Type.
GDateTime *
g_mime_content_disposition_get_creation_date
(GMimeContentDisposition *disposition);
Decodes the creation-date parameter without modifying its stored text.
void g_mime_content_disposition_set_creation_date (GMimeContentDisposition *disposition,GDateTime *date);
Sets the creation-date parameter using g_mime_utils_header_format_date().
The date is formatted to whole seconds; no reference to date
is retained.
Existing parameter metadata is preserved and changes notify owning entities.
GDateTime *
g_mime_content_disposition_get_modification_date
(GMimeContentDisposition *disposition);
Decodes the modification-date parameter without modifying its stored text.
void g_mime_content_disposition_set_modification_date (GMimeContentDisposition *disposition,GDateTime *date);
Sets the modification-date parameter using g_mime_utils_header_format_date().
The date is formatted to whole seconds; no reference to date
is retained.
Existing parameter metadata is preserved and changes notify owning entities.
GDateTime *
g_mime_content_disposition_get_read_date
(GMimeContentDisposition *disposition);
Decodes the read-date parameter without modifying its stored text.
void g_mime_content_disposition_set_read_date (GMimeContentDisposition *disposition,GDateTime *date);
Sets the read-date parameter using g_mime_utils_header_format_date().
The date is formatted to whole seconds; no reference to date
is retained.
Existing parameter metadata is preserved and changes notify owning entities.
gint64
g_mime_content_disposition_get_size (GMimeContentDisposition *disposition);
Gets the size parameter without modifying its stored text. Only ASCII
decimal digits are accepted; signs, whitespace, and values greater than
G_MAXINT64 are invalid. Leading zeros are allowed.
void g_mime_content_disposition_set_size (GMimeContentDisposition *disposition,gint64 size);
Sets the size parameter to a nonnegative decimal integer. Values below -1 are invalid. Existing parameter metadata is preserved and changes notify owning entities.
GMimeParamList *
g_mime_content_disposition_get_parameters
(GMimeContentDisposition *disposition);
Gets the Content-Disposition parameter list.
void g_mime_content_disposition_set_parameter (GMimeContentDisposition *disposition,const char *name,const char *value);
Sets a parameter on the Content-Disposition.
Note: The name
should be in US-ASCII while the value
should be in
UTF-8.
const char * g_mime_content_disposition_get_parameter (GMimeContentDisposition *disposition,const char *name);
Gets the parameter value specified by name
if it's available.
char * g_mime_content_disposition_encode (GMimeContentDisposition *disposition,GMimeFormatOptions *options);
Encodes the Content-Disposition field value, including leading whitespace and a terminating newline. The field name is not included.
disposition |
a GMimeContentDisposition object |
|
options |
a GMimeFormatOptions or |
[nullable] |