gmime-part

Name

gmime-part -- 

Synopsis



enum        GMimePartEncodingType;
struct      GMimePartDispositionParam;
struct      GMimePartDisposition;
struct      GMimePart;
void        (*GMimePartFunc)                (GMimePart *part,
                                             gpointer data);
GMimePart*  g_mime_part_new                 (void);
GMimePart*  g_mime_part_new_with_type       (const gchar *type,
                                             const gchar *subtype);
void        g_mime_part_destroy             (GMimePart *mime_part);
void        g_mime_part_set_content_description
                                            (GMimePart *mime_part,
                                             const gchar *description);
const gchar* g_mime_part_get_content_description
                                            (const GMimePart *mime_part);
void        g_mime_part_set_content_id      (GMimePart *mime_part,
                                             const gchar *content_id);
const gchar* g_mime_part_get_content_id     (GMimePart *mime_part);
void        g_mime_part_set_content_md5     (GMimePart *mime_part,
                                             const gchar *content_md5);
const gchar* g_mime_part_get_content_md5    (GMimePart *mime_part);
gboolean    g_mime_part_verify_content_md5  (GMimePart *mime_part);
void        g_mime_part_set_content_location
                                            (GMimePart *mime_part,
                                             const gchar *content_location);
const gchar* g_mime_part_get_content_location
                                            (GMimePart *mime_part);
void        g_mime_part_set_content_type    (GMimePart *mime_part,
                                             GMimeContentType *mime_type);
const GMimeContentType* g_mime_part_get_content_type
                                            (GMimePart *mime_part);
void        g_mime_part_set_encoding        (GMimePart *mime_part,
                                             GMimePartEncodingType encoding);
GMimePartEncodingType g_mime_part_get_encoding
                                            (GMimePart *mime_part);
const gchar* g_mime_part_encoding_to_string (GMimePartEncodingType encoding);
GMimePartEncodingType g_mime_part_encoding_from_string
                                            (const gchar *encoding);
void        g_mime_part_set_content_disposition
                                            (GMimePart *mime_part,
                                             const gchar *disposition);
const gchar* g_mime_part_get_content_disposition
                                            (GMimePart *mime_part);
void        g_mime_part_add_content_disposition_parameter
                                            (GMimePart *mime_part,
                                             const gchar *name,
                                             const gchar *value);
const gchar* g_mime_part_get_content_disposition_parameter
                                            (GMimePart *mime_part,
                                             const gchar *name);
void        g_mime_part_set_filename        (GMimePart *mime_part,
                                             const gchar *filename);
const gchar* g_mime_part_get_filename       (GMimePart *mime_part);
void        g_mime_part_set_boundary        (GMimePart *mime_part,
                                             const gchar *boundary);
const gchar* g_mime_part_get_boundary       (GMimePart *mime_part);
void        g_mime_part_set_content         (GMimePart *mime_part,
                                             const char *content,
                                             guint len);
void        g_mime_part_set_pre_encoded_content
                                            (GMimePart *mime_part,
                                             const char *content,
                                             guint len,
                                             GMimePartEncodingType encoding);
const gchar* g_mime_part_get_content        (const GMimePart *mime_part,
                                             guint *len);
void        g_mime_part_add_subpart         (GMimePart *mime_part,
                                             GMimePart *subpart);
#define     g_mime_part_add_child           (mime_part, child)
gchar*      g_mime_part_to_string           (GMimePart *mime_part,
                                             gboolean toplevel);
void        g_mime_part_foreach             (GMimePart *mime_part,
                                             GMimePartFunc callback,
                                             gpointer data);
const GMimePart* g_mime_part_get_subpart_from_content_id
                                            (GMimePart *mime_part,
                                             const gchar *content_id);

Description

Details

enum GMimePartEncodingType

typedef enum {
        GMIME_PART_ENCODING_DEFAULT,
        GMIME_PART_ENCODING_7BIT,
        GMIME_PART_ENCODING_8BIT,
        GMIME_PART_ENCODING_BASE64,
        GMIME_PART_ENCODING_QUOTEDPRINTABLE,
        GMIME_PART_NUM_ENCODINGS
} GMimePartEncodingType;


struct GMimePartDispositionParam

struct GMimePartDispositionParam;


struct GMimePartDisposition

struct GMimePartDisposition {
	gchar *disposition;
	GList *params;     /* of type GMimeParam */
	GHashTable *param_hash;
};


struct GMimePart

struct GMimePart {
	GMimeContentType *mime_type;
	GMimePartEncodingType encoding;
	GMimePartDisposition *disposition;
	gchar *description;
	gchar *content_id;
	gchar *content_md5;
	gchar *content_location;
	
	GByteArray *content;
	
	GList *children;   /* of type GMimePart */
};


GMimePartFunc ()

void        (*GMimePartFunc)                (GMimePart *part,
                                             gpointer data);

part : 
data : 


g_mime_part_new ()

GMimePart*  g_mime_part_new                 (void);

Returns :an empty MIME Part object with a default content-type of text/plain.


g_mime_part_new_with_type ()

GMimePart*  g_mime_part_new_with_type       (const gchar *type,
                                             const gchar *subtype);

type : content-type
subtype : content-subtype
Returns :an empty MIME Part object with the specified content-type.


g_mime_part_destroy ()

void        g_mime_part_destroy             (GMimePart *mime_part);

Releases all memory used by this mime part and all child mime parts.

mime_part : Mime part to destroy


g_mime_part_set_content_description ()

void        g_mime_part_set_content_description
                                            (GMimePart *mime_part,
                                             const gchar *description);

Set the content description for the specified mime part.

mime_part : Mime part
description : content description


g_mime_part_get_content_description ()

const gchar* g_mime_part_get_content_description
                                            (const GMimePart *mime_part);

mime_part : Mime part
Returns :the content description for the specified mime part.


g_mime_part_set_content_id ()

void        g_mime_part_set_content_id      (GMimePart *mime_part,
                                             const gchar *content_id);

Set the content id for the specified mime part.

mime_part : Mime part
content_id : content id


g_mime_part_get_content_id ()

const gchar* g_mime_part_get_content_id     (GMimePart *mime_part);

mime_part : Mime part
Returns :the content id for the specified mime part.


g_mime_part_set_content_md5 ()

void        g_mime_part_set_content_md5     (GMimePart *mime_part,
                                             const gchar *content_md5);

Set the content md5 for the specified mime part.

mime_part : Mime part
content_md5 : content md5 or NULL to generate the md5 digest.


g_mime_part_get_content_md5 ()

const gchar* g_mime_part_get_content_md5    (GMimePart *mime_part);

mime_part : Mime part
Returns :the content md5 for the specified mime part.


g_mime_part_verify_content_md5 ()

gboolean    g_mime_part_verify_content_md5  (GMimePart *mime_part);

Verify the content md5 for the specified mime part.

mime_part : Mime part
Returns :TRUE if the md5 is valid or FALSE otherwise. Note: will return FALSE if the mime part does not contain a Content-MD5.


g_mime_part_set_content_location ()

void        g_mime_part_set_content_location
                                            (GMimePart *mime_part,
                                             const gchar *content_location);

Set the content location for the specified mime part.

mime_part : Mime part
content_location : content location


g_mime_part_get_content_location ()

const gchar* g_mime_part_get_content_location
                                            (GMimePart *mime_part);

mime_part : Mime part
Returns :the content location for the specified mime part.


g_mime_part_set_content_type ()

void        g_mime_part_set_content_type    (GMimePart *mime_part,
                                             GMimeContentType *mime_type);

Set the content type/subtype for the specified mime part.

mime_part : Mime part
mime_type : Mime content-type


g_mime_part_get_content_type ()

const GMimeContentType* g_mime_part_get_content_type
                                            (GMimePart *mime_part);

mime_part : Mime part
Returns :the content-type object for the specified mime part.


g_mime_part_set_encoding ()

void        g_mime_part_set_encoding        (GMimePart *mime_part,
                                             GMimePartEncodingType encoding);

Set the content encoding for the specified mime part. Available values for the encoding are: GMIME_PART_ENCODING_DEFAULT, GMIME_PART_ENCODING_7BIT, GMIME_PART_ENCODING_8BIT, GMIME_PART_ENCODING_BASE64 and GMIME_PART_ENCODING_QUOTEDPRINTABLE.

mime_part : Mime part
encoding : Mime encoding


g_mime_part_get_encoding ()

GMimePartEncodingType g_mime_part_get_encoding
                                            (GMimePart *mime_part);

mime_part : Mime part
Returns :the content encoding for the specified mime part. The return value will be one of the following: GMIME_PART_ENCODING_DEFAULT, GMIME_PART_ENCODING_7BIT, GMIME_PART_ENCODING_8BIT, GMIME_PART_ENCODING_BASE64 or GMIME_PART_ENCODING_QUOTEDPRINTABLE.


g_mime_part_encoding_to_string ()

const gchar* g_mime_part_encoding_to_string (GMimePartEncodingType encoding);

encoding : Mime encoding
Returns :the encoding type as a string. Available values for the encoding are: GMIME_PART_ENCODING_DEFAULT, GMIME_PART_ENCODING_7BIT, GMIME_PART_ENCODING_8BIT, GMIME_PART_ENCODING_BASE64 and GMIME_PART_ENCODING_QUOTEDPRINTABLE.


g_mime_part_encoding_from_string ()

GMimePartEncodingType g_mime_part_encoding_from_string
                                            (const gchar *encoding);

encoding : Mime encoding in string format
Returns :the encoding string as a GMimePartEncodingType. Available values for the encoding are: GMIME_PART_ENCODING_DEFAULT, GMIME_PART_ENCODING_7BIT, GMIME_PART_ENCODING_8BIT, GMIME_PART_ENCODING_BASE64 and GMIME_PART_ENCODING_QUOTEDPRINTABLE.


g_mime_part_set_content_disposition ()

void        g_mime_part_set_content_disposition
                                            (GMimePart *mime_part,
                                             const gchar *disposition);

Set the content disposition for the specified mime part

mime_part : Mime part
disposition : content disposition


g_mime_part_get_content_disposition ()

const gchar* g_mime_part_get_content_disposition
                                            (GMimePart *mime_part);

mime_part : Mime part
Returns :the content disposition for the specified mime part.


g_mime_part_add_content_disposition_parameter ()

void        g_mime_part_add_content_disposition_parameter
                                            (GMimePart *mime_part,
                                             const gchar *name,
                                             const gchar *value);

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

mime_part : Mime part
name : parameter name
value : parameter value


g_mime_part_get_content_disposition_parameter ()

const gchar* g_mime_part_get_content_disposition_parameter
                                            (GMimePart *mime_part,
                                             const gchar *name);

mime_part : Mime part
name : parameter name
Returns :the value of a previously defined content-disposition parameter specified by name.


g_mime_part_set_filename ()

void        g_mime_part_set_filename        (GMimePart *mime_part,
                                             const gchar *filename);

Sets the "filename" parameter on the Content-Disposition and also sets the "name" parameter on the Content-Type.

mime_part : Mime part
filename : the filename of the Mime Part's content


g_mime_part_get_filename ()

const gchar* g_mime_part_get_filename       (GMimePart *mime_part);

mime_part : Mime part
Returns :the filename of the specified MIME Part. It first checks to see if the "filename" parameter was set on the Content-Disposition and if not then checks the "name" parameter in the Content-Type.


g_mime_part_set_boundary ()

void        g_mime_part_set_boundary        (GMimePart *mime_part,
                                             const gchar *boundary);

Sets the boundary on the mime part.

mime_part : Mime part
boundary : the boundary for the multi-part or NULL to generate a random one.


g_mime_part_get_boundary ()

const gchar* g_mime_part_get_boundary       (GMimePart *mime_part);

mime_part : Mime part
Returns :the boundary on the mime part.


g_mime_part_set_content ()

void        g_mime_part_set_content         (GMimePart *mime_part,
                                             const char *content,
                                             guint len);

Sets the content of the Mime Part (only non-multiparts)

mime_part : Mime part
content : raw mime part content
len : raw content length


g_mime_part_set_pre_encoded_content ()

void        g_mime_part_set_pre_encoded_content
                                            (GMimePart *mime_part,
                                             const char *content,
                                             guint len,
                                             GMimePartEncodingType encoding);

Sets the encoding type and raw content on the mime part after decoding the content.

mime_part : Mime part
content : encoded mime part content
len : length of the content
encoding : content encoding


g_mime_part_get_content ()

const gchar* g_mime_part_get_content        (const GMimePart *mime_part,
                                             guint *len);

mime_part : the GMimePart to be decoded.
len : decoded length (to be set after processing)
Returns :a gchar * pointer to the raw contents of the MIME Part and sets len to the length of the buffer.


g_mime_part_add_subpart ()

void        g_mime_part_add_subpart         (GMimePart *mime_part,
                                             GMimePart *subpart);

Adds a subpart to the parent mime part which *must* be a multipart.

mime_part : Parent Mime part
subpart : Child Mime part


g_mime_part_add_child()

#define     g_mime_part_add_child(mime_part, child)

mime_part : 
child : 


g_mime_part_to_string ()

gchar*      g_mime_part_to_string           (GMimePart *mime_part,
                                             gboolean toplevel);

mime_part : MIME Part
toplevel : mime part is the root mime part
Returns :an allocated string containing the MIME Part. If toplevel is set to TRUE, then the MIME Part header will contain needed MIME headers for rfc822 messages.


g_mime_part_foreach ()

void        g_mime_part_foreach             (GMimePart *mime_part,
                                             GMimePartFunc callback,
                                             gpointer data);

Calls callback on mime_part and each of it's subparts.

mime_part : the MIME part
callback : function to call for mime_part and all it's subparts
data : extra data to pass to the callback


g_mime_part_get_subpart_from_content_id ()

const GMimePart* g_mime_part_get_subpart_from_content_id
                                            (GMimePart *mime_part,
                                             const gchar *content_id);

mime_part : the MIME part
content_id : the content id of the part to look for
Returns :the GMimePart whose content-id matches the search string, or NULL if a match cannot be found.