From 1af18445c9aa5cd8084042a9616d13d066aa8d29 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 22 Apr 2000 17:03:07 +0000 Subject: new function to make the composer record additional headers it should * e-msg-composer.c (e_msg_composer_add_header): new function to make the composer record additional headers it should output. (In-Reply-To), etc. (build_message): output them svn path=/trunk/; revision=2552 --- composer/ChangeLog | 7 +++++++ composer/e-msg-composer.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- composer/e-msg-composer.h | 4 ++++ 3 files changed, 56 insertions(+), 1 deletion(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 1f3b0f4824..3ed04bccbc 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,10 @@ +2000-04-22 Dan Winship + + * e-msg-composer.c (e_msg_composer_add_header): new function to + make the composer record additional headers it should output. + (In-Reply-To), etc. + (build_message): output them + 2000-04-21 Dan Winship * e-msg-composer.c (e_msg_composer_set_headers): diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index d4ed8d49bf..b2f59adccb 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -141,11 +141,17 @@ build_message (EMsgComposer *composer) CamelSimpleDataWrapper *sdr; CamelMultipart *multipart; char *text; - + int i; + new = camel_mime_message_new (); e_msg_composer_hdrs_to_message (E_MSG_COMPOSER_HDRS (composer->hdrs), new); + for (i = 0; i < composer->extra_hdr_names->len; i++) { + camel_medium_add_header (CAMEL_MEDIUM (new), + composer->extra_hdr_names->pdata[i], + composer->extra_hdr_values->pdata[i]); + } multipart = camel_multipart_new (); body_part = camel_mime_body_part_new (); @@ -479,6 +485,19 @@ destroy (GtkObject *object) if (composer->address_dialog != NULL) gtk_widget_destroy (composer->address_dialog); + if (composer->hdrs != NULL) + gtk_widget_destroy (composer->hdrs); + + if (composer->extra_hdr_names) { + int i; + + for (i = 0; i < composer->extra_hdr_names->len; i++) { + g_free (composer->extra_hdr_names->pdata[i]); + g_free (composer->extra_hdr_values->pdata[i]); + } + g_ptr_array_free (composer->extra_hdr_names, TRUE); + g_ptr_array_free (composer->extra_hdr_values, TRUE); + } if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -521,6 +540,8 @@ init (EMsgComposer *composer) composer->uih = NULL; composer->hdrs = NULL; + composer->extra_hdr_names = g_ptr_array_new (); + composer->extra_hdr_values = g_ptr_array_new (); composer->editor = NULL; @@ -703,6 +724,29 @@ e_msg_composer_set_body_text (EMsgComposer *composer, const char *text) } +/** + * e_msg_composer_add_header: + * @composer: a composer object + * @name: the header name + * @value: the header value + * + * Adds a header with @name and @value to the message. This header + * may not be displayed by the composer, but will be included in + * the message it outputs. + **/ +void +e_msg_composer_add_header (EMsgComposer *composer, const char *name, + const char *value) +{ + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); + g_return_if_fail (name != NULL); + g_return_if_fail (value != NULL); + + g_ptr_array_add (composer->extra_hdr_names, g_strdup (name)); + g_ptr_array_add (composer->extra_hdr_values, g_strdup (value)); +} + + /** * e_msg_composer_get_message: * @composer: A message composer widget diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 5b4cfecb68..778e1c23f7 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -52,6 +52,7 @@ struct _EMsgComposer { BonoboUIHandler *uih; GtkWidget *hdrs; + GPtrArray *extra_hdr_names, *extra_hdr_values; GtkWidget *editor; @@ -85,6 +86,9 @@ void e_msg_composer_set_headers (EMsgComposer *composer, const char *subject); void e_msg_composer_set_body_text (EMsgComposer *composer, const char *text); +void e_msg_composer_add_header (EMsgComposer *composer, + const char *name, + const char *value); CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer); -- cgit v1.2.3