No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-mail-parser-extension.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-mail-parser-extension.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * e-mail-parser-extension.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 #include <camel/camel.h>
20
21 #include "e-mail-parser-extension.h"
22
23 G_DEFINE_INTERFACE (
24 EMailParserExtension,
25 e_mail_parser_extension,
26 E_TYPE_MAIL_EXTENSION)
27
28 /**
29 * EMailParserExtension:
30 *
31 * The #EMailParserExtension is an abstract interface for all extensions for
32 * #EMailParser.
33 */
34
35 static void
36 e_mail_parser_extension_default_init (EMailParserExtensionInterface *iface)
37 {
38
39 }
40
41 /**
42 * e_mail_parser_extension_parse
43 * @extension: an #EMailParserExtension
44 * @parser: a #EMailParser
45 * @mime_part: (allow-none) a #CamelMimePart to parse
46 * @part_id: a #GString to which parser will append ID of the parsed part.
47 * @flags: #EMailParserFlags
48 * @cancellable: (allow-none) A #GCancellable
49 *
50 * A virtual function reimplemented in all mail parser extensions. The function
51 * decodes and parses the @mime_part, creating one or more #EMailPart<!-//>s.
52 *
53 * When the function is unable to parse the @mime_part (either because it's broken
54 * or because it is a different mimetype then the extension is specialized for), the
55 * function will return @NULL indicating the #EMailParser, that it should pick
56 * another extension.
57 *
58 * When the @mime_part contains for example multipart/mixed of one RFC822 message
59 * with an attachment and of one image, then parser must make sure that the
60 * returned #GSList is correctly ordered:
61 *
62 * part1.rfc822.plain_text
63 * part1.rfc822.attachment
64 * part2.image
65 *
66 * Implementation of this function must be thread-safe.
67 *
68 * Return value: Returns #GSList of #EMailPart<!-//>s when the part was succesfully
69 * parsed, returns @NULL when the parser is not able to parse the part.
70 */
71 GSList *
72 e_mail_parser_extension_parse (EMailParserExtension *extension,
73 EMailParser *parser,
74 CamelMimePart *mime_part,
75 GString *part_id,
76 GCancellable *cancellable)
77 {
78 EMailParserExtensionInterface *interface;
79
80 g_return_val_if_fail (E_IS_MAIL_PARSER_EXTENSION (extension), NULL);
81 g_return_val_if_fail (E_IS_MAIL_PARSER (parser), NULL);
82
83 interface = E_MAIL_PARSER_EXTENSION_GET_INTERFACE (extension);
84 g_return_val_if_fail (interface->parse != NULL, NULL);
85
86 return interface->parse (extension, parser, mime_part, part_id, cancellable);
87 }
88
89 guint32
90 e_mail_parser_extension_get_flags (EMailParserExtension *extension)
91 {
92 EMailParserExtensionInterface *interface;
93
94 g_return_val_if_fail (E_IS_MAIL_PARSER_EXTENSION (extension), 0);
95
96 interface = E_MAIL_PARSER_EXTENSION_GET_INTERFACE (extension);
97 if (interface->get_flags == NULL)
98 return 0;
99
100 return interface->get_flags (extension);
101 }