evolution-3.6.4/em-format/e-mail-formatter-quote-text-html.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-formatter-quote-text-html.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-formatter-quote-text-html.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-formatter-quote-text-html.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-formatter-extension.h>
 26 #include <em-format/e-mail-formatter-quote.h>
 27 #include <em-format/e-mail-stripsig-filter.h>
 28 #include <em-format/e-mail-part-utils.h>
 29 #include <e-util/e-util.h>
 30 
 31 #include <glib/gi18n-lib.h>
 32 #include <camel/camel.h>
 33 
 34 #include <string.h>
 35 
 36 static const gchar *formatter_mime_types[] = { "text/html", NULL };
 37 
 38 typedef struct _EMailFormatterQuoteTextHTML {
 39 	GObject parent;
 40 } EMailFormatterQuoteTextHTML;
 41 
 42 typedef struct _EMailFormatterQuoteTextHTMLClass {
 43 	GObjectClass parent_class;
 44 } EMailFormatterQuoteTextHTMLClass;
 45 
 46 static void e_mail_formatter_quote_formatter_extension_interface_init
 47 					(EMailFormatterExtensionInterface *iface);
 48 static void e_mail_formatter_quote_mail_extension_interface_init
 49 					(EMailExtensionInterface *iface);
 50 
 51 G_DEFINE_TYPE_EXTENDED (
 52 	EMailFormatterQuoteTextHTML,
 53 	e_mail_formatter_quote_text_html,
 54 	G_TYPE_OBJECT,
 55 	0,
 56 	G_IMPLEMENT_INTERFACE (
 57 		E_TYPE_MAIL_EXTENSION,
 58 		e_mail_formatter_quote_mail_extension_interface_init)
 59 	G_IMPLEMENT_INTERFACE (
 60 		E_TYPE_MAIL_FORMATTER_EXTENSION,
 61 		e_mail_formatter_quote_formatter_extension_interface_init));
 62 
 63 static gboolean
 64 emqfe_text_html_format (EMailFormatterExtension *extension,
 65                         EMailFormatter *formatter,
 66                         EMailFormatterContext *context,
 67                         EMailPart *part,
 68                         CamelStream *stream,
 69                         GCancellable *cancellable)
 70 {
 71 	EMailFormatterQuoteContext *qf_context;
 72 
 73 	qf_context = (EMailFormatterQuoteContext *) context;
 74 
 75 	camel_stream_write_string (
 76 		stream, "\n<!-- text/html -->\n", cancellable, NULL);
 77 
 78 	if ((qf_context->qf_flags & E_MAIL_FORMATTER_QUOTE_FLAG_KEEP_SIG) == 0) {
 79 		CamelMimeFilter *sig_strip;
 80 		CamelStream *filtered_stream;
 81 
 82 		filtered_stream = camel_stream_filter_new (stream);
 83 
 84 		sig_strip = e_mail_stripsig_filter_new (FALSE);
 85 		camel_stream_filter_add (
 86 			CAMEL_STREAM_FILTER (filtered_stream), sig_strip);
 87 		g_object_unref (sig_strip);
 88 
 89 		e_mail_formatter_format_text (
 90 			formatter, part, filtered_stream, cancellable);
 91 		camel_stream_flush (filtered_stream, cancellable, NULL);
 92 		g_object_unref (filtered_stream);
 93 	} else {
 94 		e_mail_formatter_format_text (
 95 			formatter, part, stream, cancellable);
 96 	}
 97 
 98 	return TRUE;
 99 }
100 
101 static const gchar *
102 emqfe_text_html_get_display_name (EMailFormatterExtension *extension)
103 {
104 	return _("HTML");
105 }
106 
107 static const gchar *
108 emqfe_text_html_get_description (EMailFormatterExtension *extension)
109 {
110 	return _("Format part as HTML");
111 }
112 
113 static const gchar **
114 emqfe_text_html_mime_types (EMailExtension *extension)
115 {
116 	return formatter_mime_types;
117 }
118 
119 static void
120 e_mail_formatter_quote_text_html_class_init (EMailFormatterQuoteTextHTMLClass *class)
121 {
122 }
123 
124 static void
125 e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface)
126 {
127 	iface->format = emqfe_text_html_format;
128 	iface->get_display_name = emqfe_text_html_get_display_name;
129 	iface->get_description = emqfe_text_html_get_description;
130 }
131 
132 static void
133 e_mail_formatter_quote_mail_extension_interface_init (EMailExtensionInterface *iface)
134 {
135 	iface->mime_types = emqfe_text_html_mime_types;
136 }
137 
138 static void
139 e_mail_formatter_quote_text_html_init (EMailFormatterQuoteTextHTML *formatter)
140 {
141 
142 }