GMimeObject

GMimeObject — Abstract Mime objects

Synopsis




                    GMimeObject;
void                (*GMimePartFunc)                    (GMimeObject *part,
                                                         gpointer user_data);
void                g_mime_object_register_type         (const char *type,
                                                         const char *subtype,
                                                         GType object_type);
GMimeObject*        g_mime_object_new_type              (const char *type,
                                                         const char *subtype);
void                g_mime_object_set_content_type      (GMimeObject *object,
                                                         GMimeContentType *mime_type);
const GMimeContentType* g_mime_object_get_content_type  (GMimeObject *object);
void                g_mime_object_set_content_type_parameter
                                                        (GMimeObject *object,
                                                         const char *name,
                                                         const char *value);
const char*         g_mime_object_get_content_type_parameter
                                                        (GMimeObject *object,
                                                         const char *name);
void                g_mime_object_set_disposition       (GMimeObject *object,
                                                         const char *disposition);
const char*         g_mime_object_get_disposition       (GMimeObject *object);
void                g_mime_object_set_content_disposition
                                                        (GMimeObject *object,
                                                         GMimeContentDisposition *disposition);
const GMimeContentDisposition* g_mime_object_get_content_disposition
                                                        (GMimeObject *object);
void                g_mime_object_set_content_disposition_parameter
                                                        (GMimeObject *object,
                                                         const char *attribute,
                                                         const char *value);
const char*         g_mime_object_get_content_disposition_parameter
                                                        (GMimeObject *object,
                                                         const char *attribute);
void                g_mime_object_set_content_id        (GMimeObject *object,
                                                         const char *content_id);
const char*         g_mime_object_get_content_id        (GMimeObject *object);
void                g_mime_object_add_header            (GMimeObject *object,
                                                         const char *header,
                                                         const char *value);
void                g_mime_object_set_header            (GMimeObject *object,
                                                         const char *header,
                                                         const char *value);
const char*         g_mime_object_get_header            (GMimeObject *object,
                                                         const char *header);
void                g_mime_object_remove_header         (GMimeObject *object,
                                                         const char *header);
char*               g_mime_object_get_headers           (GMimeObject *object);
ssize_t             g_mime_object_write_to_stream       (GMimeObject *object,
                                                         GMimeStream *stream);
char*               g_mime_object_to_string             (GMimeObject *object);


Object Hierarchy


  GObject
   +----GMimeObject
         +----GMimePart
         +----GMimeMultipart
         +----GMimeMessagePart
         +----GMimeMessage

Description

GMimeObject is an abstract class from which all Message and Mime parts are derived.

Details

GMimeObject

typedef struct _GMimeObject GMimeObject;


GMimePartFunc ()

void                (*GMimePartFunc)                    (GMimeObject *part,
                                                         gpointer user_data);

The function signature for a callback to g_mime_message_foreach_part() and g_mime_multipart_foreach().

part :

A MIME part.

user_data :

User-supplied callback data.

g_mime_object_register_type ()

void                g_mime_object_register_type         (const char *type,
                                                         const char *subtype,
                                                         GType object_type);

Registers the object type object_type for use with the g_mime_object_new_type() convenience function.

Note: You may use the wildcard "*" to match any type and/or subtype.

type :

mime type

subtype :

mime subtype

object_type :

object type

g_mime_object_new_type ()

GMimeObject*        g_mime_object_new_type              (const char *type,
                                                         const char *subtype);

Performs a lookup of registered GMimeObject subclasses, registered using g_mime_object_register_type(), to find an appropriate class capable of handling Mime parts of type type/subtype. If no class has been registered to handle that type, it looks for a registered class that can handle type. If that also fails, then it will use the generic part class, GMimePart.

type :

mime type

subtype :

mime subtype

Returns :

an appropriate GMimeObject registered to handle mime-types of type/subtype.

g_mime_object_set_content_type ()

void                g_mime_object_set_content_type      (GMimeObject *object,
                                                         GMimeContentType *mime_type);

Sets the content-type for the specified Mime object.

object :

Mime object

mime_type :

Mime type

g_mime_object_get_content_type ()

const GMimeContentType* g_mime_object_get_content_type  (GMimeObject *object);

Gets the Content-Type object for the given Mime object or NULL on fail.

object :

Mime object

Returns :

the content-type object for the specified Mime object.

g_mime_object_set_content_type_parameter ()

void                g_mime_object_set_content_type_parameter
                                                        (GMimeObject *object,
                                                         const char *name,
                                                         const char *value);

Sets the content-type param name to the value value.

object :

Mime object

name :

param name

value :

param value

g_mime_object_get_content_type_parameter ()

const char*         g_mime_object_get_content_type_parameter
                                                        (GMimeObject *object,
                                                         const char *name);

Gets the value of the content-type param name set on the Mime part object.

object :

Mime object

name :

param name

Returns :

the value of the requested content-type param or NULL on if the param doesn't exist.

g_mime_object_set_disposition ()

void                g_mime_object_set_disposition       (GMimeObject *object,
                                                         const char *disposition);

Sets the disposition to disposition 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.

object :

Mime object

disposition :

disposition ("attachment" or "inline")

g_mime_object_get_disposition ()

const char*         g_mime_object_get_disposition       (GMimeObject *object);

Gets the Mime object's disposition if set or NULL otherwise.

object :

Mime object

Returns :

the disposition string which is probably one of GMIME_DISPOSITION_ATTACHMENT or GMIME_DISPOSITION_INLINE.

g_mime_object_set_content_disposition ()

void                g_mime_object_set_content_disposition
                                                        (GMimeObject *object,
                                                         GMimeContentDisposition *disposition);

Set the content disposition for the specified mime part.

object :

Mime object

disposition :

a GMimeContentDisposition object

g_mime_object_get_content_disposition ()

const GMimeContentDisposition* g_mime_object_get_content_disposition
                                                        (GMimeObject *object);

Get the content disposition for the specified Mime object.

object :

Mime object

Returns :

the GMimeContentDisposition set on the Mime object.

g_mime_object_set_content_disposition_parameter ()

void                g_mime_object_set_content_disposition_parameter
                                                        (GMimeObject *object,
                                                         const char *attribute,
                                                         const char *value);

Add a content-disposition parameter to the specified mime part.

object :

Mime object

attribute :

parameter name

value :

parameter value

g_mime_object_get_content_disposition_parameter ()

const char*         g_mime_object_get_content_disposition_parameter
                                                        (GMimeObject *object,
                                                         const char *attribute);

Gets the value of the Content-Disposition parameter specified by attribute, or NULL if the parameter does not exist.

object :

Mime object

attribute :

parameter name

Returns :

the value of a previously defined content-disposition parameter specified by attribute.

g_mime_object_set_content_id ()

void                g_mime_object_set_content_id        (GMimeObject *object,
                                                         const char *content_id);

Sets the Content-Id of the Mime object.

object :

Mime object

content_id :

content-id (addr-spec portion)

g_mime_object_get_content_id ()

const char*         g_mime_object_get_content_id        (GMimeObject *object);

Gets the Content-Id of the Mime object or NULL if one is not set.

object :

Mime object

Returns :

a const pointer to the Content-Id header.

g_mime_object_add_header ()

void                g_mime_object_add_header            (GMimeObject *object,
                                                         const char *header,
                                                         const char *value);

Adds an arbitrary header to the Mime object.

object :

mime object

header :

header name

value :

header value

g_mime_object_set_header ()

void                g_mime_object_set_header            (GMimeObject *object,
                                                         const char *header,
                                                         const char *value);

Sets an arbitrary header on the Mime object.

object :

mime object

header :

header name

value :

header value

g_mime_object_get_header ()

const char*         g_mime_object_get_header            (GMimeObject *object,
                                                         const char *header);

Gets the value of the requested header if it exists or NULL otherwise.

object :

mime object

header :

header name

Returns :

the value of the header header if it exists or NULL otherwise.

g_mime_object_remove_header ()

void                g_mime_object_remove_header         (GMimeObject *object,
                                                         const char *header);

Removed the specified header if it exists.

object :

mime object

header :

header name

g_mime_object_get_headers ()

char*               g_mime_object_get_headers           (GMimeObject *object);

Allocates a string buffer containing all of the Mime object's raw headers.

object :

mime object

Returns :

an allocated string containing all of the raw Mime headers.

g_mime_object_write_to_stream ()

ssize_t             g_mime_object_write_to_stream       (GMimeObject *object,
                                                         GMimeStream *stream);

Write the contents of the Mime object to stream.

object :

mime object

stream :

stream

Returns :

-1 on fail.

g_mime_object_to_string ()

char*               g_mime_object_to_string             (GMimeObject *object);

Allocates a string buffer containing the contents of object.

object :

mime object

Returns :

an allocated string containing the contents of the mime object.