1 /* 2 * e-mail-part.h 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but 9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 * 16 */ 17 18 #ifndef E_MAIL_PART_H 19 #define E_MAIL_PART_H 20 21 #include <camel/camel.h> 22 23 #include <e-util/e-util.h> 24 25 #include <em-format/e-mail-formatter-enums.h> 26 27 /* Standard GObject macros */ 28 #define E_TYPE_MAIL_PART \ 29 (e_mail_part_get_type ()) 30 #define E_MAIL_PART(obj) \ 31 (G_TYPE_CHECK_INSTANCE_CAST \ 32 ((obj), E_TYPE_MAIL_PART, EMailPart)) 33 #define E_MAIL_PART_CLASS(cls) \ 34 (G_TYPE_CHECK_CLASS_CAST \ 35 ((cls), E_TYPE_MAIL_PART, EMailPartClass)) 36 #define E_IS_MAIL_PART(obj) \ 37 (G_TYPE_CHECK_INSTANCE_TYPE \ 38 ((obj), E_TYPE_MAIL_PART)) 39 #define E_IS_MAIL_PART_CLASS(cls) \ 40 (G_TYPE_CHECK_CLASS_TYPE \ 41 ((cls), E_TYPE_MAIL_PART)) 42 #define E_MAIL_PART_GET_CLASS(obj) \ 43 (G_TYPE_INSTANCE_GET_CLASS \ 44 ((obj), E_TYPE_MAIL_PART, EMailPartClass)) 45 46 G_BEGIN_DECLS 47 48 struct _EMailPartList; 49 50 typedef struct _EMailPart EMailPart; 51 typedef struct _EMailPartClass EMailPartClass; 52 typedef struct _EMailPartPrivate EMailPartPrivate; 53 54 typedef struct _EMailPartValidityPair EMailPartValidityPair; 55 56 struct _EMailPartValidityPair { 57 EMailPartValidityFlags validity_type; 58 CamelCipherValidity *validity; 59 }; 60 61 struct _EMailPart { 62 GObject parent; 63 EMailPartPrivate *priv; 64 65 GQueue validities; /* element-type: EMailPartValidityPair */ 66 67 /* Whether the part should be rendered or not. 68 * This is used for example to prevent images 69 * related to text/html parts from being 70 * rendered as attachments. */ 71 guint is_hidden: 1; 72 73 /* Force attachment to be expanded, even without 74 * content-disposition: inline */ 75 guint force_inline: 1; 76 77 /* Force attachment to be collapsed, even with 78 * content-disposition: inline */ 79 guint force_collapse: 1; 80 81 /* Does part contain an error message? */ 82 guint is_error: 1; 83 }; 84 85 struct _EMailPartClass { 86 GObjectClass parent_class; 87 88 void (*content_loaded) (EMailPart *part, 89 EWebView *web_view, 90 const gchar *iframe_id); 91 }; 92 93 GType e_mail_part_get_type (void) G_GNUC_CONST; 94 EMailPart * e_mail_part_new (CamelMimePart *mime_part, 95 const gchar *id); 96 const gchar * e_mail_part_get_id (EMailPart *part); 97 const gchar * e_mail_part_get_cid (EMailPart *part); 98 void e_mail_part_set_cid (EMailPart *part, 99 const gchar *cid); 100 gboolean e_mail_part_id_has_prefix (EMailPart *part, 101 const gchar *prefix); 102 gboolean e_mail_part_id_has_suffix (EMailPart *part, 103 const gchar *suffix); 104 gboolean e_mail_part_id_has_substr (EMailPart *part, 105 const gchar *substr); 106 CamelMimePart * e_mail_part_ref_mime_part (EMailPart *part); 107 const gchar * e_mail_part_get_mime_type (EMailPart *part); 108 void e_mail_part_set_mime_type (EMailPart *part, 109 const gchar *mime_type); 110 gboolean e_mail_part_get_converted_to_utf8 111 (EMailPart *part); 112 void e_mail_part_set_converted_to_utf8 113 (EMailPart *part, 114 gboolean converted_to_utf8); 115 gboolean e_mail_part_should_show_inline (EMailPart *part); 116 struct _EMailPartList * 117 e_mail_part_ref_part_list (EMailPart *part); 118 void e_mail_part_set_part_list (EMailPart *part, 119 struct _EMailPartList *part_list); 120 gboolean e_mail_part_get_is_attachment (EMailPart *part); 121 void e_mail_part_set_is_attachment (EMailPart *part, 122 gboolean is_attachment); 123 gboolean e_mail_part_get_is_printable (EMailPart *part); 124 void e_mail_part_set_is_printable (EMailPart *part, 125 gboolean is_printable); 126 void e_mail_part_content_loaded (EMailPart *part, 127 EWebView *web_view, 128 const gchar *iframe_id); 129 void e_mail_part_update_validity (EMailPart *part, 130 CamelCipherValidity *validity, 131 EMailPartValidityFlags validity_type); 132 CamelCipherValidity * 133 e_mail_part_get_validity (EMailPart *part, 134 EMailPartValidityFlags validity_type); 135 gboolean e_mail_part_has_validity (EMailPart *part); 136 EMailPartValidityFlags 137 e_mail_part_get_validity_flags (EMailPart *part); 138 void e_mail_part_verify_validity_sender 139 (EMailPart *part, 140 CamelInternetAddress *from_address); 141 142 G_END_DECLS 143 144 #endif /* E_MAIL_PART_H */ 145