No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-mail-parser-message-deliverystatus.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-mail-parser-message-deliverystatus.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * e-mail-parser-message-deliverystatus.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 <glib-object.h>
26
27 #include <em-format/e-mail-parser-extension.h>
28 #include <em-format/e-mail-parser.h>
29 #include <e-util/e-util.h>
30
31 #include <camel/camel.h>
32
33 #include <string.h>
34
35 typedef struct _EMailParserMessageDeliveryStatus {
36 GObject parent;
37 } EMailParserMessageDeliveryStatus;
38
39 typedef struct _EMailParserMessageDeliveryStatusClass {
40 GObjectClass parent_class;
41 } EMailParserMessageDeliveryStatusClass;
42
43 static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
44 static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface);
45
46 G_DEFINE_TYPE_EXTENDED (
47 EMailParserMessageDeliveryStatus,
48 e_mail_parser_message_delivery_status,
49 G_TYPE_OBJECT,
50 0,
51 G_IMPLEMENT_INTERFACE (
52 E_TYPE_MAIL_EXTENSION,
53 e_mail_parser_mail_extension_interface_init)
54 G_IMPLEMENT_INTERFACE (
55 E_TYPE_MAIL_PARSER_EXTENSION,
56 e_mail_parser_parser_extension_interface_init));
57
58 static const gchar * parser_mime_types[] = { "message/delivery-status",
59 "message/feedback-report",
60 "message/disposition-notification",
61 NULL };
62
63 static GSList *
64 empe_msg_deliverystatus_parse (EMailParserExtension *extension,
65 EMailParser *parser,
66 CamelMimePart *part,
67 GString *part_id,
68 GCancellable *cancellable)
69 {
70 EMailPart *mail_part;
71 gsize len;
72
73 if (g_cancellable_is_cancelled (cancellable))
74 return NULL;
75
76 len = part_id->len;
77 g_string_append (part_id, ".delivery-status");
78 mail_part = e_mail_part_new (part, part_id->str);
79 mail_part->mime_type = g_strdup ("text/plain");
80
81 g_string_truncate (part_id, len);
82
83 /* The only reason for having a separate parser for
84 * message/delivery-status is to display the part as an attachment */
85 return e_mail_parser_wrap_as_attachment (
86 parser, part, g_slist_append (NULL, mail_part),
87 part_id, cancellable);
88 }
89
90 static const gchar **
91 empe_msg_deliverystatus_mime_types (EMailExtension *extension)
92 {
93 return parser_mime_types;
94 }
95
96 static void
97 e_mail_parser_message_delivery_status_class_init (EMailParserMessageDeliveryStatusClass *class)
98 {
99 }
100
101 static void
102 e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
103 {
104 iface->parse = empe_msg_deliverystatus_parse;
105 }
106
107 static void
108 e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface)
109 {
110 iface->mime_types = empe_msg_deliverystatus_mime_types;
111 }
112
113 static void
114 e_mail_parser_message_delivery_status_init (EMailParserMessageDeliveryStatus *parser)
115 {
116
117 }