No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-mail-parser-multipart-appledouble.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-mail-parser-multipart-appledouble.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * e-mail-parser-multipart-appledouble.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
28 #include <camel/camel.h>
29
30 typedef struct _EMailParserMultipartAppleDouble {
31 GObject parent;
32 } EMailParserMultipartAppleDouble;
33
34 typedef struct _EMailParserMultipartAppleDoubleClass {
35 GObjectClass parent_class;
36 } EMailParserMultipartAppleDoubleClass;
37
38 static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
39 static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface);
40
41 G_DEFINE_TYPE_EXTENDED (
42 EMailParserMultipartAppleDouble,
43 e_mail_parser_multipart_apple_double,
44 G_TYPE_OBJECT,
45 0,
46 G_IMPLEMENT_INTERFACE (
47 E_TYPE_MAIL_EXTENSION,
48 e_mail_parser_mail_extension_interface_init)
49 G_IMPLEMENT_INTERFACE (
50 E_TYPE_MAIL_PARSER_EXTENSION,
51 e_mail_parser_parser_extension_interface_init));
52
53 static const gchar * parser_mime_types[] = { "multipart/appledouble", NULL };
54
55 static GSList *
56 empe_mp_appledouble_parse (EMailParserExtension *extension,
57 EMailParser *parser,
58 CamelMimePart *part,
59 GString *part_id,
60 GCancellable *cancellable)
61 {
62 CamelMultipart *mp;
63 GSList *parts;
64
65 if (g_cancellable_is_cancelled (cancellable))
66 return NULL;
67
68 mp = (CamelMultipart *) camel_medium_get_content ((CamelMedium *) part);
69
70 if (!CAMEL_IS_MULTIPART (mp)) {
71 parts = e_mail_parser_parse_part_as (
72 parser, part, part_id,
73 "application/vnd.evolution.source",
74 cancellable);
75 } else {
76 CamelMimePart *mime_part;
77 mime_part = camel_multipart_get_part (mp, 1);
78
79 if (mime_part) {
80 gint len;
81 /* try the data fork for something useful, doubtful but who knows */
82 len = part_id->len;
83 g_string_append_printf (part_id, ".appledouble.1");
84
85 parts = e_mail_parser_parse_part (
86 parser, mime_part, part_id, cancellable);
87
88 g_string_truncate (part_id, len);
89
90 } else {
91
92 parts = e_mail_parser_parse_part_as (
93 parser, part, part_id,
94 "application/vnd.evolution.source",
95 cancellable);
96 }
97 }
98
99 return parts;
100 }
101
102 static const gchar **
103 empe_mp_appledouble_mime_types (EMailExtension *extension)
104 {
105 return parser_mime_types;
106 }
107
108 static void
109 e_mail_parser_multipart_apple_double_class_init (EMailParserMultipartAppleDoubleClass *class)
110 {
111 }
112
113 static void
114 e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
115 {
116 iface->parse = empe_mp_appledouble_parse;
117 }
118
119 static void
120 e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface)
121 {
122 iface->mime_types = empe_mp_appledouble_mime_types;
123 }
124
125 static void
126 e_mail_parser_multipart_apple_double_init (EMailParserMultipartAppleDouble *parser)
127 {
128
129 }