From 735dd1d0545d8769ac018ff3714c01d39057d7ce Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 13 Dec 2010 16:30:21 +0100 Subject: Bug #436914 - Reply to inline GPG quotes raw GPG message --- em-format/em-format-quote.c | 60 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index 6d6ed6a4ab..bdb632b252 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -30,6 +30,7 @@ #include #include +#include "em-inline-filter.h" #include "em-stripsig-filter.h" #include "em-format-quote.h" @@ -529,6 +530,52 @@ emfq_format_message (EMFormat *emf, cancellable, NULL); } +/* Decodes inline encoded parts of 'part'. The returned pointer, if not NULL, should + be unreffed with g_object_unref(). +*/ +static CamelMimePart * +decode_inline_parts (CamelMimePart *part, GCancellable *cancellable) +{ + CamelMultipart *mp; + CamelStream *null; + CamelStream *filtered_stream; + EMInlineFilter *inline_filter; + + g_return_val_if_fail (part != NULL, NULL); + + null = camel_stream_null_new (); + filtered_stream = camel_stream_filter_new (null); + g_object_unref (null); + + inline_filter = em_inline_filter_new (camel_mime_part_get_encoding (part), camel_mime_part_get_content_type (part)); + camel_stream_filter_add ( + CAMEL_STREAM_FILTER (filtered_stream), + CAMEL_MIME_FILTER (inline_filter)); + camel_data_wrapper_decode_to_stream_sync ( + camel_medium_get_content (CAMEL_MEDIUM (part)), (CamelStream *)filtered_stream, cancellable, NULL); + camel_stream_close ((CamelStream *)filtered_stream, cancellable, NULL); + g_object_unref (filtered_stream); + + if (!em_inline_filter_found_any (inline_filter)) { + g_object_unref (inline_filter); + return NULL; + } + + mp = em_inline_filter_get_multipart (inline_filter); + + g_object_unref (inline_filter); + + if (mp) { + part = camel_mime_part_new (); + camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (mp)); + g_object_unref (mp); + } else { + g_object_ref (part); + } + + return part; +} + static void emfq_text_plain (EMFormat *emf, CamelStream *stream, @@ -541,6 +588,7 @@ emfq_text_plain (EMFormat *emf, CamelStream *filtered_stream; CamelMimeFilter *html_filter; CamelMimeFilter *sig_strip; + CamelMimePart *mp; CamelContentType *type; const gchar *format; guint32 rgb = 0x737373, flags; @@ -548,6 +596,18 @@ emfq_text_plain (EMFormat *emf, if (!part) return; + mp = decode_inline_parts (part, cancellable); + if (mp) { + if (CAMEL_IS_MULTIPART (camel_medium_get_content (CAMEL_MEDIUM (mp)))) { + em_format_part (emf, stream, mp, cancellable); + g_object_unref (mp); + + return; + } + + g_object_unref (mp); + } + flags = emfq->text_html_flags; /* Check for RFC 2646 flowed text. */ -- cgit v1.2.3 From 6af0c53b697c6981c1470c177b2c37e081635258 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 29 Jan 2011 10:50:53 -0500 Subject: Coding style and whitespace cleanup. --- em-format/em-format-quote.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index bdb632b252..e2eb9d382b 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -530,9 +530,8 @@ emfq_format_message (EMFormat *emf, cancellable, NULL); } -/* Decodes inline encoded parts of 'part'. The returned pointer, if not NULL, should - be unreffed with g_object_unref(). -*/ +/* Decodes inline encoded parts of 'part'. The returned pointer, + * if not NULL, should be unreffed with g_object_unref(). */ static CamelMimePart * decode_inline_parts (CamelMimePart *part, GCancellable *cancellable) { @@ -547,13 +546,16 @@ decode_inline_parts (CamelMimePart *part, GCancellable *cancellable) filtered_stream = camel_stream_filter_new (null); g_object_unref (null); - inline_filter = em_inline_filter_new (camel_mime_part_get_encoding (part), camel_mime_part_get_content_type (part)); + inline_filter = em_inline_filter_new ( + camel_mime_part_get_encoding (part), + camel_mime_part_get_content_type (part)); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (inline_filter)); camel_data_wrapper_decode_to_stream_sync ( - camel_medium_get_content (CAMEL_MEDIUM (part)), (CamelStream *)filtered_stream, cancellable, NULL); - camel_stream_close ((CamelStream *)filtered_stream, cancellable, NULL); + camel_medium_get_content (CAMEL_MEDIUM (part)), + filtered_stream, cancellable, NULL); + camel_stream_close (filtered_stream, cancellable, NULL); g_object_unref (filtered_stream); if (!em_inline_filter_found_any (inline_filter)) { @@ -567,7 +569,8 @@ decode_inline_parts (CamelMimePart *part, GCancellable *cancellable) if (mp) { part = camel_mime_part_new (); - camel_medium_set_content (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (mp)); + camel_medium_set_content ( + CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (mp)); g_object_unref (mp); } else { g_object_ref (part); -- cgit v1.2.3 From 45c0f292624ea40f8b0debf7b5a5f60053c419ef Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 9 Mar 2011 17:41:47 +0100 Subject: Bug #586461 - Remove signature also from HTML formatted emails on reply --- em-format/em-format-quote.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index e2eb9d382b..e54ecf60ac 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -623,7 +623,7 @@ emfq_text_plain (EMFormat *emf, filtered_stream = camel_stream_filter_new (stream); if ((emfq->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) { - sig_strip = em_stripsig_filter_new (); + sig_strip = em_stripsig_filter_new (TRUE); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), sig_strip); g_object_unref (sig_strip); @@ -674,6 +674,7 @@ emfq_text_enriched (EMFormat *emf, camel_stream_write_string (stream, "


", cancellable, NULL); em_format_format_text ( emf, filtered_stream, CAMEL_DATA_WRAPPER (part), cancellable); + camel_stream_flush (filtered_stream, cancellable, NULL); g_object_unref (filtered_stream); } @@ -687,8 +688,23 @@ emfq_text_html (EMFormat *emf, { camel_stream_write_string ( stream, "\n\n", cancellable, NULL); - em_format_format_text ( - emf, stream, (CamelDataWrapper *)part, cancellable); + + if ((EM_FORMAT_QUOTE (emf)->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) { + CamelMimeFilter *sig_strip; + CamelStream *filtered_stream; + + filtered_stream = camel_stream_filter_new (stream); + + sig_strip = em_stripsig_filter_new (FALSE); + camel_stream_filter_add (CAMEL_STREAM_FILTER (filtered_stream), sig_strip); + g_object_unref (sig_strip); + + em_format_format_text (emf, filtered_stream, (CamelDataWrapper *) part, cancellable); + camel_stream_flush (filtered_stream, cancellable, NULL); + g_object_unref (filtered_stream); + } else { + em_format_format_text (emf, stream, (CamelDataWrapper *)part, cancellable); + } } static void -- cgit v1.2.3 From 578214584caa7805edca09b27e2306dc31d80fb6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 7 May 2011 12:22:36 -0400 Subject: Whitespace and coding style cleanups. --- em-format/em-format-quote.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index e54ecf60ac..be07485e3b 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -73,7 +73,8 @@ emfq_format_clone (EMFormat *emf, gconf = gconf_client_get_default (); camel_stream_reset (emfq->stream, NULL); - if (gconf_client_get_bool(gconf, "/apps/evolution/mail/composer/top_signature", NULL)) + if (gconf_client_get_bool ( + gconf, "/apps/evolution/mail/composer/top_signature", NULL)) camel_stream_printf (emfq->stream, "
\n"); g_object_unref (gconf); handle = em_format_find_handler(emf, "x-evolution/message/prefix"); @@ -696,14 +697,19 @@ emfq_text_html (EMFormat *emf, filtered_stream = camel_stream_filter_new (stream); sig_strip = em_stripsig_filter_new (FALSE); - camel_stream_filter_add (CAMEL_STREAM_FILTER (filtered_stream), sig_strip); + camel_stream_filter_add ( + CAMEL_STREAM_FILTER (filtered_stream), sig_strip); g_object_unref (sig_strip); - em_format_format_text (emf, filtered_stream, (CamelDataWrapper *) part, cancellable); + em_format_format_text ( + emf, filtered_stream, + (CamelDataWrapper *) part, cancellable); camel_stream_flush (filtered_stream, cancellable, NULL); g_object_unref (filtered_stream); } else { - em_format_format_text (emf, stream, (CamelDataWrapper *)part, cancellable); + em_format_format_text ( + emf, stream, + (CamelDataWrapper *) part, cancellable); } } -- cgit v1.2.3 From 54da4fc09cf226fdb59b9f0c70555e2e57dc1f91 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 May 2011 13:24:42 -0400 Subject: Coding style cleanups. --- em-format/em-format-quote.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index be07485e3b..f0a005f9ab 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -304,7 +304,7 @@ emfq_format_address (GString *out, struct _camel_header_address *a) g_string_append_printf (out, "%s <", name); /* rfc2368 for mailto syntax and url encoding extras */ - if ((real = camel_header_encode_phrase ((guchar *)a->name))) { + if ((real = camel_header_encode_phrase ((guchar *) a->name))) { mailaddr = g_strdup_printf ("%s <%s>", real, a->v.addr); g_free (real); mailto = camel_url_encode (mailaddr, "?=&()"); @@ -514,13 +514,13 @@ emfq_format_message (EMFormat *emf, "key=\"orig\" value=\"1\">-->\n" "
\n"); - if (((CamelMimePart *)emf->message) != part) { + if (((CamelMimePart *) emf->message) != part) { camel_stream_printf ( stream, "%s
\n", _("-------- Forwarded Message --------")); - emfq_format_headers (emfq, stream, (CamelMedium *)part); + emfq_format_headers (emfq, stream, (CamelMedium *) part); } else if (emfq->flags & EM_FORMAT_QUOTE_HEADERS) - emfq_format_headers (emfq, stream, (CamelMedium *)part); + emfq_format_headers (emfq, stream, (CamelMedium *) part); em_format_part (emf, stream, part, cancellable); -- cgit v1.2.3 From d9ee2fc9c62739ea7dca2fbe9159e1cec9d2784d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 5 Jul 2011 09:12:41 -0400 Subject: EMFormatQuote cleanups. Move public members to the private struct. --- em-format/em-format-quote.c | 77 +++++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 23 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index f0a005f9ab..a8f1bf329a 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -34,22 +34,45 @@ #include "em-stripsig-filter.h" #include "em-format-quote.h" +#define EM_FORMAT_QUOTE_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), EM_TYPE_FORMAT_QUOTE, EMFormatQuotePrivate)) + struct _EMFormatQuotePrivate { - gint dummy; + gchar *credits; + CamelStream *stream; + EMFormatQuoteFlags flags; + guint32 text_html_flags; }; static void emfq_builtin_init (EMFormatQuoteClass *efhc); static gpointer parent_class; +static void +emfq_dispose (GObject *object) +{ + EMFormatQuotePrivate *priv; + + priv = EM_FORMAT_QUOTE_GET_PRIVATE (object); + + if (priv->stream != NULL) { + g_object_unref (priv->stream); + priv->stream = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + static void emfq_finalize (GObject *object) { - EMFormatQuote *emfq =(EMFormatQuote *) object; + EMFormatQuotePrivate *priv; - if (emfq->stream) - g_object_unref (emfq->stream); - g_free (emfq->credits); + priv = EM_FORMAT_QUOTE_GET_PRIVATE (object); + + g_free (priv->credits); /* Chain up to parent's finalize() method. */ G_OBJECT_CLASS (parent_class)->finalize (object); @@ -72,25 +95,25 @@ emfq_format_clone (EMFormat *emf, emf, folder, uid, msg, src, cancellable); gconf = gconf_client_get_default (); - camel_stream_reset (emfq->stream, NULL); + camel_stream_reset (emfq->priv->stream, NULL); if (gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/top_signature", NULL)) - camel_stream_printf (emfq->stream, "
\n"); + camel_stream_printf (emfq->priv->stream, "
\n"); g_object_unref (gconf); handle = em_format_find_handler(emf, "x-evolution/message/prefix"); if (handle) handle->handler ( - emf, emfq->stream, + emf, emfq->priv->stream, CAMEL_MIME_PART (msg), handle, cancellable, FALSE); handle = em_format_find_handler(emf, "x-evolution/message/rfc822"); if (handle) handle->handler ( - emf, emfq->stream, + emf, emfq->priv->stream, CAMEL_MIME_PART (msg), handle, cancellable, FALSE); - camel_stream_flush (emfq->stream, cancellable, NULL); + camel_stream_flush (emfq->priv->stream, cancellable, NULL); g_signal_emit_by_name(emf, "complete"); } @@ -149,7 +172,7 @@ emfq_format_attachment (EMFormat *emf, /* output some info about it */ text = em_format_describe_part (part, mime_type); html = camel_text_to_html ( - text, emfq->text_html_flags & + text, emfq->priv->text_html_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0); camel_stream_write_string (stream, html, cancellable, NULL); g_free (html); @@ -177,6 +200,7 @@ emfq_class_init (EMFormatQuoteClass *class) g_type_class_add_private (class, sizeof (EMFormatQuotePrivate)); object_class = G_OBJECT_CLASS (class); + object_class->dispose = emfq_dispose; object_class->finalize = emfq_finalize; format_class = EM_FORMAT_CLASS (class); @@ -189,8 +213,10 @@ emfq_class_init (EMFormatQuoteClass *class) static void emfq_init (EMFormatQuote *emfq) { + emfq->priv = EM_FORMAT_QUOTE_GET_PRIVATE (emfq); + /* we want to convert url's etc */ - emfq->text_html_flags = + emfq->priv->text_html_flags = CAMEL_MIME_FILTER_TOHTML_PRE | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES; @@ -233,9 +259,9 @@ em_format_quote_new (const gchar *credits, emfq = g_object_new (EM_TYPE_FORMAT_QUOTE, NULL); - emfq->credits = g_strdup (credits); - emfq->stream = g_object_ref (stream); - emfq->flags = flags; + emfq->priv->credits = g_strdup (credits); + emfq->priv->stream = g_object_ref (stream); + emfq->priv->flags = flags; return emfq; } @@ -494,8 +520,9 @@ emfq_format_message_prefix (EMFormat *emf, { EMFormatQuote *emfq = (EMFormatQuote *) emf; - if (emfq->credits) - camel_stream_printf(stream, "%s
\n", emfq->credits); + if (emfq->priv->credits != NULL) + camel_stream_printf ( + stream, "%s
\n", emfq->priv->credits); } static void @@ -508,7 +535,7 @@ emfq_format_message (EMFormat *emf, { EMFormatQuote *emfq = (EMFormatQuote *) emf; - if (emfq->flags & EM_FORMAT_QUOTE_CITE) + if (emfq->priv->flags & EM_FORMAT_QUOTE_CITE) camel_stream_printf ( stream, "\n" @@ -519,12 +546,12 @@ emfq_format_message (EMFormat *emf, stream, "%s
\n", _("-------- Forwarded Message --------")); emfq_format_headers (emfq, stream, (CamelMedium *) part); - } else if (emfq->flags & EM_FORMAT_QUOTE_HEADERS) + } else if (emfq->priv->flags & EM_FORMAT_QUOTE_HEADERS) emfq_format_headers (emfq, stream, (CamelMedium *) part); em_format_part (emf, stream, part, cancellable); - if (emfq->flags & EM_FORMAT_QUOTE_CITE) + if (emfq->priv->flags & EM_FORMAT_QUOTE_CITE) camel_stream_write_string ( stream, "
", @@ -612,7 +639,7 @@ emfq_text_plain (EMFormat *emf, g_object_unref (mp); } - flags = emfq->text_html_flags; + flags = emfq->priv->text_html_flags; /* Check for RFC 2646 flowed text. */ type = camel_mime_part_get_content_type (part); @@ -623,7 +650,7 @@ emfq_text_plain (EMFormat *emf, filtered_stream = camel_stream_filter_new (stream); - if ((emfq->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) { + if ((emfq->priv->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) { sig_strip = em_stripsig_filter_new (TRUE); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), sig_strip); @@ -687,10 +714,14 @@ emfq_text_html (EMFormat *emf, GCancellable *cancellable, gboolean is_fallback) { + EMFormatQuotePrivate *priv; + + priv = EM_FORMAT_QUOTE_GET_PRIVATE (emf); + camel_stream_write_string ( stream, "\n\n", cancellable, NULL); - if ((EM_FORMAT_QUOTE (emf)->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) { + if ((priv->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) { CamelMimeFilter *sig_strip; CamelStream *filtered_stream; -- cgit v1.2.3 From c72aba8f7c13cdc68b1f3dbc1d381be45e0c4cb8 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 5 Jul 2011 08:16:13 -0400 Subject: Prefer g_seekable_seek() over camel_stream_reset(). When a stream is obviously a file or memory stream (both of which implement the GSeekable interface), use g_seekable_seek() instead of camel_stream_reset(). This is helping me discover if it's safe to remove camel_stream_reset(). We want to eventually move to GIO streams, which have no reset method. --- em-format/em-format-quote.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index a8f1bf329a..a5a8d0de65 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -94,8 +94,11 @@ emfq_format_clone (EMFormat *emf, EM_FORMAT_CLASS (parent_class)->format_clone ( emf, folder, uid, msg, src, cancellable); + g_seekable_seek ( + G_SEEKABLE (emfq->priv->stream), + 0, G_SEEK_SET, NULL, NULL); + gconf = gconf_client_get_default (); - camel_stream_reset (emfq->priv->stream, NULL); if (gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/top_signature", NULL)) camel_stream_printf (emfq->priv->stream, "
\n"); @@ -257,6 +260,9 @@ em_format_quote_new (const gchar *credits, g_return_val_if_fail (CAMEL_IS_STREAM (stream), NULL); + /* Steam must also be seekable so we can reset its position. */ + g_return_val_if_fail (G_IS_SEEKABLE (stream), NULL); + emfq = g_object_new (EM_TYPE_FORMAT_QUOTE, NULL); emfq->priv->credits = g_strdup (credits); -- cgit v1.2.3 From af704b849e6a28582ca6d75b0ee0ef3a867587cf Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 5 Jul 2011 14:02:01 -0400 Subject: Avoid camel_stream_printf(). camel_stream_printf() is next on the chopping block. Use g_strdup_printf() or a GString to construct a formatted string in memory, pass it to camel_stream_write() in one go, and then check for errors (unless it's a memory stream). --- em-format/em-format-quote.c | 50 +++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index a5a8d0de65..c11476a6d5 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -101,7 +101,8 @@ emfq_format_clone (EMFormat *emf, gconf = gconf_client_get_default (); if (gconf_client_get_bool ( gconf, "/apps/evolution/mail/composer/top_signature", NULL)) - camel_stream_printf (emfq->priv->stream, "
\n"); + camel_stream_write_string ( + emfq->priv->stream, "
\n", cancellable, NULL); g_object_unref (gconf); handle = em_format_find_handler(emf, "x-evolution/message/prefix"); if (handle) @@ -274,7 +275,7 @@ em_format_quote_new (const gchar *credits, static void emfq_format_text_header (EMFormatQuote *emfq, - CamelStream *stream, + GString *buffer, const gchar *label, const gchar *value, guint32 flags, @@ -295,9 +296,11 @@ emfq_format_text_header (EMFormatQuote *emfq, html = value; if (flags & EM_FORMAT_HEADER_BOLD) - camel_stream_printf (stream, "%s: %s
", label, html); + g_string_append_printf ( + buffer, "%s: %s
", label, html); else - camel_stream_printf (stream, "%s: %s
", label, html); + g_string_append_printf ( + buffer, "%s: %s
", label, html); g_free (mhtml); } @@ -399,7 +402,7 @@ canon_header_name (gchar *name) static void emfq_format_header (EMFormat *emf, - CamelStream *stream, + GString *buffer, CamelMedium *part, const gchar *namein, guint32 flags, @@ -482,14 +485,14 @@ emfq_format_header (EMFormat *emf, g_free (buf); } - emfq_format_text_header (emfq, stream, label, txt, flags, is_html); + emfq_format_text_header (emfq, buffer, label, txt, flags, is_html); g_free (value); } static void emfq_format_headers (EMFormatQuote *emfq, - CamelStream *stream, + GString *buffer, CamelMedium *part) { EMFormat *emf = (EMFormat *) emfq; @@ -509,11 +512,11 @@ emfq_format_headers (EMFormatQuote *emfq, while (link != NULL) { EMFormatHeader *h = link->data; emfq_format_header ( - emf, stream, part, h->name, h->flags, charset); + emf, buffer, part, h->name, h->flags, charset); link = g_list_next (link); } - camel_stream_printf(stream, "
\n"); + g_string_append (buffer, "
\n"); } static void @@ -526,9 +529,12 @@ emfq_format_message_prefix (EMFormat *emf, { EMFormatQuote *emfq = (EMFormatQuote *) emf; - if (emfq->priv->credits != NULL) - camel_stream_printf ( - stream, "%s
\n", emfq->priv->credits); + if (emfq->priv->credits != NULL) { + camel_stream_write_string ( + stream, emfq->priv->credits, NULL, NULL); + camel_stream_write_string ( + stream, "
\n", NULL, NULL); + } } static void @@ -540,20 +546,28 @@ emfq_format_message (EMFormat *emf, gboolean is_fallback) { EMFormatQuote *emfq = (EMFormatQuote *) emf; + GString *buffer; + + buffer = g_string_sized_new (1024); if (emfq->priv->flags & EM_FORMAT_QUOTE_CITE) - camel_stream_printf ( - stream, "\n" "
\n"); if (((CamelMimePart *) emf->message) != part) { - camel_stream_printf ( - stream, "%s
\n", + g_string_append_printf ( + buffer, + "%s
\n", _("-------- Forwarded Message --------")); - emfq_format_headers (emfq, stream, (CamelMedium *) part); + emfq_format_headers (emfq, buffer, (CamelMedium *) part); } else if (emfq->priv->flags & EM_FORMAT_QUOTE_HEADERS) - emfq_format_headers (emfq, stream, (CamelMedium *) part); + emfq_format_headers (emfq, buffer, (CamelMedium *) part); + + camel_stream_write ( + stream, buffer->str, buffer->len, cancellable, NULL); em_format_part (emf, stream, part, cancellable); -- cgit v1.2.3 From 777c1cbd40eb63365f2c28e38f6a93beb2d1c9d1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 16 Aug 2011 11:25:56 -0400 Subject: Coding style and whitespace cleanup. --- em-format/em-format-quote.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index c11476a6d5..e6e71187c1 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -321,7 +321,8 @@ static gchar *i18n_hdrs[] = { #endif static void -emfq_format_address (GString *out, struct _camel_header_address *a) +emfq_format_address (GString *out, + struct _camel_header_address *a) { guint32 flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES; gchar *name, *mailto, *addr; @@ -581,7 +582,8 @@ emfq_format_message (EMFormat *emf, /* Decodes inline encoded parts of 'part'. The returned pointer, * if not NULL, should be unreffed with g_object_unref(). */ static CamelMimePart * -decode_inline_parts (CamelMimePart *part, GCancellable *cancellable) +decode_inline_parts (CamelMimePart *part, + GCancellable *cancellable) { CamelMultipart *mp; CamelStream *null; -- cgit v1.2.3 From 1b78f1e67460d8a35c3f49dd64fc36c5410881ec Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 18 Oct 2011 23:28:27 +0200 Subject: Migrate em-format* to GSettings --- em-format/em-format-quote.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'em-format/em-format-quote.c') diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c index e6e71187c1..fbbd3bcd78 100644 --- a/em-format/em-format-quote.c +++ b/em-format/em-format-quote.c @@ -28,7 +28,6 @@ #include #include -#include #include "em-inline-filter.h" #include "em-stripsig-filter.h" @@ -88,7 +87,7 @@ emfq_format_clone (EMFormat *emf, { EMFormatQuote *emfq = (EMFormatQuote *) emf; const EMFormatHandler *handle; - GConfClient *gconf; + GSettings *settings; /* Chain up to parent's format_clone() method. */ EM_FORMAT_CLASS (parent_class)->format_clone ( @@ -98,12 +97,12 @@ emfq_format_clone (EMFormat *emf, G_SEEKABLE (emfq->priv->stream), 0, G_SEEK_SET, NULL, NULL); - gconf = gconf_client_get_default (); - if (gconf_client_get_bool ( - gconf, "/apps/evolution/mail/composer/top_signature", NULL)) + settings = g_settings_new ("org.gnome.evolution.mail"); + if (g_settings_get_boolean ( + settings, "composer-top-signature")) camel_stream_write_string ( emfq->priv->stream, "
\n", cancellable, NULL); - g_object_unref (gconf); + g_object_unref (settings); handle = em_format_find_handler(emf, "x-evolution/message/prefix"); if (handle) handle->handler ( -- cgit v1.2.3