No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-mail-parser-text-enriched.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-mail-parser-text-enriched.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * e-mail-parser-text-enriched.c
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with the program; if not, see <http://www.gnu.org/licenses/>
16 *
17 */
18
19 #ifdef HAVE_CONFIG_H
20 #include <config.h>
21 #endif
22
23 #include "e-mail-format-extensions.h"
24
25 #include <em-format/e-mail-parser-extension.h>
26 #include <em-format/e-mail-parser.h>
27 #include <em-format/e-mail-part-utils.h>
28 #include <e-util/e-util.h>
29
30 #include <glib/gi18n-lib.h>
31 #include <camel/camel.h>
32
33 typedef struct _EMailParserTextEnriched {
34 GObject parent;
35 } EMailParserTextEnriched;
36
37 typedef struct _EMailParserTextEnrichedClass {
38 GObjectClass parent_class;
39 } EMailParserTextEnrichedClass;
40
41 static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
42 static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface);
43
44 G_DEFINE_TYPE_EXTENDED (
45 EMailParserTextEnriched,
46 e_mail_parser_text_enriched,
47 G_TYPE_OBJECT,
48 0,
49 G_IMPLEMENT_INTERFACE (
50 E_TYPE_MAIL_EXTENSION,
51 e_mail_parser_mail_extension_interface_init)
52 G_IMPLEMENT_INTERFACE (
53 E_TYPE_MAIL_PARSER_EXTENSION,
54 e_mail_parser_parser_extension_interface_init));
55
56 static const gchar *parser_mime_types[] = { "text/richtext",
57 "text/enriched",
58 NULL };
59
60 static GSList *
61 empe_text_enriched_parse (EMailParserExtension *extension,
62 EMailParser *parser,
63 CamelMimePart *part,
64 GString *part_id,
65 GCancellable *cancellable)
66 {
67 EMailPart *mail_part;
68 const gchar *tmp;
69 gint len;
70 CamelContentType *ct;
71
72 if (g_cancellable_is_cancelled (cancellable))
73 return NULL;
74
75 len = part_id->len;
76 g_string_append (part_id, ".text_enriched");
77
78 ct = camel_mime_part_get_content_type (part);
79
80 mail_part = e_mail_part_new (part, part_id->str);
81 mail_part->mime_type = ct ? camel_content_type_simple (ct) : g_strdup ("text/enriched");
82 tmp = camel_mime_part_get_content_id (part);
83 if (!tmp) {
84 mail_part->cid = NULL;
85 } else {
86 mail_part->cid = g_strdup_printf ("cid:%s", tmp);
87 }
88
89 g_string_truncate (part_id, len);
90
91 if (e_mail_part_is_attachment (part)) {
92 return e_mail_parser_wrap_as_attachment (
93 parser, part, g_slist_append (NULL, mail_part),
94 part_id, cancellable);
95 }
96
97 return g_slist_append (NULL, mail_part);
98 }
99
100 static const gchar **
101 empe_text_enriched_mime_types (EMailExtension *extension)
102 {
103 return parser_mime_types;
104 }
105
106 static void
107 e_mail_parser_text_enriched_class_init (EMailParserTextEnrichedClass *class)
108 {
109 }
110
111 static void
112 e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
113 {
114 iface->parse = empe_text_enriched_parse;
115 }
116
117 static void
118 e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface)
119 {
120 iface->mime_types = empe_text_enriched_mime_types;
121 }
122
123 static void
124 e_mail_parser_text_enriched_init (EMailParserTextEnriched *parser)
125 {
126
127 }