/*
* 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; either
* version 2 of the License, or (at your option) version 3.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see
*
*/
#ifdef HAVE_CONFIG_H
#include
#endif
#include "e-mail-format-extensions.h"
#include
#include
#include
#include
#include
#include
#include
typedef EMailFormatterExtension EMailFormatterTextPlain;
typedef EMailFormatterExtensionClass EMailFormatterTextPlainClass;
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,
CamelStream *stream,
GCancellable *cancellable)
{
CamelDataWrapper *dw;
CamelStream *filtered_stream;
CamelMimeFilter *html_filter;
gchar *content;
const gchar *format;
guint32 filter_flags;
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)) {
if (context->mode == E_MAIL_FORMATTER_MODE_RAW) {
gchar *header;
header = e_mail_formatter_get_html_header (formatter);
camel_stream_write_string (stream, header, cancellable, NULL);
g_free (header);
/* No need for body margins within