/*
* e-mail-formatter-print-headers.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
#include
#include
#include
#include
#include "e-mail-formatter-print.h"
#include "e-mail-formatter-utils.h"
#include "e-mail-inline-filter.h"
typedef EMailFormatterExtension EMailFormatterPrintHeaders;
typedef EMailFormatterExtensionClass EMailFormatterPrintHeadersClass;
GType e_mail_formatter_print_headers_get_type (void);
G_DEFINE_TYPE (
EMailFormatterPrintHeaders,
e_mail_formatter_print_headers,
E_TYPE_MAIL_FORMATTER_PRINT_EXTENSION)
static const gchar *formatter_mime_types[] = {
"application/vnd.evolution.headers",
NULL
};
static gboolean
emfpe_headers_format (EMailFormatterExtension *extension,
EMailFormatter *formatter,
EMailFormatterContext *context,
EMailPart *part,
CamelStream *stream,
GCancellable *cancellable)
{
struct _camel_header_raw raw_header;
GString *str, *tmp;
gchar *subject;
const gchar *buf;
gint attachments_count;
gchar *part_id_prefix;
const GQueue *headers;
GQueue queue = G_QUEUE_INIT;
GList *head, *link;
buf = camel_medium_get_header (CAMEL_MEDIUM (part->part), "subject");
subject = camel_header_decode_string (buf, "UTF-8");
str = g_string_new ("");
g_string_append_printf (str, "%s
\n", subject);
g_free (subject);
g_string_append (
str,
"");
camel_stream_write_string (stream, str->str, cancellable, NULL);
g_string_free (str, TRUE);
g_free (part_id_prefix);
return TRUE;
}
static void
e_mail_formatter_print_headers_class_init (EMailFormatterExtensionClass *class)
{
class->mime_types = formatter_mime_types;
class->format = emfpe_headers_format;
}
static void
e_mail_formatter_print_headers_init (EMailFormatterExtension *extension)
{
}