From ac9c64ee1a3da02cf815b2f2d1157cbd79d152d9 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 29 Jan 2002 19:33:08 +0000 Subject: If we are in redirect mode, use the original message and set the resent-* 2002-01-29 Jeffrey Stedfast * e-msg-composer.c (build_message): If we are in redirect mode, use the original message and set the resent-* headers using e_msg_composer_hdrs_to_redirect() and then return. (destroy): Unref the redirected message if it exists. * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_redirect): New function for a composer in redirect mode. svn path=/trunk/; revision=15507 --- composer/e-msg-composer.c | 58 +++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 19 deletions(-) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index e958ab60b2..c7499d9137 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -319,6 +319,13 @@ build_message (EMsgComposer *composer) if (composer->persist_stream_interface == CORBA_OBJECT_NIL) return NULL; + /* evil kludgy hack for Redirect */ + if (composer->redirect) { + e_msg_composer_hdrs_to_redirect (hdrs, composer->redirect); + camel_object_ref (CAMEL_OBJECT (composer->redirect)); + return composer->redirect; + } + new = camel_mime_message_new (); e_msg_composer_hdrs_to_message (hdrs, new); for (i = 0; i < composer->extra_hdr_names->len; i++) { @@ -1953,6 +1960,9 @@ destroy (GtkObject *object) CORBA_exception_free (&ev); + if (composer->redirect) + camel_object_unref (CAMEL_OBJECT (composer->redirect)); + if (composer->editor_listener) bonobo_object_unref (composer->editor_listener); @@ -2163,6 +2173,8 @@ init (EMsgComposer *composer) composer->has_changed = FALSE; + composer->redirect = FALSE; + composer->charset = NULL; composer->enable_autosave = TRUE; @@ -2835,29 +2847,37 @@ e_msg_composer_new_with_message (CamelMimeMessage *message) return new; } -#if 0 -static GList * -add_recipients (GList *list, const char *recips, gboolean decode) + +/** + * e_msg_composer_new_redirect: + * @message: The message to use as the source + * + * Create a new message composer widget. + * + * Return value: A pointer to the newly created widget + **/ +EMsgComposer * +e_msg_composer_new_redirect (CamelMimeMessage *message, const char *resent_from) { - int len; - char *addr; + EMsgComposer *composer; + const char *subject; - while (*recips) { - len = strcspn (recips, ","); - if (len) { - addr = g_strndup (recips, len); - if (decode) - camel_url_decode (addr); - list = g_list_append (list, addr); - } - recips += len; - if (*recips == ',') - recips++; - } + g_return_val_if_fail (message != NULL, NULL); - return list; + composer = e_msg_composer_new_with_message (message); + subject = camel_mime_message_get_subject (message); + + composer->redirect = message; + camel_object_ref (CAMEL_OBJECT (message)); + + e_msg_composer_set_headers (composer, resent_from, NULL, NULL, NULL, subject); + + gtk_widget_set_sensitive (composer->editor, FALSE); + gtk_widget_set_sensitive (composer->attachment_bar, FALSE); + + return composer; } -#endif + static GList * add_recipients (GList *list, const char *recips, gboolean decode) -- cgit