From fd83a09d5ced1b3a89dcf122e7ec47d5985de062 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Tue, 27 Jul 2004 16:52:33 +0000 Subject: added len parameter to em_utils_part_to_html and em_utils_message_to_html. 2004-07-23 Radek Doulik * added len parameter to em_utils_part_to_html and em_utils_message_to_html. it is used to return length of returned buffer. we use that info later when setting composer body content. svn path=/trunk/; revision=26747 --- mail/ChangeLog | 6 ++++++ mail/em-composer-utils.c | 11 +++++++---- mail/em-utils.c | 8 ++++++-- mail/em-utils.h | 4 ++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 30f7b7485b..ba743cb80c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2004-07-23 Radek Doulik + + * added len parameter to em_utils_part_to_html and + em_utils_message_to_html. it is used to return length of returned + buffer. we use that info later when setting composer body content. + 2004-07-22 Not Zed * mail-component.c (impl_createControls): dont call diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index daf4acfde3..e0991cc7fc 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -881,15 +881,17 @@ forward_non_attached (GPtrArray *messages, int style, const char *fromuri) flags |= EM_FORMAT_QUOTE_CITE; for (i = 0; i < messages->len; i++) { + ssize_t len; + message = messages->pdata[i]; subject = mail_tool_generate_forward_subject (message); - text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags); + text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len); if (text) { composer = create_new_composer (subject, fromuri); - e_msg_composer_set_body_text (composer, text); + e_msg_composer_set_body_text (composer, text, len); e_msg_composer_unset_changed (composer); e_msg_composer_drop_editor_undo (composer); @@ -1663,6 +1665,7 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message) char *text, *credits; CamelMimePart *part; GConfClient *gconf; + ssize_t len; gconf = mail_config_get_gconf_client (); @@ -1680,9 +1683,9 @@ composer_set_body (EMsgComposer *composer, CamelMimeMessage *message) default: /* do what any sane user would want when replying... */ credits = attribution_format (ATTRIBUTION, message); - text = em_utils_message_to_html(message, credits, EM_FORMAT_QUOTE_CITE); + text = em_utils_message_to_html(message, credits, EM_FORMAT_QUOTE_CITE, &len); g_free (credits); - e_msg_composer_set_body_text(composer, text); + e_msg_composer_set_body_text(composer, text, len); g_free (text); break; } diff --git a/mail/em-utils.c b/mail/em-utils.c index 1fea720579..8e47f68254 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1365,7 +1365,7 @@ em_utils_get_proxy_uri(void) * Return Value: The part in displayable html format. **/ char * -em_utils_part_to_html(CamelMimePart *part) +em_utils_part_to_html(CamelMimePart *part, ssize_t *len) { EMFormatQuote *emfq; CamelStreamMem *mem; @@ -1385,6 +1385,8 @@ em_utils_part_to_html(CamelMimePart *part) camel_object_unref (mem); text = buf->data; + if (len) + *len = buf->len; g_byte_array_free (buf, FALSE); return text; @@ -1402,7 +1404,7 @@ em_utils_part_to_html(CamelMimePart *part) * Return value: The html version. **/ char * -em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags) +em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags, ssize_t *len) { EMFormatQuote *emfq; CamelStreamMem *mem; @@ -1422,6 +1424,8 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 camel_object_unref (mem); text = buf->data; + if (len) + *len = buf->len; g_byte_array_free (buf, FALSE); return text; diff --git a/mail/em-utils.h b/mail/em-utils.h index 3fa6be2b1d..c48db35088 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -84,8 +84,8 @@ void em_utils_adjustment_page(struct _GtkAdjustment *adj, gboolean down); char *em_utils_get_proxy_uri(void); /* FIXME: should this have an override charset? */ -char *em_utils_part_to_html(struct _CamelMimePart *part); -char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags); +char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len); +char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len); void em_utils_expunge_folder (struct _GtkWidget *parent, struct _CamelFolder *folder); void em_utils_empty_trash (struct _GtkWidget *parent); -- cgit