aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-08 02:06:51 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-06-08 12:25:15 +0800
commit06e391117a952e08d8013f5a825f2a075633e3aa (patch)
tree6ee76e89ead085e22cd565dde43d20e47387d80e /em-format
parent93d5cdd57ab0123dd17dcae7e853da8ffe0e0241 (diff)
downloadgsoc2013-evolution-06e391117a952e08d8013f5a825f2a075633e3aa.tar
gsoc2013-evolution-06e391117a952e08d8013f5a825f2a075633e3aa.tar.gz
gsoc2013-evolution-06e391117a952e08d8013f5a825f2a075633e3aa.tar.bz2
gsoc2013-evolution-06e391117a952e08d8013f5a825f2a075633e3aa.tar.lz
gsoc2013-evolution-06e391117a952e08d8013f5a825f2a075633e3aa.tar.xz
gsoc2013-evolution-06e391117a952e08d8013f5a825f2a075633e3aa.tar.zst
gsoc2013-evolution-06e391117a952e08d8013f5a825f2a075633e3aa.zip
EMailFormatterQuoteHeaders: Avoid EMailFormatter header API.
Use e_mail_part_headers_dup_default_headers() to extract specific headers to show in the desired order.
Diffstat (limited to 'em-format')
-rw-r--r--em-format/e-mail-formatter-quote-headers.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/em-format/e-mail-formatter-quote-headers.c b/em-format/e-mail-formatter-quote-headers.c
index 5820e0be1a..e95e0c9489 100644
--- a/em-format/e-mail-formatter-quote-headers.c
+++ b/em-format/e-mail-formatter-quote-headers.c
@@ -31,6 +31,7 @@
#include "e-mail-formatter-quote.h"
#include "e-mail-formatter-utils.h"
#include "e-mail-inline-filter.h"
+#include "e-mail-part-headers.h"
typedef EMailFormatterExtension EMailFormatterQuoteHeaders;
typedef EMailFormatterExtensionClass EMailFormatterQuoteHeadersClass;
@@ -90,19 +91,21 @@ static void
emfqe_format_header (EMailFormatter *formatter,
GString *buffer,
EMailPart *part,
- struct _camel_header_raw *header,
- guint32 flags,
+ const gchar *header_name,
const gchar *charset)
{
CamelMimePart *mime_part;
+ EMailFormatterHeaderFlags flags;
gchar *canon_name, *buf, *value = NULL;
const gchar *txt, *label;
gboolean addrspec = FALSE;
gint is_html = FALSE;
gint i;
- canon_name = g_alloca (strlen (header->name) + 1);
- strcpy (canon_name, header->name);
+ flags = E_MAIL_FORMATTER_HEADER_FLAG_NOELIPSIZE;
+
+ canon_name = g_alloca (strlen (header_name) + 1);
+ strcpy (canon_name, header_name);
e_mail_formatter_canon_header_name (canon_name);
/* Never quote Bcc/Resent-Bcc headers. */
@@ -223,12 +226,11 @@ emqfe_headers_format (EMailFormatterExtension *extension,
CamelContentType *ct;
CamelMimePart *mime_part;
const gchar *charset;
- GList *iter;
GString *buffer;
- GQueue *headers_queue;
+ gchar **default_headers;
+ guint ii, length = 0;
- if (part == NULL)
- return FALSE;
+ g_return_val_if_fail (E_IS_MAIL_PART_HEADERS (part), FALSE);
mime_part = e_mail_part_ref_mime_part (part);
@@ -239,28 +241,18 @@ emqfe_headers_format (EMailFormatterExtension *extension,
buffer = g_string_new ("");
/* dump selected headers */
- headers_queue = e_mail_formatter_dup_headers (formatter);
- for (iter = headers_queue->head; iter; iter = iter->next) {
- struct _camel_header_raw *raw_header;
- EMailFormatterHeader *h = iter->data;
- guint32 flags;
-
- flags = h->flags & ~E_MAIL_FORMATTER_HEADER_FLAG_HTML;
- flags |= E_MAIL_FORMATTER_HEADER_FLAG_NOELIPSIZE;
-
- for (raw_header = mime_part->headers; raw_header; raw_header = raw_header->next) {
- if (g_strcmp0 (raw_header->name, h->name) == 0) {
+ default_headers = e_mail_part_headers_dup_default_headers (
+ E_MAIL_PART_HEADERS (part));
+ if (default_headers != NULL)
+ length = g_strv_length (default_headers);
- emfqe_format_header (
- formatter, buffer, part,
- raw_header, flags, charset);
- break;
- }
- }
- }
+ for (ii = 0; ii < length; ii++)
+ emfqe_format_header (
+ formatter, buffer, part,
+ default_headers[ii], charset);
- g_queue_free_full (headers_queue, (GDestroyNotify) e_mail_formatter_header_free);
+ g_strfreev (default_headers);
g_string_append (buffer, "<br>\n");