aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-07-06 02:02:01 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-07-06 02:40:10 +0800
commit005a26de4534cfaf534e8e4828366b619a3b21d1 (patch)
treee9247d1dfa10750a07335647cf37f43b158a8817
parent17127fbee9fd1b0baecb4e305c005d6abbf8d880 (diff)
downloadgsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.tar
gsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.tar.gz
gsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.tar.bz2
gsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.tar.lz
gsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.tar.xz
gsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.tar.zst
gsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.zip
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).
-rw-r--r--em-format/em-format-quote.c50
-rw-r--r--mail/em-composer-utils.c25
-rw-r--r--mail/em-format-html-display.c185
-rw-r--r--mail/em-format-html.c323
-rw-r--r--plugins/audio-inline/audio-inline.c20
-rw-r--r--plugins/image-inline/image-inline.c6
-rw-r--r--plugins/itip-formatter/itip-formatter.c11
-rw-r--r--plugins/vcard-inline/vcard-inline.c6
8 files changed, 441 insertions, 185 deletions
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, "<br>\n");
+ camel_stream_write_string (
+ emfq->priv->stream, "<br>\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, "<b>%s</b>: %s<br>", label, html);
+ g_string_append_printf (
+ buffer, "<b>%s</b>: %s<br>", label, html);
else
- camel_stream_printf (stream, "%s: %s<br>", label, html);
+ g_string_append_printf (
+ buffer, "%s: %s<br>", 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, "<br>\n");
+ g_string_append (buffer, "<br>\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<br>\n", emfq->priv->credits);
+ if (emfq->priv->credits != NULL) {
+ camel_stream_write_string (
+ stream, emfq->priv->credits, NULL, NULL);
+ camel_stream_write_string (
+ stream, "<br>\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, "<!--+GtkHTML:<DATA class=\"ClueFlow\" "
+ g_string_append (
+ buffer,
+ "<!--+GtkHTML:<DATA class=\"ClueFlow\" "
"key=\"orig\" value=\"1\">-->\n"
"<blockquote type=cite>\n");
if (((CamelMimePart *) emf->message) != part) {
- camel_stream_printf (
- stream, "%s</br>\n",
+ g_string_append_printf (
+ buffer,
+ "%s</br>\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);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index c3b5465015..1a964e7347 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1926,6 +1926,7 @@ em_utils_send_receipt (EMailSession *session,
gchar *self_address, *receipt_subject;
gchar *ua, *recipient;
gchar *transport_uid;
+ gchar *content;
message_id = camel_medium_get_header (
CAMEL_MEDIUM (message), "Message-ID");
@@ -1968,15 +1969,17 @@ em_utils_send_receipt (EMailSession *session,
camel_content_type_set_param (type, "charset", "UTF-8");
camel_data_wrapper_set_mime_type_field (receipt_text, type);
camel_content_type_unref (type);
- stream = camel_stream_mem_new ();
- camel_stream_printf (stream,
- /* Translators: First %s is an email address, second %s
- * is the subject of the email, third %s is the date. */
+ content = g_strdup_printf (
+ /* Translators: First %s is an email address, second %s
+ * is the subject of the email, third %s is the date. */
_("Your message to %s about \"%s\" on %s has been read."),
self_address, message_subject, message_date);
+ stream = camel_stream_mem_new ();
+ camel_stream_write_string (stream, content, NULL, NULL);
camel_data_wrapper_construct_from_stream_sync (
receipt_text, stream, NULL, NULL);
g_object_unref (stream);
+ g_free (content);
part = camel_mime_part_new ();
camel_medium_set_content (CAMEL_MEDIUM (part), receipt_text);
@@ -1999,16 +2002,18 @@ em_utils_send_receipt (EMailSession *session,
camel_data_wrapper_set_mime_type_field (receipt_data, type);
camel_content_type_unref (type);
+ content = g_strdup_printf (
+ "Reporting-UA: %s\n"
+ "Final-Recipient: %s\n"
+ "Original-Message-ID: %s\n"
+ "Disposition: manual-action/MDN-sent-manually; displayed\n",
+ ua, recipient, message_id);
stream = camel_stream_mem_new ();
- camel_stream_printf (stream,
- "Reporting-UA: %s\n"
- "Final-Recipient: %s\n"
- "Original-Message-ID: %s\n"
- "Disposition: manual-action/MDN-sent-manually; displayed\n",
- ua, recipient, message_id);
+ camel_stream_write_string (stream, content, NULL, NULL);
camel_data_wrapper_construct_from_stream_sync (
receipt_data, stream, NULL, NULL);
g_object_unref (stream);
+ g_free (content);
g_free (ua);
g_free (recipient);
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 75cb530ed9..90b60ac20d 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -435,6 +435,7 @@ efhd_format_attachment (EMFormat *emf,
const EMFormatHandler *handle,
GCancellable *cancellable)
{
+ GString *buffer;
gchar *classid, *text, *html;
struct _attach_puri *info;
@@ -458,20 +459,22 @@ efhd_format_attachment (EMFormat *emf,
info->encrypt = emf->valid->encrypt.status;
}
- camel_stream_write_string (
- stream, EM_FORMAT_HTML_VPAD
- "<table cellspacing=0 cellpadding=0><tr><td>"
- "<table width=10 cellspacing=0 cellpadding=0>"
- "<tr><td></td></tr></table></td>",
- cancellable, NULL);
-
- camel_stream_printf (
- stream, "<td><object classid=\"%s\"></object></td>", classid);
+ buffer = g_string_sized_new (1024);
- camel_stream_write_string (
- stream, "<td><table width=3 cellspacing=0 cellpadding=0>"
- "<tr><td></td></tr></table></td><td><font size=-1>",
- cancellable, NULL);
+ g_string_append_printf (
+ buffer, EM_FORMAT_HTML_VPAD
+ "<table cellspacing=0 cellpadding=0>"
+ "<tr><td>"
+ "<table width=10 cellspacing=0 cellpadding=0>"
+ "<tr><td></td><tr>"
+ "</table>"
+ "</td>"
+ "<td><object classid=\"%s\"></object></td>"
+ "<td><table width=3 cellspacing=0 cellpadding=0>"
+ "<tr><td></td></tr>"
+ "</table></td>"
+ "<td><font size=-1>",
+ classid);
/* output some info about it */
/* FIXME: should we look up mime_type from object again? */
@@ -479,13 +482,20 @@ efhd_format_attachment (EMFormat *emf,
html = camel_text_to_html (
text, EM_FORMAT_HTML (emf)->text_html_flags &
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_write_string (stream, html, cancellable, NULL);
+ g_string_append (buffer, html);
g_free (html);
g_free (text);
- camel_stream_write_string (
- stream, "</font></td></tr><tr></table>\n"
- EM_FORMAT_HTML_VPAD, cancellable, NULL);
+ g_string_append (
+ buffer,
+ "</font></td>"
+ "</tr><tr></table>\n"
+ EM_FORMAT_HTML_VPAD);
+
+ camel_stream_write (
+ stream, buffer->str, buffer->len, cancellable, NULL);
+
+ g_string_free (buffer, TRUE);
if (handle && info->shown)
handle->handler (
@@ -504,6 +514,7 @@ efhd_format_optional (EMFormat *emf,
gchar *classid, *html;
struct _attach_puri *info;
CamelStream *stream = NULL;
+ GString *buffer;
if (CAMEL_IS_STREAM_FILTER (fstream))
stream = camel_stream_filter_get_source (
@@ -530,10 +541,12 @@ efhd_format_optional (EMFormat *emf,
info->encrypt = emf->valid->encrypt.status;
}
- camel_stream_write_string (
- stream, EM_FORMAT_HTML_VPAD
+ buffer = g_string_sized_new (1024);
+
+ g_string_append (
+ buffer, EM_FORMAT_HTML_VPAD
"<table cellspacing=0 cellpadding=0><tr><td>"
- "<h3><font size=-1 color=red>", cancellable, NULL);
+ "<h3><font size=-1 color=red>");
html = camel_text_to_html (
_("Evolution cannot render this email as it is too "
@@ -541,21 +554,21 @@ efhd_format_optional (EMFormat *emf,
"with an external text editor."),
EM_FORMAT_HTML (emf)->text_html_flags &
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_write_string (stream, html, cancellable, NULL);
- camel_stream_write_string (
- stream, "</font></h3></td></tr></table>\n",
- cancellable, NULL);
- camel_stream_write_string (
- stream, "<table cellspacing=0 cellpadding=0><tr>",
- cancellable, NULL);
- camel_stream_printf (
- stream, "<td><object classid=\"%s\"></object>"
- "</td></tr></table>", classid);
-
+ g_string_append (buffer, html);
g_free (html);
- camel_stream_write_string (
- stream, EM_FORMAT_HTML_VPAD, cancellable, NULL);
+ g_string_append_printf (
+ buffer,
+ "</font></h3></td></tr></table>\n"
+ "<table cellspacing=0 cellpadding=0><tr>"
+ "<td><object classid=\"%s\"></object>"
+ "</td></tr></table>" EM_FORMAT_HTML_VPAD,
+ classid);
+
+ camel_stream_write (
+ stream, buffer->str, buffer->len, cancellable, NULL);
+
+ g_string_free (buffer, TRUE);
g_free (classid);
}
@@ -575,11 +588,15 @@ efhd_format_secure (EMFormat *emf,
if (emf->valid == valid
&& (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE
|| valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)) {
+ GString *buffer;
gchar *classid;
struct _smime_pobject *pobj;
- camel_stream_printf (
- stream, "<table border=0 width=\"100%%\" "
+ buffer = g_string_sized_new (1024);
+
+ g_string_append_printf (
+ buffer,
+ "<table border=0 width=\"100%%\" "
"cellpadding=3 cellspacing=0%s><tr>",
smime_sign_colour[valid->sign.status]);
@@ -591,8 +608,9 @@ efhd_format_secure (EMFormat *emf,
classid, part, efhd_xpkcs7mime_button);
pobj->valid = camel_cipher_validity_clone (valid);
pobj->object.free = efhd_xpkcs7mime_free;
- camel_stream_printf (
- stream, "<td valign=center><object classid=\"%s\">"
+ g_string_append_printf (
+ buffer,
+ "<td valign=center><object classid=\"%s\">"
"</object></td><td width=100%% valign=center>",
classid);
g_free (classid);
@@ -605,11 +623,13 @@ efhd_format_secure (EMFormat *emf,
status = valid->sign.status;
desc = smime_sign_table[status].shortdesc;
- camel_stream_printf (stream, "%s", gettext (desc));
+ g_string_append (buffer, gettext (desc));
- signers = em_format_html_format_cert_infos ((CamelCipherCertInfo *) valid->sign.signers.head);
+ signers = em_format_html_format_cert_infos (
+ (CamelCipherCertInfo *) valid->sign.signers.head);
if (signers && *signers) {
- camel_stream_printf (stream, " (%s)", signers);
+ g_string_append_printf (
+ buffer, " (%s)", signers);
}
g_free (signers);
}
@@ -618,16 +638,20 @@ efhd_format_secure (EMFormat *emf,
const gchar *desc;
gint status;
- if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
- camel_stream_printf (stream, "<br>");
- }
+ if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)
+ g_string_append (buffer, "<br>");
status = valid->encrypt.status;
desc = smime_encrypt_table[status].shortdesc;
- camel_stream_printf (stream, "%s", gettext (desc));
+ g_string_append (buffer, gettext (desc));
}
- camel_stream_printf(stream, "</td></tr></table>");
+ g_string_append (buffer, "</td></tr></table>");
+
+ camel_stream_write (
+ stream, buffer->str, buffer->len, cancellable, NULL);
+
+ g_string_free (buffer, TRUE);
}
}
@@ -769,14 +793,20 @@ efhd_message_prefix (EMFormat *emf,
const gchar *flag, *comp, *due;
time_t date;
gchar *iconpath, *due_date_str;
+ GString *buffer;
if (emf->folder == NULL || emf->uid == NULL
|| (flag = camel_folder_get_message_user_tag(emf->folder, emf->uid, "follow-up")) == NULL
|| flag[0] == 0)
return;
+ buffer = g_string_sized_new (1024);
+
/* header displayed for message-flags in mail display */
- camel_stream_printf(stream, "<table border=1 width=\"100%%\" cellspacing=2 cellpadding=2><tr>");
+ g_string_append (
+ buffer,
+ "<table border=1 width=\"100%%\" "
+ "cellspacing=2 cellpadding=2><tr>");
comp = camel_folder_get_message_user_tag(emf->folder, emf->uid, "completed-on");
iconpath = e_icon_factory_get_icon_filename (comp && comp[0] ? "stock_mail-flag-for-followup-done" : "stock_mail-flag-for-followup", GTK_ICON_SIZE_MENU);
@@ -790,20 +820,33 @@ efhd_message_prefix (EMFormat *emf,
if (iconpart) {
gchar *classid;
- classid = g_strdup_printf("icon:///em-format-html-display/%s/%s", emf->part_id->str, comp&&comp[0]?"comp":"uncomp");
- camel_stream_printf(stream, "<td align=\"left\"><img src=\"%s\"></td>", classid);
- (void) em_format_add_puri (emf, sizeof (EMFormatPURI), classid, iconpart, efhd_write_image);
+ classid = g_strdup_printf (
+ "icon:///em-format-html-display/%s/%s",
+ emf->part_id->str,
+ comp && comp[0] ? "comp" : "uncomp");
+ g_string_append_printf (
+ buffer,
+ "<td align=\"left\">"
+ "<img src=\"%s\"></td>",
+ classid);
+ (void) em_format_add_puri (
+ emf, sizeof (EMFormatPURI),
+ classid, iconpart, efhd_write_image);
g_free (classid);
g_object_unref (iconpart);
}
}
- camel_stream_printf(stream, "<td align=\"left\" width=\"100%%\">");
+ g_string_append (buffer, "<td align=\"left\" width=\"100%%\">");
if (comp && comp[0]) {
date = camel_header_decode_date (comp, NULL);
- due_date_str = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, date);
- camel_stream_printf (stream, "%s, %s %s", flag, _("Completed on"), due_date_str ? due_date_str : "???");
+ due_date_str = e_datetime_format_format (
+ "mail", "header", DTFormatKindDateTime, date);
+ g_string_append_printf (
+ buffer, "%s, %s %s",
+ flag, _("Completed on"),
+ due_date_str ? due_date_str : "???");
g_free (due_date_str);
} else if ((due = camel_folder_get_message_user_tag(emf->folder, emf->uid, "due-by")) != NULL && due[0]) {
time_t now;
@@ -811,16 +854,30 @@ efhd_message_prefix (EMFormat *emf,
date = camel_header_decode_date (due, NULL);
now = time (NULL);
if (now > date)
- camel_stream_printf(stream, "<b>%s</b>&nbsp;", _("Overdue:"));
-
- due_date_str = e_datetime_format_format ("mail", "header", DTFormatKindDateTime, date);
- /* To Translators: the "by" is part of the string, like "Follow-up by Tuesday, January 13, 2009" */
- camel_stream_printf (stream, "%s %s %s", flag, _("by"), due_date_str ? due_date_str : "???");
+ g_string_append_printf (
+ buffer,
+ "<b>%s</b>&nbsp;",
+ _("Overdue:"));
+
+ due_date_str = e_datetime_format_format (
+ "mail", "header", DTFormatKindDateTime, date);
+ /* Translators: the "by" is part of the string,
+ * like "Follow-up by Tuesday, January 13, 2009" */
+ g_string_append_printf (
+ buffer, "%s %s %s",
+ flag, _("by"),
+ due_date_str ? due_date_str : "???");
+ g_free (due_date_str);
} else {
- camel_stream_printf(stream, "%s", flag);
+ g_string_append (buffer, flag);
}
- camel_stream_printf(stream, "</td></tr></table>");
+ g_string_append (buffer, "</td></tr></table>");
+
+ camel_stream_write (
+ stream, buffer->str, buffer->len, cancellable, NULL);
+
+ g_string_free (buffer, TRUE);
}
/* ********************************************************************** */
@@ -1053,8 +1110,10 @@ efhd_message_add_bar (EMFormat *emf,
const EMFormatHandler *info)
{
gchar *classid;
+ gchar *content;
- classid = g_strdup_printf ("attachment-bar:%s", emf->current_message_part_id);
+ classid = g_strdup_printf (
+ "attachment-bar:%s", emf->current_message_part_id);
/* XXX Apparently this installs the callback for -all-
* EMFormatHTML subclasses, not just this subclass.
@@ -1065,8 +1124,10 @@ efhd_message_add_bar (EMFormat *emf,
sizeof (EMFormatHTMLPObject),
classid, part, efhd_add_bar);
- camel_stream_printf (
- stream, "<td><object classid=\"%s\"></object></td>", classid);
+ content = g_strdup_printf (
+ "<td><object classid=\"%s\"></object></td>", classid);
+ camel_stream_write_string (stream, content, NULL, NULL);
+ g_free (content);
g_free (classid);
}
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index b7b6e4d784..4a34aa0f28 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -171,17 +171,19 @@ efh_format_exec (struct _format_msg *m,
GError **error)
{
EMFormat *format;
+ CamelStream *stream;
struct _EMFormatHTMLJob *job;
GNode *puri_level;
CamelURL *base;
+ gchar *content;
if (m->format->priv->web_view == NULL)
return;
format = EM_FORMAT (m->format);
+ stream = CAMEL_STREAM (m->estream);
- camel_stream_printf (
- (CamelStream *) m->estream,
+ content = g_strdup_printf (
"<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n"
"<head>\n<meta name=\"generator\" content=\"Evolution Mail Component\">\n</head>\n"
"<body bgcolor =\"#%06x\" text=\"#%06x\" marginwidth=6 marginheight=6>\n",
@@ -191,12 +193,14 @@ efh_format_exec (struct _format_msg *m,
e_color_to_value (
&m->format->priv->colors[
EM_FORMAT_HTML_COLOR_HEADER]));
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
/* <insert top-header stuff here> */
if (format->mode == EM_FORMAT_MODE_SOURCE) {
em_format_format_source (
- format, (CamelStream *) m->estream,
+ format, stream,
(CamelMimePart *) m->message, cancellable);
} else {
const EMFormatHandler *handle;
@@ -207,7 +211,7 @@ efh_format_exec (struct _format_msg *m,
if (handle != NULL)
handle->handler (
- format, CAMEL_STREAM (m->estream),
+ format, stream,
CAMEL_MIME_PART (m->message), handle,
cancellable, FALSE);
@@ -216,12 +220,12 @@ efh_format_exec (struct _format_msg *m,
if (handle != NULL)
handle->handler (
- format, CAMEL_STREAM (m->estream),
+ format, stream,
CAMEL_MIME_PART (m->message), handle,
cancellable, FALSE);
}
- camel_stream_flush ((CamelStream *) m->estream, cancellable, NULL);
+ camel_stream_flush (stream, cancellable, NULL);
puri_level = format->pending_uri_level;
base = format->base;
@@ -704,14 +708,22 @@ efh_format_error (EMFormat *emf,
CamelStream *stream,
const gchar *txt)
{
+ GString *buffer;
gchar *html;
+ buffer = g_string_new ("<em><font color=\"red\">");
+
html = camel_text_to_html (
txt, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
- camel_stream_printf (
- stream, "<em><font color=\"red\">%s</font></em><br>", html);
+ g_string_append (buffer, html);
g_free (html);
+
+ g_string_append (buffer, "</font></em><br>");
+
+ camel_stream_write (stream, buffer->str, buffer->len, NULL, NULL);
+
+ g_string_free (buffer, TRUE);
}
static void
@@ -734,11 +746,13 @@ efh_format_source (EMFormat *emf,
CAMEL_STREAM_FILTER (filtered_stream), filter);
g_object_unref (filter);
- camel_stream_write_string (stream, "<table><tr><td><tt>", cancellable, NULL);
- em_format_format_text (emf, (CamelStream *) filtered_stream, dw, cancellable);
- g_object_unref (filtered_stream);
+ camel_stream_write_string (
+ stream, "<table><tr><td><tt>", cancellable, NULL);
+ em_format_format_text (emf, filtered_stream, dw, cancellable);
+ camel_stream_write_string (
+ stream, "</tt></td></tr></table>", cancellable, NULL);
- camel_stream_write_string(stream, "</tt></td></tr></table>", cancellable, NULL);
+ g_object_unref (filtered_stream);
}
static void
@@ -1725,12 +1739,23 @@ efh_format_secure (EMFormat *emf,
gchar *classid, *iconpath;
const gchar *icon;
CamelMimePart *iconpart;
+ GString *buffer;
+
+ buffer = g_string_sized_new (1024);
- camel_stream_printf (stream, "<table border=0 width=\"100%%\" cellpadding=3 cellspacing=0%s><tr>",
- smime_sign_colour[valid->sign.status]);
+ g_string_append_printf (
+ buffer,
+ "<table border=0 width=\"100%%\" "
+ "cellpadding=3 cellspacing=0%s><tr>",
+ smime_sign_colour[valid->sign.status]);
- classid = g_strdup_printf("smime:///em-format-html/%s/icon/signed", emf->part_id->str);
- camel_stream_printf(stream, "<td valign=\"top\"><img src=\"%s\"></td><td valign=\"top\" width=\"100%%\">", classid);
+ classid = g_strdup_printf (
+ "smime:///em-format-html/%s/icon/signed",
+ emf->part_id->str);
+ g_string_append_printf (
+ buffer,
+ "<td valign=\"top\"><img src=\"%s\"></td>"
+ "<td valign=\"top\" width=\"100%%\">", classid);
if (valid->sign.status != 0)
icon = smime_sign_table[valid->sign.status].icon;
@@ -1748,24 +1773,33 @@ efh_format_secure (EMFormat *emf,
if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
gchar *signers;
- camel_stream_printf (stream, "%s", _(smime_sign_table[valid->sign.status].shortdesc));
+ g_string_append (
+ buffer, _(smime_sign_table[valid->sign.status].shortdesc));
- signers = em_format_html_format_cert_infos ((CamelCipherCertInfo *) valid->sign.signers.head);
+ signers = em_format_html_format_cert_infos (
+ (CamelCipherCertInfo *) valid->sign.signers.head);
if (signers && *signers) {
- camel_stream_printf (stream, " (%s)", signers);
+ g_string_append_printf (
+ buffer, " (%s)", signers);
}
g_free (signers);
}
if (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) {
- if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) {
- camel_stream_printf (stream, "<br>");
- }
+ if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)
+ g_string_append (buffer, "<br>");
- camel_stream_printf (stream, "%s", _(smime_encrypt_table[valid->encrypt.status].shortdesc));
+ g_string_append (
+ buffer, _(smime_encrypt_table[valid->encrypt.status].shortdesc));
}
- camel_stream_printf(stream, "</td></tr></table>");
+ g_string_append (buffer, "</td></tr></table>");
+
+ camel_stream_write (
+ stream, buffer->str,
+ buffer->len, cancellable, NULL);
+
+ g_string_free (buffer, TRUE);
}
}
@@ -1878,8 +1912,12 @@ efh_text_plain (EMFormat *emf,
type = camel_mime_part_get_content_type (newpart);
if (camel_content_type_is (type, "text", "*") && (is_fallback || !camel_content_type_is (type, "text", "calendar"))) {
- camel_stream_printf (
- stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n",
+ gchar *content;
+
+ content = g_strdup_printf (
+ "<div style=\"border: solid #%06x 1px; "
+ "background-color: #%06x; padding: 10px; "
+ "color: #%06x;\">\n<tt>\n" EFH_MESSAGE_START,
e_color_to_value (
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_FRAME]),
@@ -1890,7 +1928,9 @@ efh_text_plain (EMFormat *emf,
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_TEXT]));
camel_stream_write_string (
- stream, "<tt>\n" EFH_MESSAGE_START, cancellable, NULL);
+ stream, content, cancellable, NULL);
+ g_free (content);
+
em_format_format_text (
emf, filtered_stream,
(CamelDataWrapper *) newpart,
@@ -1921,6 +1961,7 @@ efh_text_enriched (EMFormat *emf,
CamelStream *filtered_stream;
CamelMimeFilter *enriched;
guint32 flags = 0;
+ gchar *content;
if (!strcmp(info->mime_type, "text/richtext")) {
flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT;
@@ -1939,8 +1980,10 @@ efh_text_enriched (EMFormat *emf,
CAMEL_STREAM_FILTER (filtered_stream), enriched);
g_object_unref (enriched);
- camel_stream_printf (
- stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n" EFH_MESSAGE_START,
+ content = g_strdup_printf (
+ "<div style=\"border: solid #%06x 1px; "
+ "background-color: #%06x; padding: 10px; "
+ "color: #%06x;\">\n" EFH_MESSAGE_START,
e_color_to_value (
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_FRAME]),
@@ -1950,6 +1993,8 @@ efh_text_enriched (EMFormat *emf,
e_color_to_value (
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_TEXT]));
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
em_format_format_text (
emf, (CamelStream *) filtered_stream,
@@ -1993,9 +2038,11 @@ efh_text_html (EMFormat *emf,
EMFormatHTML *efh = EM_FORMAT_HTML (emf);
const gchar *location;
gchar *cid = NULL;
+ gchar *content;
- camel_stream_printf (
- stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; color: #%06x;\">\n"
+ content = g_strdup_printf (
+ "<div style=\"border: solid #%06x 1px; "
+ "background-color: #%06x; color: #%06x;\">\n"
"<!-- text/html -->\n" EFH_MESSAGE_START,
e_color_to_value (
&efh->priv->colors[
@@ -2006,6 +2053,8 @@ efh_text_html (EMFormat *emf,
e_color_to_value (
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_TEXT]));
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
/* TODO: perhaps we don't need to calculate this anymore now base is handled better */
/* calculate our own location string so add_puri doesn't do it
@@ -2034,10 +2083,11 @@ efh_text_html (EMFormat *emf,
emf, sizeof (EMFormatPURI), cid,
part, efh_write_text_html);
d(printf("adding iframe, location %s\n", cid));
- camel_stream_printf (stream,
- "<iframe src=\"%s\" frameborder=0 scrolling=no>could not get %s</iframe>\n"
- "</div>\n",
- cid, cid);
+ content = g_strdup_printf (
+ "<iframe src=\"%s\" frameborder=0 scrolling=no>"
+ "could not get %s</iframe>\n</div>\n", cid, cid);
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
g_free (cid);
}
@@ -2053,9 +2103,12 @@ efh_message_external (EMFormat *emf,
CamelContentType *type;
const gchar *access_type;
gchar *url = NULL, *desc = NULL;
+ gchar *content;
if (!part) {
- camel_stream_printf(stream, _("Unknown external-body part."));
+ camel_stream_write_string (
+ stream, _("Unknown external-body part."),
+ cancellable, NULL);
return;
}
@@ -2063,7 +2116,9 @@ efh_message_external (EMFormat *emf,
type = camel_mime_part_get_content_type (part);
access_type = camel_content_type_param (type, "access-type");
if (!access_type) {
- camel_stream_printf(stream, _("Malformed external-body part."));
+ camel_stream_write_string (
+ stream, _("Malformed external-body part."),
+ cancellable, NULL);
return;
}
@@ -2131,14 +2186,21 @@ efh_message_external (EMFormat *emf,
} else
goto fail;
- camel_stream_printf(stream, "<a href=\"%s\">%s</a>", url, desc);
+ content = g_strdup_printf ("<a href=\"%s\">%s</a>", url, desc);
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
+
g_free (url);
g_free (desc);
return;
fail:
- camel_stream_printf(stream, _("Pointer to unknown external data (\"%s\" type)"), access_type);
+ content = g_strdup_printf (
+ _("Pointer to unknown external data (\"%s\" type)"),
+ access_type);
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
}
static void
@@ -2153,10 +2215,13 @@ efh_message_deliverystatus (EMFormat *emf,
CamelStream *filtered_stream;
CamelMimeFilter *html_filter;
guint32 rgb = 0x737373;
+ gchar *content;
/* Yuck, this is copied from efh_text_plain */
- camel_stream_printf (
- stream, "<div style=\"border: solid #%06x 1px; background-color: #%06x; padding: 10px; color: #%06x;\">\n",
+ content = g_strdup_printf (
+ "<div style=\"border: solid #%06x 1px; "
+ "background-color: #%06x; padding: 10px; "
+ "color: #%06x;\">\n",
e_color_to_value (
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_FRAME]),
@@ -2166,6 +2231,8 @@ efh_message_deliverystatus (EMFormat *emf,
e_color_to_value (
&efh->priv->colors[
EM_FORMAT_HTML_COLOR_TEXT]));
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
filtered_stream = camel_stream_filter_new (stream);
html_filter = camel_mime_filter_tohtml_new (efh->text_html_flags, rgb);
@@ -2346,11 +2413,15 @@ efh_image (EMFormat *emf,
gboolean is_fallback)
{
EMFormatPURI *puri;
+ gchar *content;
puri = em_format_add_puri (
emf, sizeof (EMFormatPURI), NULL, part, efh_write_image);
- camel_stream_printf (
- stream, "<img hspace=10 vspace=10 src=\"%s\">", puri->cid);
+
+ content = g_strdup_printf (
+ "<img hspace=10 vspace=10 src=\"%s\">", puri->cid);
+ camel_stream_write_string (stream, content, cancellable, NULL);
+ g_free (content);
}
/* Notes:
@@ -2415,7 +2486,11 @@ efh_builtin_init (EMFormatHTMLClass *efhc)
/* ********************************************************************** */
static void
-efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const gchar *label, const gchar *value, guint32 flags)
+efh_format_text_header (EMFormatHTML *emfh,
+ GString *buffer,
+ const gchar *label,
+ const gchar *value,
+ guint32 flags)
{
const gchar *fmt, *html;
gchar *mhtml = NULL;
@@ -2463,7 +2538,8 @@ efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const gchar *la
}
}
- camel_stream_printf (stream, fmt, label, html);
+ g_string_append_printf (buffer, fmt, label, html);
+
g_free (mhtml);
}
@@ -2615,7 +2691,12 @@ canon_header_name (gchar *name)
}
static void
-efh_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, struct _camel_header_raw *header, guint32 flags, const gchar *charset)
+efh_format_header (EMFormat *emf,
+ GString *buffer,
+ CamelMedium *part,
+ struct _camel_header_raw *header,
+ guint32 flags,
+ const gchar *charset)
{
EMFormatHTML *efh = (EMFormatHTML *) emf;
gchar *name, *buf, *value = NULL;
@@ -2758,7 +2839,7 @@ efh_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, struct
g_free (buf);
}
- efh_format_text_header (efh, stream, label, txt, flags);
+ efh_format_text_header (efh, buffer, label, txt, flags);
g_free (value);
g_free (str_field);
@@ -2766,7 +2847,7 @@ efh_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, struct
static void
efh_format_headers (EMFormatHTML *efh,
- CamelStream *stream,
+ GString *buffer,
CamelMedium *part,
GCancellable *cancellable)
{
@@ -2793,8 +2874,8 @@ efh_format_headers (EMFormatHTML *efh,
charset = camel_iconv_charset_name (charset);
if (!efh->simple_headers)
- camel_stream_printf (
- stream, "<font color=\"#%06x\">\n"
+ g_string_append_printf (
+ buffer, "<font color=\"#%06x\">\n"
"<table cellpadding=\"0\" width=\"100%%\">",
e_color_to_value (
&efh->priv->colors[
@@ -2833,15 +2914,27 @@ efh_format_headers (EMFormatHTML *efh,
header = header->next;
}
- camel_stream_printf (stream, "<tr><td width=\"20\" valign=\"top\"><a href=\"##HEADERS##\"><img src=\"%s/plus.png\"></a></td><td><strong>%s</strong> %s%s%s</td></tr>",
- evolution_imagesdir, subject ? subject : _("(no subject)"), from->len ? "(" : "", from->str, from->len ? ")" : "");
+ g_string_append_printf (
+ buffer,
+ "<tr>"
+ "<td width=\"20\" valign=\"top\">"
+ "<a href=\"##HEADERS##\">"
+ "<img src=\"%s/plus.png\">"
+ "</a></td>"
+ "<td><strong>%s</strong> %s%s%s</td>"
+ "</tr>",
+ evolution_imagesdir,
+ subject ? subject : _("(no subject)"),
+ from->len ? "(" : "",
+ from->str,
+ from->len ? ")" : "");
g_free (subject);
if (addrs)
camel_header_address_list_clear (&addrs);
g_string_free (from, TRUE);
- camel_stream_printf (stream, "</table>");
+ g_string_append (buffer, "</table>");
g_free (evolution_imagesdir);
@@ -2889,17 +2982,27 @@ efh_format_headers (EMFormatHTML *efh,
if (header_sender && header_from && mail_from_delegate) {
gchar *bold_sender, *bold_from;
- camel_stream_printf(stream, "<tr><td><table border=1 width=\"100%%\" cellspacing=2 cellpadding=2><tr>");
+
+ g_string_append (
+ buffer,
+ "<tr><td><table border=1 width=\"100%%\" "
+ "cellspacing=2 cellpadding=2><tr>");
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
- camel_stream_printf (stream, "<td align=\"right\" width=\"100%%\">");
+ g_string_append (
+ buffer, "<td align=\"right\" width=\"100%%\">");
else
- camel_stream_printf (stream, "<td align=\"left\" width=\"100%%\">");
+ g_string_append (
+ buffer, "<td align=\"left\" width=\"100%%\">");
bold_sender = g_strconcat ("<b>", header_sender, "</b>", NULL);
bold_from = g_strconcat ("<b>", header_from, "</b>", NULL);
- /* To translators: This message suggests to the receipients that the sender of the mail is
- different from the one listed in From field. */
- camel_stream_printf(stream, _("This message was sent by %s on behalf of %s"), bold_sender, bold_from);
- camel_stream_printf(stream, "</td></tr></table></td></tr>");
+ /* Translators: This message suggests to the receipients
+ * that the sender of the mail is different from the one
+ * listed in From field. */
+ g_string_append_printf (
+ buffer,
+ _("This message was sent by %s on behalf of %s"),
+ bold_sender, bold_from);
+ g_string_append (buffer, "</td></tr></table></td></tr>");
g_free (bold_sender);
g_free (bold_from);
}
@@ -2909,17 +3012,39 @@ efh_format_headers (EMFormatHTML *efh,
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) {
if (efh->priv->headers_collapsable)
- camel_stream_printf (stream, "<tr><td valign=\"top\" width=\"20\"><a href=\"##HEADERS##\"><img src=\"%s/minus.png\"></a></td><td><table width=\"100%%\" border=0 cellpadding=\"0\">\n",
+ g_string_append_printf (
+ buffer,
+ "<tr>"
+ "<td valign=\"top\" width=\"20\">"
+ "<a href=\"##HEADERS##\">"
+ "<img src=\"%s/minus.png\">"
+ "</a></td>"
+ "<td><table width=\"100%%\" border=0 "
+ "cellpadding=\"0\">\n",
evolution_imagesdir);
else
- camel_stream_printf (stream, "<tr><td><table width=\"100%%\" border=0 cellpadding=\"0\">\n");
+ g_string_append (
+ buffer,
+ "<tr><td>"
+ "<table width=\"100%%\" border=0 "
+ "cellpadding=\"0\">\n");
} else {
if (efh->priv->headers_collapsable)
- camel_stream_printf (stream, "<tr><td valign=\"top\" width=\"20\"><a href=\"##HEADERS##\"><img src=\"%s/minus.png\"></a></td><td><table border=0 cellpadding=\"0\">\n",
+ g_string_append_printf (
+ buffer,
+ "<tr>"
+ "<td valign=\"top\" width=\"20\">"
+ "<a href=\"##HEADERS##\">"
+ "<img src=\"%s/minus.png\">"
+ "</a></td>"
+ "<td><table border=0 cellpadding=\"0\">\n",
evolution_imagesdir);
else
- camel_stream_printf (stream, "<tr><td><table border=0 cellpadding=\"0\">\n");
+ g_string_append (
+ buffer,
+ "<tr><td>"
+ "<table border=0 cellpadding=\"0\">\n");
}
g_free (evolution_imagesdir);
@@ -2928,7 +3053,9 @@ efh_format_headers (EMFormatHTML *efh,
if (emf->mode == EM_FORMAT_MODE_ALLHEADERS) {
header = ((CamelMimePart *) part)->headers;
while (header) {
- efh_format_header (emf, stream, part, header, EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset);
+ efh_format_header (
+ emf, buffer, part, header,
+ EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset);
header = header->next;
}
} else {
@@ -2974,7 +3101,9 @@ efh_format_headers (EMFormatHTML *efh,
xmailer.value = use_header->value;
mailer_shown = TRUE;
- efh_format_header (emf, stream, part, &xmailer, h->flags, charset);
+ efh_format_header (
+ emf, buffer, part,
+ &xmailer, h->flags, charset);
if (strstr(use_header->value, "Evolution"))
have_icon = TRUE;
} else if (!face_decoded && face && !g_ascii_strcasecmp (header->name, "Face")) {
@@ -2990,7 +3119,9 @@ efh_format_headers (EMFormatHTML *efh,
face_decoded = TRUE;
/* Showing an encoded "Face" header makes little sense */
} else if (!g_ascii_strcasecmp (header->name, h->name) && !face) {
- efh_format_header (emf, stream, part, header, h->flags, charset);
+ efh_format_header (
+ emf, buffer, part,
+ header, h->flags, charset);
}
header = header->next;
@@ -3001,7 +3132,7 @@ efh_format_headers (EMFormatHTML *efh,
}
if (!efh->simple_headers) {
- camel_stream_printf(stream, "</table></td>");
+ g_string_append (buffer, "</table></td>");
if (photo_name) {
gchar *classid;
@@ -3015,10 +3146,13 @@ efh_format_headers (EMFormatHTML *efh,
if (photopart) {
contact_has_photo = TRUE;
- classid = g_strdup_printf("icon:///em-format-html/%s/photo/header",
- emf->part_id->str);
- camel_stream_printf (stream,
- "<td align=\"right\" valign=\"top\"><img width=64 src=\"%s\"></td>",
+ classid = g_strdup_printf (
+ "icon:///em-format-html/%s/photo/header",
+ emf->part_id->str);
+ g_string_append_printf (
+ buffer,
+ "<td align=\"right\" valign=\"top\">"
+ "<img width=64 src=\"%s\"></td>",
classid);
em_format_add_puri (emf, sizeof (EMFormatPURI), classid,
photopart, efh_write_image);
@@ -3034,9 +3168,17 @@ efh_format_headers (EMFormatHTML *efh,
CamelMimePart *part;
part = camel_mime_part_new ();
- camel_mime_part_set_content ((CamelMimePart *) part, (const gchar *) face_header_value, face_header_len, "image/png");
- classid = g_strdup_printf("icon:///em-format-html/face/photo/header");
- camel_stream_printf(stream, "<td align=\"right\" valign=\"top\"><img width=48 src=\"%s\"></td>", classid);
+ camel_mime_part_set_content (
+ (CamelMimePart *) part,
+ (const gchar *) face_header_value,
+ face_header_len, "image/png");
+ classid = g_strdup_printf (
+ "icon:///em-format-html/face/photo/header");
+ g_string_append_printf (
+ buffer,
+ "<td align=\"right\" valign=\"top\">"
+ "<img width=48 src=\"%s\"></td>",
+ classid);
em_format_add_puri (
emf, sizeof (EMFormatPURI),
classid, part, efh_write_image);
@@ -3048,8 +3190,14 @@ efh_format_headers (EMFormatHTML *efh,
gchar *classid;
CamelMimePart *iconpart = NULL;
- classid = g_strdup_printf("icon:///em-format-html/%s/icon/header", emf->part_id->str);
- camel_stream_printf(stream, "<td align=\"right\" valign=\"top\"><img width=16 height=16 src=\"%s\"></td>", classid);
+ classid = g_strdup_printf (
+ "icon:///em-format-html/%s/icon/header",
+ emf->part_id->str);
+ g_string_append_printf (
+ buffer,
+ "<td align=\"right\" valign=\"top\">"
+ "<img width=16 height=16 src=\"%s\"></td>",
+ classid);
icon_info = gtk_icon_theme_lookup_icon (
gtk_icon_theme_get_default (),
@@ -3070,7 +3218,8 @@ efh_format_headers (EMFormatHTML *efh,
}
g_free (classid);
}
- camel_stream_printf (stream, "</tr></table>\n</font>\n");
+
+ g_string_append (buffer, "</tr></table>\n</font>\n");
}
}
@@ -3083,6 +3232,7 @@ efh_format_message (EMFormat *emf,
gboolean is_fallback)
{
const EMFormatHandler *handle;
+ GString *buffer;
/* TODO: make this validity stuff a method */
EMFormatHTML *efh = (EMFormatHTML *) emf;
@@ -3091,23 +3241,32 @@ efh_format_message (EMFormat *emf,
emf->valid = NULL;
emf->valid_parent = NULL;
+ buffer = g_string_sized_new (1024);
+
if (emf->message != (CamelMimeMessage *) part)
- camel_stream_printf(stream, "<blockquote>\n");
+ g_string_append (buffer, "<blockquote>\n");
if (!efh->hide_headers)
efh_format_headers (
- efh, stream, CAMEL_MEDIUM (part), cancellable);
+ efh, buffer, CAMEL_MEDIUM (part), cancellable);
+
+ camel_stream_write (
+ stream, buffer->str, buffer->len, cancellable, NULL);
+
+ g_string_free (buffer, TRUE);
handle = em_format_find_handler(emf, "x-evolution/message/post-header");
if (handle)
handle->handler (
emf, stream, part, handle, cancellable, FALSE);
- camel_stream_printf (stream, EM_FORMAT_HTML_VPAD);
+ camel_stream_write_string (
+ stream, EM_FORMAT_HTML_VPAD, cancellable, NULL);
em_format_part (emf, stream, part, cancellable);
if (emf->message != (CamelMimeMessage *) part)
- camel_stream_printf(stream, "</blockquote>\n");
+ camel_stream_write_string (
+ stream, "</blockquote>\n", cancellable, NULL);
camel_cipher_validity_free (emf->valid);
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c
index 507bc953e9..07b1bd679b 100644
--- a/plugins/audio-inline/audio-inline.c
+++ b/plugins/audio-inline/audio-inline.c
@@ -294,16 +294,22 @@ void
org_gnome_audio_inline_format (gpointer ep, EMFormatHookTarget *t)
{
struct _org_gnome_audio_inline_pobject *pobj;
- gchar *classid = g_strdup_printf ("org-gnome-audio-inline-button-panel-%d", org_gnome_audio_class_id_counter);
+ gchar *classid;
+ gchar *content;
+
+ classid = g_strdup_printf (
+ "org-gnome-audio-inline-button-panel-%d",
+ org_gnome_audio_class_id_counter);
org_gnome_audio_class_id_counter++;
d(printf ("audio inline formatter: format classid %s\n", classid));
- pobj = (struct _org_gnome_audio_inline_pobject *) em_format_html_add_pobject ((EMFormatHTML *) t->format, sizeof (*pobj), classid,
- t->part, org_gnome_audio_inline_button_panel);
- g_object_ref (t->part);
- pobj->part = t->part;
+ pobj = (struct _org_gnome_audio_inline_pobject *)
+ em_format_html_add_pobject (
+ (EMFormatHTML *) t->format, sizeof (*pobj), classid,
+ t->part, org_gnome_audio_inline_button_panel);
+ pobj->part = g_object_ref (t->part);
pobj->filename = NULL;
pobj->playbin = NULL;
pobj->play_button = NULL;
@@ -313,5 +319,7 @@ org_gnome_audio_inline_format (gpointer ep, EMFormatHookTarget *t)
pobj->object.free = org_gnome_audio_inline_pobject_free;
pobj->target_state = GST_STATE_NULL;
- camel_stream_printf (t->stream, "<object classid=%s></object>\n", classid);
+ content = g_strdup_printf ("<object classid=%s></object>\n", classid);
+ camel_stream_write_string (t->stream, content, NULL, NULL);
+ g_free (content);
}
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index edb527c3a6..73a630a259 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -448,6 +448,7 @@ org_gnome_image_inline_format (gpointer ep, EMFormatHookTarget *target)
{
ImageInlinePObject *image_object;
gchar *classid;
+ gchar *content;
classid = g_strdup_printf (
"org-gnome-image-inline-display-%d",
@@ -466,8 +467,9 @@ org_gnome_image_inline_format (gpointer ep, EMFormatHookTarget *target)
image_object->object.free = org_gnome_image_inline_pobject_free;
org_gnome_image_inline_decode (image_object);
- camel_stream_printf (
- target->stream, "<object classid=%s></object>", classid);
+ content = g_strdup_printf ("<object classid=%s></object>", classid);
+ camel_stream_write_string (target->stream, content, NULL, NULL);
+ g_free (content);
g_free (classid);
}
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 0770ea2ebb..f5b2bcdcf0 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2819,6 +2819,7 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target)
CamelDataWrapper *content;
CamelStream *stream;
GByteArray *byte_array;
+ gchar *string;
classid = g_strdup_printf("itip:///%s", ((EMFormat *) target->format)->part_id->str);
@@ -2859,9 +2860,13 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target)
g_object_unref (stream);
- camel_stream_printf (target->stream, "<table border=0 width=\"100%%\" cellpadding=3><tr>");
- camel_stream_printf (target->stream, "<td valign=top><object classid=\"%s\"></object></td><td width=100%% valign=top>", classid);
- camel_stream_printf (target->stream, "</td></tr></table>");
+ string = g_strdup_printf (
+ "<table border=0 width=\"100%%\" cellpadding=3><tr>"
+ "<td valign=top><object classid=\"%s\"></object></td>"
+ "<td width=100%% valign=top></td></tr></table>",
+ classid);
+ camel_stream_write_string (target->stream, string, NULL, NULL);
+ g_free (string);
g_free (classid);
}
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 7e56da440b..78818f328b 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -313,6 +313,7 @@ org_gnome_vcard_inline_format (gpointer ep, EMFormatHookTarget *target)
{
VCardInlinePObject *vcard_object;
gchar *classid;
+ gchar *content;
classid = g_strdup_printf (
"org-gnome-vcard-inline-display-%d",
@@ -332,8 +333,9 @@ org_gnome_vcard_inline_format (gpointer ep, EMFormatHookTarget *target)
e_book_client_get_sources (&vcard_object->source_list, NULL);
- camel_stream_printf (
- target->stream, "<object classid=%s></object>", classid);
+ content = g_strdup_printf ("<object classid=%s></object>", classid);
+ camel_stream_write_string (target->stream, content, NULL, NULL);
+ g_free (content);
g_free (classid);
}