/*
* e-mail-formatter-text-plain.c
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see .
*
*/
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include
#include "e-mail-formatter-extension.h"
#include "e-mail-inline-filter.h"
#include "e-mail-part-utils.h"
typedef EMailFormatterExtension EMailFormatterTextPlain;
typedef EMailFormatterExtensionClass EMailFormatterTextPlainClass;
GType e_mail_formatter_text_plain_get_type (void);
G_DEFINE_TYPE (
EMailFormatterTextPlain,
e_mail_formatter_text_plain,
E_TYPE_MAIL_FORMATTER_EXTENSION)
static const gchar *formatter_mime_types[] = {
"text/plain",
"text/*",
"message/*",
"application/vnd.evolution.plaintext",
NULL
};
static gboolean
emfe_text_plain_format (EMailFormatterExtension *extension,
EMailFormatter *formatter,
EMailFormatterContext *context,
EMailPart *part,
GOutputStream *stream,
GCancellable *cancellable)
{
GOutputStream *filtered_stream;
CamelMimeFilter *filter;
const gchar *format;
const gchar *string;
guint32 rgb;
if (g_cancellable_is_cancelled (cancellable))
return FALSE;
if ((context->mode == E_MAIL_FORMATTER_MODE_RAW) ||
(context->mode == E_MAIL_FORMATTER_MODE_PRINTING)) {
CamelMimeFilterToHTMLFlags flags;
CamelMimePart *mime_part;
CamelDataWrapper *dw;
if (context->mode == E_MAIL_FORMATTER_MODE_RAW) {
string = e_mail_formatter_get_sub_html_header (formatter);
g_output_stream_write_all (
stream, string, strlen (string),
NULL, cancellable, NULL);
/* No need for body margins within