NEWS update for 3.27.91
[evolution.git] / src / em-format / e-mail-parser-source.c
blob4faf56bca6987b330833e88163bccab52d211671
1 /*
2 * e-mail-parser-source.c
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.
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.
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/>.
18 #include "evolution-config.h"
20 #include <glib/gi18n-lib.h>
22 #include <e-util/e-util.h>
24 #include "e-mail-parser-extension.h"
26 typedef EMailParserExtension EMailParserSource;
27 typedef EMailParserExtensionClass EMailParserSourceClass;
29 GType e_mail_parser_source_get_type (void);
31 G_DEFINE_TYPE (
32 EMailParserSource,
33 e_mail_parser_source,
34 E_TYPE_MAIL_PARSER_EXTENSION)
36 static const gchar *parser_mime_types[] = {
37 "application/vnd.evolution.source",
38 NULL
41 static gboolean
42 empe_source_parse (EMailParserExtension *extension,
43 EMailParser *parser,
44 CamelMimePart *part,
45 GString *part_id,
46 GCancellable *cancellable,
47 GQueue *out_mail_parts)
49 EMailPart *mail_part;
50 gint len;
52 len = part_id->len;
53 g_string_append (part_id, ".source");
55 mail_part = e_mail_part_new (part, part_id->str);
56 e_mail_part_set_mime_type (mail_part, parser_mime_types[0]);
57 g_string_truncate (part_id, len);
59 g_queue_push_tail (out_mail_parts, mail_part);
61 return TRUE;
64 static void
65 e_mail_parser_source_class_init (EMailParserExtensionClass *class)
67 class->mime_types = parser_mime_types;
68 class->priority = G_PRIORITY_LOW;
69 class->parse = empe_source_parse;
72 static void
73 e_mail_parser_source_init (EMailParserExtension *extension)