From e9b0430629872d2c74c065b5553274e4f404f32f Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Mon, 10 Sep 2001 00:01:37 +0000 Subject: Complain if we are trying to send to invalid recipients. (Bug #8875) 2001-09-09 Jon Trowbridge * mail-callbacks.c (composer_get_message): Complain if we are trying to send to invalid recipients. (Bug #8875) svn path=/trunk/; revision=12721 --- mail/ChangeLog | 5 +++++ mail/mail-callbacks.c | 52 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 6 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 8d826c7ef4..9ada2111ec 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2001-09-09 Jon Trowbridge + + * mail-callbacks.c (composer_get_message): Complain if we are + trying to send to invalid recipients. (Bug #8875) + 2001-09-09 Jeffrey Stedfast * mail-config-druid.c (evolution_mail_config_wizard_factory_fn): diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 18c2126355..7f725f7f5f 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -396,6 +396,41 @@ composer_get_message (EMsgComposer *composer) message = e_msg_composer_get_message (composer); if (message == NULL) return NULL; + + recipients = e_msg_composer_get_recipients (composer); + + /* Check for invalid recipients */ + if (recipients) { + gboolean have_invalid = FALSE; + gchar *msg, *new_msg; + GtkWidget *message_box; + + for (i = 0; recipients[i] && !have_invalid; ++i) { + if (! e_destination_is_valid (recipients[i])) + have_invalid = TRUE; + } + + msg = _("This message contains invalid recipients:"); + for (i = 0; recipients[i]; ++i) { + if (! e_destination_is_valid (recipients[i])) { + new_msg = g_strdup_printf ("%s\n %s", msg, e_destination_get_address (recipients[i])); + g_free (msg); + msg = new_msg; + } + } + + new_msg = e_utf8_from_locale_string (msg); + g_free (msg); + msg = new_msg; + + message_box = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_WARNING, GNOME_STOCK_BUTTON_OK, NULL); + + gnome_dialog_run_and_close (GNOME_DIALOG (message_box)); + + camel_object_unref (CAMEL_OBJECT (message)); + message = NULL; + goto finished; + } /* Check for recipients */ for (num_addrs = 0, i = 0; i < 3; i++) { @@ -416,7 +451,8 @@ composer_get_message (EMsgComposer *composer) gnome_dialog_run_and_close (GNOME_DIALOG (message_box)); camel_object_unref (CAMEL_OBJECT (message)); - return NULL; + message = NULL; + goto finished; } if (iaddr && num_addrs == camel_address_length (CAMEL_ADDRESS (iaddr))) { @@ -437,7 +473,8 @@ composer_get_message (EMsgComposer *composer) if (!ask_confirm_for_only_bcc (composer, hidden_list_case)) { camel_object_unref (CAMEL_OBJECT (message)); - return NULL; + message = NULL; + goto finished; } } @@ -448,7 +485,6 @@ composer_get_message (EMsgComposer *composer) && mail_config_get_send_html () && mail_config_get_confirm_unwanted_html ()) { gboolean html_problem = FALSE; - recipients = e_msg_composer_get_recipients (composer); for (i = 0; recipients[i] != NULL && !html_problem; ++i) { if (! e_destination_get_html_mail_pref (recipients[i])) html_problem = TRUE; @@ -459,7 +495,8 @@ composer_get_message (EMsgComposer *composer) e_destination_freev (recipients); if (html_problem) { camel_object_unref (CAMEL_OBJECT (message)); - return NULL; + message = NULL; + goto finished; } } } @@ -469,7 +506,8 @@ composer_get_message (EMsgComposer *composer) if (subject == NULL || subject[0] == '\0') { if (!ask_confirm_for_empty_subject (composer)) { camel_object_unref (CAMEL_OBJECT (message)); - return NULL; + message = NULL; + goto finished; } } @@ -484,8 +522,10 @@ composer_get_message (EMsgComposer *composer) /* Get the message recipients and 'touch' them, boosting their use scores */ recipients = e_msg_composer_get_recipients (composer); e_destination_touchv (recipients); + + + finished: e_destination_freev (recipients); - return message; } -- cgit