## EMailPart

EMailPart

## Synopsis

    struct              EMailPart;
    enum                EMailPartValidityFlags;
    struct              EMailPartValidityPair;
    EMailPart *         e_mail_part_new                     (CamelMimePart *mime_part,
                                                             const gchar *id);
    const gchar *       e_mail_part_get_id                  (EMailPart *part);
    const gchar *       e_mail_part_get_cid                 (EMailPart *part);
    void                e_mail_part_set_cid                 (EMailPart *part,
                                                             const gchar *cid);
    gboolean            e_mail_part_id_has_prefix           (EMailPart *part,
                                                             const gchar *prefix);
    gboolean            e_mail_part_id_has_suffix           (EMailPart *part,
                                                             const gchar *suffix);
    gboolean            e_mail_part_id_has_substr           (EMailPart *part,
                                                             const gchar *substr);
    CamelMimePart *     e_mail_part_ref_mime_part           (EMailPart *part);
    const gchar *       e_mail_part_get_mime_type           (EMailPart *part);
    void                e_mail_part_set_mime_type           (EMailPart *part,
                                                             const gchar *mime_type);
    struct _EMailPartList * e_mail_part_ref_part_list       (EMailPart *part);
    void                e_mail_part_set_part_list           (EMailPart *part,
                                                             struct _EMailPartList *part_list);
    gboolean            e_mail_part_get_is_attachment       (EMailPart *part);
    void                e_mail_part_set_is_attachment       (EMailPart *part,
                                                             gboolean is_attachment);
    void                e_mail_part_bind_dom_element        (EMailPart *part,
                                                             WebKitDOMElement *element);
    void                e_mail_part_update_validity         (EMailPart *part,
                                                             CamelCipherValidity *validity,
                                                             EMailPartValidityFlags validity_type);
    CamelCipherValidity * e_mail_part_get_validity          (EMailPart *part,
                                                             EMailPartValidityFlags validity_type);
    gboolean            e_mail_part_has_validity            (EMailPart *part);
    EMailPartValidityFlags e_mail_part_get_validity_flags   (EMailPart *part);
    gboolean            e_mail_part_is_secured              (CamelMimePart *part);
    const gchar *       e_mail_part_snoop_type              (CamelMimePart *part);
    gboolean            e_mail_part_is_attachment           (CamelMimePart *part);
    void                e_mail_part_preserve_charset_in_content_type
                                                            (CamelMimePart *ipart,
                                                             CamelMimePart *opart);
    CamelMimePart *     e_mail_part_get_related_display_part
                                                            (CamelMimePart *part,
                                                             gint *out_displayid);
    void                e_mail_part_animation_extract_frame (const GByteArray *anim,
                                                             gchar **frame,
                                                             gsize *len);
    gchar *             e_mail_part_build_uri               (CamelFolder *folder,
                                                             const gchar *message_uid,
                                                             const gchar *first_param_name,
                                                             ...);
    gchar *             e_mail_part_describe                (CamelMimePart *part,
                                                             const gchar *mime_type);
    gboolean            e_mail_part_is_inline               (CamelMimePart *part,
                                                             GQueue *extensions);
    gboolean            e_mail_part_utils_body_refers       (const gchar *body,
                                                             const gchar *cid);

## Object Hierarchy

      GObject
       +----EMailPart
             +----EMailPartAttachmentBar
             +----EMailPartAttachment
             +----EMailPartHeaders
             +----EMailPartImage

## Implemented Interfaces

EMailPart implements EExtensible.

## Properties

      "cid"                      gchar*                : Read / Write
      "id"                       gchar*                : Read / Write / Construct Only
      "is-attachment"            gboolean              : Read / Write / Construct
      "mime-part"                CamelMimePart*        : Read / Write / Construct Only
      "mime-type"                gchar*                : Read / Write
      "part-list"                EMailPartList*        : Read / Write

## Description

## Details

### struct EMailPart

    struct EMailPart;

The EMailPart is a wrapper around CamelMimePart which holds additional information about the mime part, like it's ID, encryption type etc.

Each EMailPart must have a unique ID. The ID is a dot-separated hierarchical description of the location of the part within the email message.

### enum EMailPartValidityFlags

    typedef enum {
     /*< flags >*/
    	E_MAIL_PART_VALIDITY_NONE = 0,
    	E_MAIL_PART_VALIDITY_PGP = 1 << 0,
    	E_MAIL_PART_VALIDITY_SMIME = 1 << 1,
    	E_MAIL_PART_VALIDITY_SIGNED = 1 << 2,
    	E_MAIL_PART_VALIDITY_ENCRYPTED = 1 << 3
    } EMailPartValidityFlags;

`E_MAIL_PART_VALIDITY_NONE` |
`E_MAIL_PART_VALIDITY_PGP` |
`E_MAIL_PART_VALIDITY_SMIME` |
`E_MAIL_PART_VALIDITY_SIGNED` |
`E_MAIL_PART_VALIDITY_ENCRYPTED` |

### struct EMailPartValidityPair

    struct EMailPartValidityPair {
    	EMailPartValidityFlags validity_type;
    	CamelCipherValidity *validity;
    };

### e_mail_part_new ()

    EMailPart *         e_mail_part_new                     (CamelMimePart *mime_part,
                                                             const gchar *id);

Creates a new EMailPart for the given `mime_part`.

`mime_part` : | (allow-none) a CamelMimePart or `NULL`
`id` : | part ID
Returns : | a new EMailPart

### e_mail_part_get_id ()

    const gchar *       e_mail_part_get_id                  (EMailPart *part);

### e_mail_part_get_cid ()

    const gchar *       e_mail_part_get_cid                 (EMailPart *part);

### e_mail_part_set_cid ()

    void                e_mail_part_set_cid                 (EMailPart *part,
                                                             const gchar *cid);

### e_mail_part_id_has_prefix ()

    gboolean            e_mail_part_id_has_prefix           (EMailPart *part,
                                                             const gchar *prefix);

### e_mail_part_id_has_suffix ()

    gboolean            e_mail_part_id_has_suffix           (EMailPart *part,
                                                             const gchar *suffix);

### e_mail_part_id_has_substr ()

    gboolean            e_mail_part_id_has_substr           (EMailPart *part,
                                                             const gchar *substr);

### e_mail_part_ref_mime_part ()

    CamelMimePart *     e_mail_part_ref_mime_part           (EMailPart *part);

### e_mail_part_get_mime_type ()

    const gchar *       e_mail_part_get_mime_type           (EMailPart *part);

### e_mail_part_set_mime_type ()

    void                e_mail_part_set_mime_type           (EMailPart *part,
                                                             const gchar *mime_type);

### e_mail_part_ref_part_list ()

    struct _EMailPartList * e_mail_part_ref_part_list       (EMailPart *part);

### e_mail_part_set_part_list ()

    void                e_mail_part_set_part_list           (EMailPart *part,
                                                             struct _EMailPartList *part_list);

### e_mail_part_get_is_attachment ()

    gboolean            e_mail_part_get_is_attachment       (EMailPart *part);

### e_mail_part_set_is_attachment ()

    void                e_mail_part_set_is_attachment       (EMailPart *part,
                                                             gboolean is_attachment);

### e_mail_part_bind_dom_element ()

    void                e_mail_part_bind_dom_element        (EMailPart *part,
                                                             WebKitDOMElement *element);

### e_mail_part_update_validity ()

    void                e_mail_part_update_validity         (EMailPart *part,
                                                             CamelCipherValidity *validity,
                                                             EMailPartValidityFlags validity_type);

Updates validity of the `part`. When the part already has some validity set, the new `validity` and `validity_type` are just appended, preserving the original validity. Validities of the same type (PGP or S/MIME) are merged together.

`part` : | An EMailPart
`validity_type` : | E_MAIL_PART_VALIDITY_* flags
`validity` : | a CamelCipherValidity

### e_mail_part_get_validity ()

    CamelCipherValidity * e_mail_part_get_validity          (EMailPart *part,
                                                             EMailPartValidityFlags validity_type);

Returns, validity of `part` contains any validity with the same bits as `validity_type` set. It should contain all bits of it.

`part` : | An EMailPart
`validity_type` : | E_MAIL_PART_VALIDITY_* flags
Returns : | a CamelCipherValidity of the given type, `NULL` if not found

Since 3.8

### e_mail_part_has_validity ()

    gboolean            e_mail_part_has_validity            (EMailPart *part);

### e_mail_part_get_validity_flags ()

    EMailPartValidityFlags e_mail_part_get_validity_flags   (EMailPart *part);

### e_mail_part_is_secured ()

    gboolean            e_mail_part_is_secured              (CamelMimePart *part);

Whether `part` is signed or encrypted or not.

`part` : | a CamelMimePart
Returns : | TRUE/FALSE

### e_mail_part_snoop_type ()

    const gchar *       e_mail_part_snoop_type              (CamelMimePart *part);

Tries to snoop the mime type of a part.

`part` : | a CamelMimePart
Returns : | `NULL` if unknown (more likely application/octet-stream).

### e_mail_part_is_attachment ()

    gboolean            e_mail_part_is_attachment           (CamelMimePart *part);

Returns true if the part is an attachment.

A part is not considered an attachment if it is a multipart, or a text part with no filename. It is used to determine if an attachment header should be displayed for the part.

Content-Disposition is not checked.

`part` : | Part to check.
Returns : | TRUE/FALSE

### e_mail_part_preserve_charset_in_content_type ()

    void                e_mail_part_preserve_charset_in_content_type
                                                            (CamelMimePart *ipart,
                                                             CamelMimePart *opart);

Copies 'charset' part of content-type header from `ipart` to `opart`.

`ipart` : | Source CamelMimePart
`opart` : | Target CamelMimePart

### e_mail_part_get_related_display_part ()

    CamelMimePart *     e_mail_part_get_related_display_part
                                                            (CamelMimePart *part,
                                                             gint *out_displayid);

Goes through all subparts of given `part` and tries to determine which part should be displayed and which parts are just attachments to the part.

`part` : | a multipart/related or multipart/alternative CamelMimePart
`out_displayid` : | (out) returns index of the returned part
Returns : | A CamelMimePart that should be displayed

### e_mail_part_animation_extract_frame ()

    void                e_mail_part_animation_extract_frame (const GByteArray *anim,
                                                             gchar **frame,
                                                             gsize *len);

### e_mail_part_build_uri ()

    gchar *             e_mail_part_build_uri               (CamelFolder *folder,
                                                             const gchar *message_uid,
                                                             const gchar *first_param_name,
                                                             ...);

### e_mail_part_describe ()

    gchar *             e_mail_part_describe                (CamelMimePart *part,
                                                             const gchar *mime_type);

Generate a simple textual description of a part, `mime_type` represents the content.

`part` : | a CamelMimePart
`mime_type` : | MIME type of the content

### e_mail_part_is_inline ()

    gboolean            e_mail_part_is_inline               (CamelMimePart *part,
                                                             GQueue *extensions);

### e_mail_part_utils_body_refers ()

    gboolean            e_mail_part_utils_body_refers       (const gchar *body,
                                                             const gchar *cid);

`body` : | text body to search for references in; can be `NULL`, then returns `FALSE`
`cid` : | a Content-ID to search for; if found in body, it should be of form "cid:xxxxx"; can be `NULL`
Returns : | `FALSE` if any of the arguments is `NULL`.

## Property Details

### The `"cid"` property

      "cid"                      gchar*                : Read / Write

The MIME Content-ID.

Default value: NULL

### The `"id"` property

      "id"                       gchar*                : Read / Write / Construct Only

The part ID.

Default value: NULL

### The `"is-attachment"` property

      "is-attachment"            gboolean              : Read / Write / Construct

Format the part as an attachment.

Default value: FALSE

### The `"mime-part"` property

      "mime-part"                CamelMimePart*        : Read / Write / Construct Only

The MIME part.

### The `"mime-type"` property

      "mime-type"                gchar*                : Read / Write

The MIME type.

Default value: NULL

### The `"part-list"` property

      "part-list"                EMailPartList*        : Read / Write

The part list that owns the part.