1 /* 2 * e-mail-parser-extension.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_EXTENSION_H 19 #define E_MAIL_PARSER_EXTENSION_H 20 21 #include <camel/camel.h> 22 #include <em-format/e-mail-parser.h> 23 #include <em-format/e-mail-formatter-enums.h> 24 25 /* Standard GObject macros */ 26 #define E_TYPE_MAIL_PARSER_EXTENSION \ 27 (e_mail_parser_extension_get_type ()) 28 #define E_MAIL_PARSER_EXTENSION(obj) \ 29 (G_TYPE_CHECK_INSTANCE_CAST \ 30 ((obj), E_TYPE_MAIL_PARSER_EXTENSION, EMailParserExtension)) 31 #define E_MAIL_PARSER_EXTENSION_CLASS(cls) \ 32 (G_TYPE_CHECK_CLASS_CAST \ 33 ((cls), E_TYPE_MAIL_PARSER_EXTENSION, EMailParserExtensionClass)) 34 #define E_IS_MAIL_PARSER_EXTENSION(obj) \ 35 (G_TYPE_CHECK_INSTANCE_TYPE \ 36 ((obj), E_TYPE_MAIL_PARSER_EXTENSION)) 37 #define E_IS_MAIL_PARSER_EXTENSION_CLASS(cls) \ 38 (G_TYPE_CHECK_CLASS_TYPE \ 39 ((cls), E_TYPE_MAIL_PARSER_EXTENSION)) 40 #define E_MAIL_PARSER_EXTENSION_GET_CLASS(obj) \ 41 (G_TYPE_INSTANCE_GET_CLASS \ 42 ((obj), E_TYPE_MAIL_PARSER_EXTENSION, EMailParserExtensionClass)) 43 44 G_BEGIN_DECLS 45 46 typedef struct _EMailParserExtension EMailParserExtension; 47 typedef struct _EMailParserExtensionClass EMailParserExtensionClass; 48 typedef struct _EMailParserExtensionPrivate EMailParserExtensionPrivate; 49 50 /** 51 * EMailParserExtension: 52 * 53 * The #EMailParserExtension is an abstract interface for all extensions for 54 * #EMailParser. 55 */ 56 struct _EMailParserExtension { 57 GObject parent; 58 EMailParserExtensionPrivate *priv; 59 }; 60 61 struct _EMailParserExtensionClass { 62 GObjectClass parent_class; 63 64 /* This is a NULL-terminated array of supported MIME types. 65 * The MIME types can be exact (e.g. "text/plain") or use a 66 * wildcard (e.g. "text/ *"). */ 67 const gchar **mime_types; 68 69 /* This is used to prioritize extensions with identical MIME 70 * types. Lower values win. Defaults to G_PRIORITY_DEFAULT. */ 71 gint priority; 72 73 /* See the flag descriptions above. */ 74 EMailParserExtensionFlags flags; 75 76 gboolean (*parse) (EMailParserExtension *extension, 77 EMailParser *parser, 78 CamelMimePart *mime_part, 79 GString *part_id, 80 GCancellable *cancellable, 81 GQueue *out_mail_parts); 82 }; 83 84 GType e_mail_parser_extension_get_type 85 (void) G_GNUC_CONST; 86 gboolean e_mail_parser_extension_parse (EMailParserExtension *extension, 87 EMailParser *parser, 88 CamelMimePart *mime_part, 89 GString *part_id, 90 GCancellable *cancellable, 91 GQueue *out_mail_parts); 92 93 G_END_DECLS 94 95 #endif /* E_MAIL_PARSER_EXTENSION_H */ 96