evolution-3.6.4/em-format/e-mail-parser-message.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-parser-message.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-parser-message.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  * e-mail-parser-message.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/gi18n-lib.h>
 26 
 27 #include <em-format/e-mail-parser-extension.h>
 28 #include <em-format/e-mail-parser.h>
 29 #include "e-mail-part-utils.h"
 30 #include <libemail-engine/e-mail-utils.h>
 31 #include <e-util/e-util.h>
 32 
 33 #include <camel/camel.h>
 34 
 35 #include <string.h>
 36 
 37 typedef struct _EMailParserMessage {
 38 	GObject parent;
 39 } EMailParserMessage;
 40 
 41 typedef struct _EMailParserMessageClass {
 42 	GObjectClass parent_class;
 43 } EMailParserMessageClass;
 44 
 45 static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
 46 static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface);
 47 
 48 G_DEFINE_TYPE_EXTENDED (
 49 	EMailParserMessage,
 50 	e_mail_parser_message,
 51 	G_TYPE_OBJECT,
 52 	0,
 53 	G_IMPLEMENT_INTERFACE (
 54 		E_TYPE_MAIL_EXTENSION,
 55 		e_mail_parser_mail_extension_interface_init)
 56 	G_IMPLEMENT_INTERFACE (
 57 		E_TYPE_MAIL_PARSER_EXTENSION,
 58 		e_mail_parser_parser_extension_interface_init));
 59 
 60 static const gchar *parser_mime_types[] = { "application/vnd.evolution.message", NULL };
 61 
 62 static GSList *
 63 empe_message_parse (EMailParserExtension *extension,
 64                     EMailParser *parser,
 65                     CamelMimePart *part,
 66                     GString *part_id,
 67                     GCancellable *cancellable)
 68 {
 69 	GSList *parts;
 70 	CamelContentType *ct;
 71 	gchar *mime_type;
 72 
 73 	if (g_cancellable_is_cancelled (cancellable))
 74 		return NULL;
 75 
 76 	/* Headers */
 77 	parts = g_slist_concat (NULL, e_mail_parser_parse_part_as (
 78 					parser, part, part_id,
 79 					"application/vnd.evolution.headers",
 80 					cancellable));
 81 
 82 	/* Attachment Bar */
 83 	parts = g_slist_concat (parts, e_mail_parser_parse_part_as (
 84 					parser, part, part_id,
 85 					"application/vnd.evolution.widget.attachment-bar",
 86 					cancellable));
 87 
 88 	ct = camel_mime_part_get_content_type (part);
 89 	mime_type = camel_content_type_simple (ct);
 90 
 91 	if (mime_type && g_ascii_strcasecmp (mime_type, "message/rfc822") == 0) {
 92 		/* get mime type of the content of the message,
 93 		 * instead of using a generic message/rfc822 */
 94 		CamelDataWrapper *content;
 95 
 96 		content = camel_medium_get_content (CAMEL_MEDIUM (part));
 97 		if (content) {
 98 			ct = camel_data_wrapper_get_mime_type_field (content);
 99 
100 			g_free (mime_type);
101 			mime_type = camel_content_type_simple (ct);
102 		}
103 	}
104 
105 	/* Actual message body */
106 	parts = g_slist_concat (parts, e_mail_parser_parse_part_as (
107 					parser, part, part_id, mime_type,
108 					cancellable));
109 
110 	g_free (mime_type);
111 
112 	return parts;
113 }
114 
115 static const gchar **
116 empe_message_mime_types (EMailExtension *extension)
117 {
118 	return parser_mime_types;
119 }
120 
121 static void
122 e_mail_parser_message_class_init (EMailParserMessageClass *class)
123 {
124 }
125 
126 static void
127 e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
128 {
129 	iface->parse = empe_message_parse;
130 }
131 
132 static void
133 e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface)
134 {
135 	iface->mime_types = empe_message_mime_types;
136 }
137 
138 static void
139 e_mail_parser_message_init (EMailParserMessage *parser)
140 {
141 
142 }