diff options
-rw-r--r-- | composer/ChangeLog | 11 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 72 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 4 |
3 files changed, 73 insertions, 14 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 37aa3dc2de..df369ed280 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,14 @@ +2002-06-03 Not Zed <NotZed@Ximian.com> + + * e-msg-composer.c (build_message): Properly handle user + cancellation for signing/encrypting, just dont sign but create + anyway. + (e_msg_composer_get_subject): Wrapper function to get the subject + from the header object. + (e_msg_composer_get_to): + (e_msg_composer_get_cc): + (e_msg_composer_get_bcc): Same for the destination types. + 2002-06-03 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (e_msg_composer_guess_mime_type): Allocate a diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 4524efe7f2..dab3c276dd 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -482,6 +482,8 @@ build_message (EMsgComposer *composer) current = CAMEL_DATA_WRAPPER (multipart); } + + camel_exception_init (&ex); if (composer->pgp_sign || composer->pgp_encrypt) { part = camel_mime_part_new (); @@ -496,8 +498,12 @@ build_message (EMsgComposer *composer) CamelMultipartSigned *mps; CamelCipherContext *context; - camel_exception_init (&ex); - + context = (CamelCipherContext *)camel_pgp_context_new(session, mail_config_get_pgp_type(), mail_config_get_pgp_path()); + if (context == NULL) { + camel_exception_setv(&ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create a PGP signature context")); + goto exception; + } + if (hdrs->account && hdrs->account->pgp_key && *hdrs->account->pgp_key) { pgpid = hdrs->account->pgp_key; } else { @@ -506,22 +512,26 @@ build_message (EMsgComposer *composer) camel_internet_address_get (from, 0, NULL, &pgpid); } - context = (CamelCipherContext *)camel_pgp_context_new(session, mail_config_get_pgp_type(), mail_config_get_pgp_path()); - if (context == NULL) { - camel_exception_setv(&ex, 1, _("Could not create a PGP signature context")); - goto exception; - } mps = camel_multipart_signed_new(); camel_multipart_signed_sign(mps, context, part, pgpid, CAMEL_CIPHER_HASH_SHA1, &ex); - camel_medium_set_content_object(CAMEL_MEDIUM (part), (CamelDataWrapper *)mps); - camel_object_unref((CamelObject *)mps); - camel_object_unref((CamelObject *)context); if (from) camel_object_unref (CAMEL_OBJECT (from)); - - if (camel_exception_is_set (&ex)) - goto exception; + + /* if cancelled, just leave part as is, otherwise, replace content with the multipart */ + if (camel_exception_is_set(&ex)) { + if (camel_exception_get_id(&ex) == CAMEL_EXCEPTION_USER_CANCEL) { + camel_exception_clear(&ex); + } else { + camel_object_unref((CamelObject *)mps); + camel_object_unref((CamelObject *)context); + goto exception; + } + } else { + camel_medium_set_content_object(CAMEL_MEDIUM (part), (CamelDataWrapper *)mps); + } + camel_object_unref((CamelObject *)mps); + camel_object_unref((CamelObject *)context); } if (composer->pgp_encrypt) { @@ -577,7 +587,9 @@ build_message (EMsgComposer *composer) for (i = 0; i < recipients->len; i++) g_free (recipients->pdata[i]); g_ptr_array_free (recipients, TRUE); - if (camel_exception_is_set (&ex)) + + if (camel_exception_is_set(&ex) + && camel_exception_get_id(&ex) != CAMEL_EXCEPTION_USER_CANCEL) goto exception; } @@ -4100,6 +4112,38 @@ e_msg_composer_get_recipients (EMsgComposer *composer) return composer->hdrs ? e_msg_composer_hdrs_get_recipients (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL; } +EDestination ** +e_msg_composer_get_to(EMsgComposer *composer) +{ + g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); + + return composer->hdrs ? e_msg_composer_hdrs_get_to (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL; +} + +EDestination ** +e_msg_composer_get_cc(EMsgComposer *composer) +{ + g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); + + return composer->hdrs ? e_msg_composer_hdrs_get_cc (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL; +} + +EDestination ** +e_msg_composer_get_bcc(EMsgComposer *composer) +{ + g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); + + return composer->hdrs ? e_msg_composer_hdrs_get_bcc (E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL; +} + +char * +e_msg_composer_get_subject(EMsgComposer *composer) +{ + g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL); + + return composer->hdrs ? e_msg_composer_hdrs_get_subject(E_MSG_COMPOSER_HDRS (composer->hdrs)) : NULL; +} + /** * e_msg_composer_get_view_cc: * @composer: A message composer widget diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index b92713bb93..ea457e43a6 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -161,6 +161,10 @@ void e_msg_composer_set_view_cc (EMsgCo gboolean view_cc); EDestination **e_msg_composer_get_recipients (EMsgComposer *composer); +EDestination **e_msg_composer_get_to(EMsgComposer *composer); +EDestination **e_msg_composer_get_cc(EMsgComposer *composer); +EDestination **e_msg_composer_get_bcc(EMsgComposer *composer); +char *e_msg_composer_get_subject(EMsgComposer *composer); const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer); void e_msg_composer_clear_inlined_table (EMsgComposer *composer); |