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

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-formatter-quote-attachment.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-formatter-quote-attachment.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-qoute-attachment.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 #include "e-mail-part-attachment.h"
 25 
 26 #include <em-format/e-mail-formatter-extension.h>
 27 #include <em-format/e-mail-formatter.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 #define d(x)
 35 
 36 typedef struct _EMailFormatterQuoteAttachment {
 37 	GObject parent;
 38 } EMailFormatterQuoteAttachment;
 39 
 40 typedef struct _EMailFormatterQuoteAttachmentClass {
 41 	GObjectClass parent_class;
 42 } EMailFormatterQuoteAttachmentClass;
 43 
 44 static void e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface);
 45 static void e_mail_formatter_quote_mail_extension_interface_init (EMailExtensionInterface *iface);
 46 
 47 G_DEFINE_TYPE_EXTENDED (
 48 	EMailFormatterQuoteAttachment,
 49 	e_mail_formatter_quote_attachment,
 50 	G_TYPE_OBJECT,
 51 	0,
 52 	G_IMPLEMENT_INTERFACE (
 53 		E_TYPE_MAIL_EXTENSION,
 54 		e_mail_formatter_quote_mail_extension_interface_init)
 55 	G_IMPLEMENT_INTERFACE (
 56 		E_TYPE_MAIL_FORMATTER_EXTENSION,
 57 		e_mail_formatter_quote_formatter_extension_interface_init)
 58 )
 59 
 60 static const gchar *formatter_mime_types[] = { "application/vnd.evolution.attachment",
 61 					       NULL };
 62 
 63 static gboolean
 64 emfqe_attachment_format (EMailFormatterExtension *extension,
 65                          EMailFormatter *formatter,
 66                          EMailFormatterContext *context,
 67                          EMailPart *part,
 68                          CamelStream *stream,
 69                          GCancellable *cancellable)
 70 {
 71 	gchar *text, *html;
 72 	guint32 text_format_flags;
 73 	EMailPartAttachment *empa;
 74 	EMailPart *att_part;
 75 	GSList *iter;
 76 
 77 	empa = E_MAIL_PART_ATTACHMENT (part);
 78 
 79 	if (!empa->attachment_view_part_id)
 80 		return FALSE;
 81 
 82 	iter = e_mail_part_list_get_iter (
 83 		context->parts, empa->attachment_view_part_id);
 84 	if (!iter || !iter->data)
 85 		return FALSE;
 86 
 87 	att_part = iter->data;
 88 
 89 	camel_stream_write_string (stream, "<br><br>", cancellable, NULL);
 90 
 91 	text_format_flags =
 92 		e_mail_formatter_get_text_format_flags (formatter);
 93 	text = e_mail_part_describe (
 94 		part->part,
 95 		empa ? empa->snoop_mime_type : part->mime_type);
 96 
 97 	html = camel_text_to_html (
 98 		text,
 99 		text_format_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS,
100 		0);
101 	camel_stream_write_string (stream, html, cancellable, NULL);
102 	camel_stream_write_string (stream, "<br>", cancellable, NULL);
103 	g_free (html);
104 	g_free (text);
105 
106 	camel_stream_write_string (
107 		stream,
108 		"<!--+GtkHTML:<DATA class=\"ClueFlow\" "
109 		"key=\"orig\" value=\"1\">-->\n"
110 		"<blockquote type=cite>\n", cancellable, NULL);
111 
112 	e_mail_formatter_format_as (
113 		formatter, context, att_part, stream, NULL, cancellable);
114 
115 	camel_stream_write_string (
116 		stream,
117 		"</blockquote><!--+GtkHTML:"
118 		"<DATA class=\"ClueFlow\" clear=\"orig\">-->",
119 		cancellable, NULL);
120 
121 	return TRUE;
122 }
123 
124 static const gchar *
125 emfqe_attachment_get_display_name (EMailFormatterExtension *extension)
126 {
127 	return NULL;
128 }
129 
130 static const gchar *
131 emfqe_attachment_get_description (EMailFormatterExtension *extension)
132 {
133 	return NULL;
134 }
135 
136 static const gchar **
137 emfqe_attachment_mime_types (EMailExtension *extension)
138 {
139 	return formatter_mime_types;
140 }
141 
142 static void
143 e_mail_formatter_quote_attachment_class_init (EMailFormatterQuoteAttachmentClass *class)
144 {
145 }
146 
147 static void
148 e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface)
149 {
150 	iface->format = emfqe_attachment_format;
151 	iface->get_display_name = emfqe_attachment_get_display_name;
152 	iface->get_description = emfqe_attachment_get_description;
153 }
154 
155 static void
156 e_mail_formatter_quote_mail_extension_interface_init (EMailExtensionInterface *iface)
157 {
158 	iface->mime_types = emfqe_attachment_mime_types;
159 }
160 
161 static void
162 e_mail_formatter_quote_attachment_init (EMailFormatterQuoteAttachment *formatter)
163 {
164 
165 }