aboutsummaryrefslogtreecommitdiffstats
path: root/em-format/e-mail-part.h
blob: 3d2e9628eb8a49f318089605e6d676e393fc7eca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * e-mail-part.h
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with the program; if not, see <http://www.gnu.org/licenses/>
 *
 */

#ifndef E_MAIL_PART_H_
#define E_MAIL_PART_H_

#include <camel/camel.h>
#include <misc/e-attachment.h>
#include <webkit/webkitdom.h>

#define E_MAIL_PART_IS(p,s_t) \
        ((p != NULL) && (e_mail_part_get_instance_size (p) == sizeof (s_t)))
#define E_MAIL_PART(o) ((EMailPart *) o)

G_BEGIN_DECLS

typedef struct _EMailPart EMailPart;
typedef struct _EMailPartPrivate EMailPartPrivate;

typedef void    (*EMailPartDOMBindFunc) (EMailPart *part,
                     WebKitDOMElement *element);

enum {
    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;

struct _EMailPart {
    EMailPartPrivate *priv;

    EMailPartDOMBindFunc bind_func;

    CamelMimePart *part;
    gchar *id;
    gchar *cid;
    gchar *mime_type;

    guint32 validity_type;  /* E_MAIL_PART_VALIDITY_ * flags */
    CamelCipherValidity *validity;
    CamelCipherValidity *validity_parent;

    gint is_attachment: 1;

    /* Whether the part should be rendered or not.
     * This is used for example to prevent images
     * related to text/html parts from being
     * rendered as attachments. */
    gint is_hidden: 1;

    /* Force attachment to be expanded, even without
     * content-disposition: inline */
    gint force_inline: 1;

    /* Force attachment to be collapsed, even with
     * content-disposition: inline */
    gint force_collapse: 1;

    /* Does part contain an error message? */
    gint is_error: 1;
};

EMailPart * e_mail_part_new         (CamelMimePart *part,
                         const gchar *id);
EMailPart * e_mail_part_subclass_new    (CamelMimePart *part,
                         const gchar *id,
                         gsize size,
                         GFreeFunc free_func);

EMailPart * e_mail_part_ref         (EMailPart *part);
void        e_mail_part_unref       (EMailPart *part);

gsize       e_mail_part_get_instance_size   (EMailPart *part);

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

G_END_DECLS

#endif /* E_MAIL_PART_H_ */