1 /* 2 * e-mail-parser.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_PARSER_H_ 19 #define E_MAIL_PARSER_H_ 20 21 #include <em-format/e-mail-part-list.h> 22 #include <em-format/e-mail-extension-registry.h> 23 24 /* Standard GObject macros */ 25 #define E_TYPE_MAIL_PARSER \ 26 (e_mail_parser_get_type ()) 27 #define E_MAIL_PARSER(obj) \ 28 (G_TYPE_CHECK_INSTANCE_CAST \ 29 ((obj), E_TYPE_MAIL_PARSER, EMailParser)) 30 #define E_MAIL_PARSER_CLASS(cls) \ 31 (G_TYPE_CHECK_CLASS_CAST \ 32 ((cls), E_TYPE_MAIL_PARSER, EMailParserClass)) 33 #define E_IS_MAIL_PARSER(obj) \ 34 (G_TYPE_CHECK_INSTANCE_TYPE \ 35 ((obj), E_TYPE_MAIL_PARSER)) 36 #define E_IS_MAIL_PARSER_CLASS(cls) \ 37 (G_TYPE_CHECK_CLASS_TYPE \ 38 ((cls), E_TYPE_MAIL_PARSER)) 39 #define E_MAIL_PARSER_GET_CLASS(obj) \ 40 (G_TYPE_INSTANCE_GET_CLASS \ 41 ((obj), E_TYPE_MAIL_PARSER, EMailParserClass)) 42 43 G_BEGIN_DECLS 44 45 typedef struct _EMailParser EMailParser; 46 typedef struct _EMailParserClass EMailParserClass; 47 typedef struct _EMailParserPrivate EMailParserPrivate; 48 49 struct _EMailParser { 50 GObject parent; 51 EMailParserPrivate *priv; 52 }; 53 54 struct _EMailParserClass { 55 GObjectClass parent_class; 56 57 EMailParserExtensionRegistry *extension_registry; 58 }; 59 60 GType e_mail_parser_get_type (void); 61 62 EMailParser * e_mail_parser_new (CamelSession *session); 63 64 EMailPartList * e_mail_parser_parse_sync (EMailParser *parser, 65 CamelFolder *folder, 66 const gchar *message_uid, 67 CamelMimeMessage *message, 68 GCancellable *cancellable); 69 70 void e_mail_parser_parse (EMailParser *parser, 71 CamelFolder *folder, 72 const gchar *message_uid, 73 CamelMimeMessage *message, 74 GAsyncReadyCallback callback, 75 GCancellable *cancellable, 76 gpointer user_data); 77 78 EMailPartList * e_mail_parser_parse_finish (EMailParser *parser, 79 GAsyncResult *result, 80 GError **error); 81 82 GQueue * e_mail_parser_get_parsers_for_part 83 (EMailParser *parser, 84 CamelMimePart *part); 85 GQueue * e_mail_parser_get_parsers (EMailParser *parser, 86 const gchar *mime_type); 87 gboolean e_mail_parser_parse_part (EMailParser *parser, 88 CamelMimePart *part, 89 GString *part_id, 90 GCancellable *cancellable, 91 GQueue *out_mail_parts); 92 93 gboolean e_mail_parser_parse_part_as (EMailParser *parser, 94 CamelMimePart *part, 95 GString *part_id, 96 const gchar *mime_type, 97 GCancellable *cancellable, 98 GQueue *out_mail_parts); 99 100 void e_mail_parser_error (EMailParser *parser, 101 GQueue *out_mail_parts, 102 const gchar *format, 103 ...) G_GNUC_PRINTF (3, 4); 104 105 void e_mail_parser_wrap_as_attachment 106 (EMailParser *parser, 107 CamelMimePart *part, 108 GString *part_id, 109 GQueue *parts_queue); 110 void e_mail_parser_wrap_as_non_expandable_attachment 111 (EMailParser *parser, 112 CamelMimePart *part, 113 GString *part_id, 114 GQueue *parts_queue); 115 116 CamelSession * e_mail_parser_get_session (EMailParser *parser); 117 EMailPartList * e_mail_parser_ref_part_list_for_operation 118 (EMailParser *parser, 119 GCancellable *operation); 120 121 EMailExtensionRegistry * 122 e_mail_parser_get_extension_registry 123 (EMailParser *parser); 124 125 G_END_DECLS 126 127 #endif /* E_MAIL_PARSER_H_ */ 128