diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-06 02:02:01 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-07-06 02:40:10 +0800 |
commit | 005a26de4534cfaf534e8e4828366b619a3b21d1 (patch) | |
tree | e9247d1dfa10750a07335647cf37f43b158a8817 /mail/em-composer-utils.c | |
parent | 17127fbee9fd1b0baecb4e305c005d6abbf8d880 (diff) | |
download | gsoc2013-evolution-005a26de4534cfaf534e8e4828366b619a3b21d1.tar.gz 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).
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r-- | mail/em-composer-utils.c | 25 |
1 files changed, 15 insertions, 10 deletions
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); |